summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/BaseHTTPServer.py603
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/HTMLParser.py475
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/SimpleHTTPServer.py235
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/SocketServer.py737
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/StringIO.py324
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/UserDict.py180
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/_abcoll.py692
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/_weakrefset.py204
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/abc.py185
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/argparse.py2374
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/ast.py311
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/atexit.py65
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/binhex.py518
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/bisect.py92
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/calendar.py713
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/cmd.py404
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/codecs.py1101
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/collections.py730
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/compileall.py227
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/copy.py433
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/copy_reg.py201
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/csv.py456
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/dis.py224
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/dummy_thread.py145
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/__init__.py157
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/aliases.py527
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/ascii.py50
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/base64_codec.py79
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/big5.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/big5hkscs.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/bz2_codec.py102
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/charmap.py69
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp037.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1006.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1026.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1140.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1250.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1251.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1252.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1253.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1254.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1255.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1256.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1257.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1258.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp424.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp437.py698
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp500.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp720.py309
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp737.py698
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp775.py697
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp850.py698
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp852.py698
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp855.py698
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp856.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp857.py694
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp858.py698
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp860.py698
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp861.py698
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp862.py698
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp863.py698
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp864.py690
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp865.py698
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp866.py698
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp869.py689
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp874.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp875.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp932.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp949.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp950.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jis_2004.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jisx0213.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jp.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_kr.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gb18030.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gb2312.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gbk.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hex_codec.py79
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hp_roman8.py152
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hz.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/idna.py288
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_1.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_2.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_2004.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_3.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_ext.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_kr.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_1.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_10.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_11.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_13.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_14.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_15.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_16.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_2.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_3.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_4.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_5.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_6.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_7.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_8.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_9.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/johab.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/koi8_r.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/koi8_u.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/latin_1.py50
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_arabic.py698
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_centeuro.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_croatian.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_cyrillic.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_farsi.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_greek.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_iceland.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_latin2.py183
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_roman.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_romanian.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_turkish.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mbcs.py47
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/palmos.py83
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/ptcp154.py175
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/punycode.py238
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/quopri_codec.py75
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/raw_unicode_escape.py45
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/rot_13.py118
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jis.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jis_2004.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jisx0213.py39
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/string_escape.py38
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/tis_620.py307
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/undefined.py49
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/unicode_escape.py45
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/unicode_internal.py45
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16.py126
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16_be.py42
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16_le.py42
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32.py150
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32_be.py37
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32_le.py37
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_7.py38
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_8.py42
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_8_sig.py117
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/uu_codec.py129
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/zlib_codec.py102
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/fileinput.py417
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/fnmatch.py120
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/formatter.py445
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/functools.py100
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/genericpath.py113
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/getopt.py210
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/gettext.py594
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/hashlib.py221
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/heapq.py485
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/importlib/__init__.py38
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/inspect.py1059
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/io.py90
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/__init__.py351
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/decoder.py385
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/encoder.py448
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/scanner.py67
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/__init__.py73
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_check_circular.py34
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_decode.py69
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_default.py12
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_dump.py32
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_encode_basestring_ascii.py41
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_fail.py105
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_float.py37
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_indent.py60
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass1.py75
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass2.py18
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass3.py24
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_recursion.py108
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_scanstring.py157
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_separators.py44
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_speedups.py23
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_tool.py69
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_unicode.py89
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/json/tool.py40
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/keyword.py93
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/linecache.py139
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/locale.py2062
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/md5.py14
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/modulefinder.py673
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/numbers.py391
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/opcode.py192
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/optparse.py1704
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/pkgutil.py591
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/platform.py1655
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/pydoc_data/__init__.py0
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/pydoc_data/topics.py80
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/random.py910
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/re.py340
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/repr.py132
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/runpy.py278
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/sha.py15
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/shutil.py555
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/site-packages/README2
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/socket.py577
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/sre.py13
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/sre_compile.py596
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/sre_constants.py263
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/sre_parse.py834
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/stat.py96
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/string.py656
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/struct.py3
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/sysconfig.py640
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/textwrap.py425
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/token.py140
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/tokenize.py432
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/traceback.py320
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/types.py86
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/urlparse.py428
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/warnings.py404
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/weakref.py443
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/__init__.py41
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/NodeFilter.py27
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/__init__.py139
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/domreg.py99
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/expatbuilder.py983
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/minicompat.py110
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/minidom.py1941
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/pulldom.py351
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/xmlbuilder.py386
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementInclude.py142
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementPath.py303
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementTree.py1667
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/__init__.py33
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/cElementTree.py3
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/parsers/__init__.py8
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/parsers/expat.py4
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/__init__.py108
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/_exceptions.py131
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/expatreader.py430
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/handler.py342
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/saxutils.py353
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/xmlreader.py381
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/xmllib.py930
-rw-r--r--AppPkg/Applications/Python/Python-2.7.10/Lib/zipfile.py1539
239 files changed, 74975 insertions, 0 deletions
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
index 0000000000..d83ff519fa
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/BaseHTTPServer.py
@@ -0,0 +1,603 @@
+"""HTTP server base class.
+
+Note: the class in this module doesn't implement any HTTP request; see
+SimpleHTTPServer for simple implementations of GET, HEAD and POST
+(including CGI scripts). It does, however, optionally implement HTTP/1.1
+persistent connections, as of version 0.3.
+
+Contents:
+
+- BaseHTTPRequestHandler: HTTP request handler base class
+- test: test function
+
+XXX To do:
+
+- log requests even later (to capture byte count)
+- log user-agent header and other interesting goodies
+- send error log to separate file
+"""
+
+
+# See also:
+#
+# HTTP Working Group T. Berners-Lee
+# INTERNET-DRAFT R. T. Fielding
+# <draft-ietf-http-v10-spec-00.txt> H. Frystyk Nielsen
+# Expires September 8, 1995 March 8, 1995
+#
+# URL: http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-v10-spec-00.txt
+#
+# and
+#
+# Network Working Group R. Fielding
+# Request for Comments: 2616 et al
+# Obsoletes: 2068 June 1999
+# Category: Standards Track
+#
+# URL: http://www.faqs.org/rfcs/rfc2616.html
+
+# Log files
+# ---------
+#
+# Here's a quote from the NCSA httpd docs about log file format.
+#
+# | The logfile format is as follows. Each line consists of:
+# |
+# | host rfc931 authuser [DD/Mon/YYYY:hh:mm:ss] "request" ddd bbbb
+# |
+# | host: Either the DNS name or the IP number of the remote client
+# | rfc931: Any information returned by identd for this person,
+# | - otherwise.
+# | authuser: If user sent a userid for authentication, the user name,
+# | - otherwise.
+# | DD: Day
+# | Mon: Month (calendar name)
+# | YYYY: Year
+# | hh: hour (24-hour format, the machine's timezone)
+# | mm: minutes
+# | ss: seconds
+# | request: The first line of the HTTP request as sent by the client.
+# | ddd: the status code returned by the server, - if not available.
+# | bbbb: the total number of bytes sent,
+# | *not including the HTTP/1.0 header*, - if not available
+# |
+# | You can determine the name of the file accessed through request.
+#
+# (Actually, the latter is only true if you know the server configuration
+# at the time the request was made!)
+
+__version__ = "0.3"
+
+__all__ = ["HTTPServer", "BaseHTTPRequestHandler"]
+
+import sys
+import time
+import socket # For gethostbyaddr()
+from warnings import filterwarnings, catch_warnings
+with catch_warnings():
+ if sys.py3kwarning:
+ filterwarnings("ignore", ".*mimetools has been removed",
+ DeprecationWarning)
+ import mimetools
+import SocketServer
+
+# Default error message template
+DEFAULT_ERROR_MESSAGE = """\
+<head>
+<title>Error response</title>
+</head>
+<body>
+<h1>Error response</h1>
+<p>Error code %(code)d.
+<p>Message: %(message)s.
+<p>Error code explanation: %(code)s = %(explain)s.
+</body>
+"""
+
+DEFAULT_ERROR_CONTENT_TYPE = "text/html"
+
+def _quote_html(html):
+ return html.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
+
+class HTTPServer(SocketServer.TCPServer):
+
+ allow_reuse_address = 1 # Seems to make sense in testing environment
+
+ def server_bind(self):
+ """Override server_bind to store the server name."""
+ SocketServer.TCPServer.server_bind(self)
+ host, port = self.socket.getsockname()[:2]
+ self.server_name = socket.getfqdn(host)
+ self.server_port = port
+
+
+class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
+
+ """HTTP request handler base class.
+
+ The following explanation of HTTP serves to guide you through the
+ code as well as to expose any misunderstandings I may have about
+ HTTP (so you don't need to read the code to figure out I'm wrong
+ :-).
+
+ HTTP (HyperText Transfer Protocol) is an extensible protocol on
+ top of a reliable stream transport (e.g. TCP/IP). The protocol
+ recognizes three parts to a request:
+
+ 1. One line identifying the request type and path
+ 2. An optional set of RFC-822-style headers
+ 3. An optional data part
+
+ The headers and data are separated by a blank line.
+
+ The first line of the request has the form
+
+ <command> <path> <version>
+
+ where <command> is a (case-sensitive) keyword such as GET or POST,
+ <path> is a string containing path information for the request,
+ and <version> should be the string "HTTP/1.0" or "HTTP/1.1".
+ <path> is encoded using the URL encoding scheme (using %xx to signify
+ the ASCII character with hex code xx).
+
+ The specification specifies that lines are separated by CRLF but
+ for compatibility with the widest range of clients recommends
+ servers also handle LF. Similarly, whitespace in the request line
+ is treated sensibly (allowing multiple spaces between components
+ and allowing trailing whitespace).
+
+ Similarly, for output, lines ought to be separated by CRLF pairs
+ but most clients grok LF characters just fine.
+
+ If the first line of the request has the form
+
+ <command> <path>
+
+ (i.e. <version> is left out) then this is assumed to be an HTTP
+ 0.9 request; this form has no optional headers and data part and
+ the reply consists of just the data.
+
+ The reply form of the HTTP 1.x protocol again has three parts:
+
+ 1. One line giving the response code
+ 2. An optional set of RFC-822-style headers
+ 3. The data
+
+ Again, the headers and data are separated by a blank line.
+
+ The response code line has the form
+
+ <version> <responsecode> <responsestring>
+
+ where <version> is the protocol version ("HTTP/1.0" or "HTTP/1.1"),
+ <responsecode> is a 3-digit response code indicating success or
+ failure of the request, and <responsestring> is an optional
+ human-readable string explaining what the response code means.
+
+ This server parses the request and the headers, and then calls a
+ function specific to the request type (<command>). Specifically,
+ a request SPAM will be handled by a method do_SPAM(). If no
+ such method exists the server sends an error response to the
+ client. If it exists, it is called with no arguments:
+
+ do_SPAM()
+
+ Note that the request name is case sensitive (i.e. SPAM and spam
+ are different requests).
+
+ The various request details are stored in instance variables:
+
+ - client_address is the client IP address in the form (host,
+ port);
+
+ - command, path and version are the broken-down request line;
+
+ - headers is an instance of mimetools.Message (or a derived
+ class) containing the header information;
+
+ - rfile is a file object open for reading positioned at the
+ start of the optional input data part;
+
+ - wfile is a file object open for writing.
+
+ IT IS IMPORTANT TO ADHERE TO THE PROTOCOL FOR WRITING!
+
+ The first thing to be written must be the response line. Then
+ follow 0 or more header lines, then a blank line, and then the
+ actual data (if any). The meaning of the header lines depends on
+ the command executed by the server; in most cases, when data is
+ returned, there should be at least one header line of the form
+
+ Content-type: <type>/<subtype>
+
+ where <type> and <subtype> should be registered MIME types,
+ e.g. "text/html" or "text/plain".
+
+ """
+
+ # The Python system version, truncated to its first component.
+ sys_version = "Python/" + sys.version.split()[0]
+
+ # The server software version. You may want to override this.
+ # The format is multiple whitespace-separated strings,
+ # where each string is of the form name[/version].
+ server_version = "BaseHTTP/" + __version__
+
+ # The default request version. This only affects responses up until
+ # the point where the request line is parsed, so it mainly decides what
+ # the client gets back when sending a malformed request line.
+ # Most web servers default to HTTP 0.9, i.e. don't send a status line.
+ default_request_version = "HTTP/0.9"
+
+ def parse_request(self):
+ """Parse a request (internal).
+
+ The request should be stored in self.raw_requestline; the results
+ are in self.command, self.path, self.request_version and
+ self.headers.
+
+ Return True for success, False for failure; on failure, an
+ error is sent back.
+
+ """
+ self.command = None # set in case of error on the first line
+ self.request_version = version = self.default_request_version
+ self.close_connection = 1
+ requestline = self.raw_requestline
+ requestline = requestline.rstrip('\r\n')
+ self.requestline = requestline
+ words = requestline.split()
+ if len(words) == 3:
+ command, path, version = words
+ if version[:5] != 'HTTP/':
+ self.send_error(400, "Bad request version (%r)" % version)
+ return False
+ try:
+ base_version_number = version.split('/', 1)[1]
+ version_number = base_version_number.split(".")
+ # RFC 2145 section 3.1 says there can be only one "." and
+ # - major and minor numbers MUST be treated as
+ # separate integers;
+ # - HTTP/2.4 is a lower version than HTTP/2.13, which in
+ # turn is lower than HTTP/12.3;
+ # - Leading zeros MUST be ignored by recipients.
+ if len(version_number) != 2:
+ raise ValueError
+ version_number = int(version_number[0]), int(version_number[1])
+ except (ValueError, IndexError):
+ self.send_error(400, "Bad request version (%r)" % version)
+ return False
+ if version_number >= (1, 1) and self.protocol_version >= "HTTP/1.1":
+ self.close_connection = 0
+ if version_number >= (2, 0):
+ self.send_error(505,
+ "Invalid HTTP Version (%s)" % base_version_number)
+ return False
+ elif len(words) == 2:
+ command, path = words
+ self.close_connection = 1
+ if command != 'GET':
+ self.send_error(400,
+ "Bad HTTP/0.9 request type (%r)" % command)
+ return False
+ elif not words:
+ return False
+ else:
+ self.send_error(400, "Bad request syntax (%r)" % requestline)
+ return False
+ self.command, self.path, self.request_version = command, path, version
+
+ # Examine the headers and look for a Connection directive
+ self.headers = self.MessageClass(self.rfile, 0)
+
+ conntype = self.headers.get('Connection', "")
+ if conntype.lower() == 'close':
+ self.close_connection = 1
+ elif (conntype.lower() == 'keep-alive' and
+ self.protocol_version >= "HTTP/1.1"):
+ self.close_connection = 0
+ return True
+
+ def handle_one_request(self):
+ """Handle a single HTTP request.
+
+ You normally don't need to override this method; see the class
+ __doc__ string for information on how to handle specific HTTP
+ commands such as GET and POST.
+
+ """
+ try:
+ self.raw_requestline = self.rfile.readline(65537)
+ if len(self.raw_requestline) > 65536:
+ self.requestline = ''
+ self.request_version = ''
+ self.command = ''
+ self.send_error(414)
+ return
+ if not self.raw_requestline:
+ self.close_connection = 1
+ return
+ if not self.parse_request():
+ # An error code has been sent, just exit
+ return
+ mname = 'do_' + self.command
+ if not hasattr(self, mname):
+ self.send_error(501, "Unsupported method (%r)" % self.command)
+ return
+ method = getattr(self, mname)
+ method()
+ self.wfile.flush() #actually send the response if not already done.
+ except socket.timeout, e:
+ #a read or a write timed out. Discard this connection
+ self.log_error("Request timed out: %r", e)
+ self.close_connection = 1
+ return
+
+ def handle(self):
+ """Handle multiple requests if necessary."""
+ self.close_connection = 1
+
+ self.handle_one_request()
+ while not self.close_connection:
+ self.handle_one_request()
+
+ def send_error(self, code, message=None):
+ """Send and log an error reply.
+
+ Arguments are the error code, and a detailed message.
+ The detailed message defaults to the short entry matching the
+ response code.
+
+ This sends an error response (so it must be called before any
+ output has been generated), logs the error, and finally sends
+ a piece of HTML explaining the error to the user.
+
+ """
+
+ try:
+ short, long = self.responses[code]
+ except KeyError:
+ short, long = '???', '???'
+ if message is None:
+ message = short
+ explain = long
+ self.log_error("code %d, message %s", code, message)
+ # using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201)
+ content = (self.error_message_format %
+ {'code': code, 'message': _quote_html(message), 'explain': explain})
+ self.send_response(code, message)
+ self.send_header("Content-Type", self.error_content_type)
+ self.send_header('Connection', 'close')
+ self.end_headers()
+ if self.command != 'HEAD' and code >= 200 and code not in (204, 304):
+ self.wfile.write(content)
+
+ error_message_format = DEFAULT_ERROR_MESSAGE
+ error_content_type = DEFAULT_ERROR_CONTENT_TYPE
+
+ def send_response(self, code, message=None):
+ """Send the response header and log the response code.
+
+ Also send two standard headers with the server software
+ version and the current date.
+
+ """
+ self.log_request(code)
+ if message is None:
+ if code in self.responses:
+ message = self.responses[code][0]
+ else:
+ message = ''
+ if self.request_version != 'HTTP/0.9':
+ self.wfile.write("%s %d %s\r\n" %
+ (self.protocol_version, code, message))
+ # print (self.protocol_version, code, message)
+ self.send_header('Server', self.version_string())
+ self.send_header('Date', self.date_time_string())
+
+ def send_header(self, keyword, value):
+ """Send a MIME header."""
+ if self.request_version != 'HTTP/0.9':
+ self.wfile.write("%s: %s\r\n" % (keyword, value))
+
+ if keyword.lower() == 'connection':
+ if value.lower() == 'close':
+ self.close_connection = 1
+ elif value.lower() == 'keep-alive':
+ self.close_connection = 0
+
+ def end_headers(self):
+ """Send the blank line ending the MIME headers."""
+ if self.request_version != 'HTTP/0.9':
+ self.wfile.write("\r\n")
+
+ def log_request(self, code='-', size='-'):
+ """Log an accepted request.
+
+ This is called by send_response().
+
+ """
+
+ self.log_message('"%s" %s %s',
+ self.requestline, str(code), str(size))
+
+ def log_error(self, format, *args):
+ """Log an error.
+
+ This is called when a request cannot be fulfilled. By
+ default it passes the message on to log_message().
+
+ Arguments are the same as for log_message().
+
+ XXX This should go to the separate error log.
+
+ """
+
+ self.log_message(format, *args)
+
+ def log_message(self, format, *args):
+ """Log an arbitrary message.
+
+ This is used by all other logging functions. Override
+ it if you have specific logging wishes.
+
+ The first argument, FORMAT, is a format string for the
+ message to be logged. If the format string contains
+ any % escapes requiring parameters, they should be
+ specified as subsequent arguments (it's just like
+ printf!).
+
+ The client ip address and current date/time are prefixed to every
+ message.
+
+ """
+
+ sys.stderr.write("%s - - [%s] %s\n" %
+ (self.client_address[0],
+ self.log_date_time_string(),
+ format%args))
+
+ def version_string(self):
+ """Return the server software version string."""
+ return self.server_version + ' ' + self.sys_version
+
+ def date_time_string(self, timestamp=None):
+ """Return the current date and time formatted for a message header."""
+ if timestamp is None:
+ timestamp = time.time()
+ year, month, day, hh, mm, ss, wd, y, z = time.gmtime(timestamp)
+ s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % (
+ self.weekdayname[wd],
+ day, self.monthname[month], year,
+ hh, mm, ss)
+ return s
+
+ def log_date_time_string(self):
+ """Return the current time formatted for logging."""
+ now = time.time()
+ year, month, day, hh, mm, ss, x, y, z = time.localtime(now)
+ s = "%02d/%3s/%04d %02d:%02d:%02d" % (
+ day, self.monthname[month], year, hh, mm, ss)
+ return s
+
+ weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+
+ monthname = [None,
+ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
+
+ def address_string(self):
+ """Return the client address formatted for logging.
+
+ This version looks up the full hostname using gethostbyaddr(),
+ and tries to find a name that contains at least one dot.
+
+ """
+
+ host, port = self.client_address[:2]
+ return socket.getfqdn(host)
+
+ # Essentially static class variables
+
+ # The version of the HTTP protocol we support.
+ # Set this to HTTP/1.1 to enable automatic keepalive
+ protocol_version = "HTTP/1.0"
+
+ # The Message-like class used to parse headers
+ MessageClass = mimetools.Message
+
+ # Table mapping response codes to messages; entries have the
+ # form {code: (shortmessage, longmessage)}.
+ # See RFC 2616.
+ responses = {
+ 100: ('Continue', 'Request received, please continue'),
+ 101: ('Switching Protocols',
+ 'Switching to new protocol; obey Upgrade header'),
+
+ 200: ('OK', 'Request fulfilled, document follows'),
+ 201: ('Created', 'Document created, URL follows'),
+ 202: ('Accepted',
+ 'Request accepted, processing continues off-line'),
+ 203: ('Non-Authoritative Information', 'Request fulfilled from cache'),
+ 204: ('No Content', 'Request fulfilled, nothing follows'),
+ 205: ('Reset Content', 'Clear input form for further input.'),
+ 206: ('Partial Content', 'Partial content follows.'),
+
+ 300: ('Multiple Choices',
+ 'Object has several resources -- see URI list'),
+ 301: ('Moved Permanently', 'Object moved permanently -- see URI list'),
+ 302: ('Found', 'Object moved temporarily -- see URI list'),
+ 303: ('See Other', 'Object moved -- see Method and URL list'),
+ 304: ('Not Modified',
+ 'Document has not changed since given time'),
+ 305: ('Use Proxy',
+ 'You must use proxy specified in Location to access this '
+ 'resource.'),
+ 307: ('Temporary Redirect',
+ 'Object moved temporarily -- see URI list'),
+
+ 400: ('Bad Request',
+ 'Bad request syntax or unsupported method'),
+ 401: ('Unauthorized',
+ 'No permission -- see authorization schemes'),
+ 402: ('Payment Required',
+ 'No payment -- see charging schemes'),
+ 403: ('Forbidden',
+ 'Request forbidden -- authorization will not help'),
+ 404: ('Not Found', 'Nothing matches the given URI'),
+ 405: ('Method Not Allowed',
+ 'Specified method is invalid for this resource.'),
+ 406: ('Not Acceptable', 'URI not available in preferred format.'),
+ 407: ('Proxy Authentication Required', 'You must authenticate with '
+ 'this proxy before proceeding.'),
+ 408: ('Request Timeout', 'Request timed out; try again later.'),
+ 409: ('Conflict', 'Request conflict.'),
+ 410: ('Gone',
+ 'URI no longer exists and has been permanently removed.'),
+ 411: ('Length Required', 'Client must specify Content-Length.'),
+ 412: ('Precondition Failed', 'Precondition in headers is false.'),
+ 413: ('Request Entity Too Large', 'Entity is too large.'),
+ 414: ('Request-URI Too Long', 'URI is too long.'),
+ 415: ('Unsupported Media Type', 'Entity body in unsupported format.'),
+ 416: ('Requested Range Not Satisfiable',
+ 'Cannot satisfy request range.'),
+ 417: ('Expectation Failed',
+ 'Expect condition could not be satisfied.'),
+
+ 500: ('Internal Server Error', 'Server got itself in trouble'),
+ 501: ('Not Implemented',
+ 'Server does not support this operation'),
+ 502: ('Bad Gateway', 'Invalid responses from another server/proxy.'),
+ 503: ('Service Unavailable',
+ 'The server cannot process the request due to a high load'),
+ 504: ('Gateway Timeout',
+ 'The gateway server did not receive a timely response'),
+ 505: ('HTTP Version Not Supported', 'Cannot fulfill request.'),
+ }
+
+
+def test(HandlerClass = BaseHTTPRequestHandler,
+ ServerClass = HTTPServer, protocol="HTTP/1.0"):
+ """Test the HTTP request handler class.
+
+ This runs an HTTP server on port 8000 (or the first command line
+ argument).
+
+ """
+
+ if sys.argv[1:]:
+ port = int(sys.argv[1])
+ else:
+ port = 8000
+ server_address = ('', port)
+
+ HandlerClass.protocol_version = protocol
+ httpd = ServerClass(server_address, HandlerClass)
+
+ sa = httpd.socket.getsockname()
+ print "Serving HTTP on", sa[0], "port", sa[1], "..."
+ httpd.serve_forever()
+
+
+if __name__ == '__main__':
+ test()
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
index 0000000000..07313d203d
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/HTMLParser.py
@@ -0,0 +1,475 @@
+"""A parser for HTML and XHTML."""
+
+# This file is based on sgmllib.py, but the API is slightly different.
+
+# XXX There should be a way to distinguish between PCDATA (parsed
+# character data -- the normal case), RCDATA (replaceable character
+# data -- only char and entity references and end tags are special)
+# and CDATA (character data -- only end tags are special).
+
+
+import markupbase
+import re
+
+# Regular expressions used for parsing
+
+interesting_normal = re.compile('[&<]')
+incomplete = re.compile('&[a-zA-Z#]')
+
+entityref = re.compile('&([a-zA-Z][-.a-zA-Z0-9]*)[^a-zA-Z0-9]')
+charref = re.compile('&#(?:[0-9]+|[xX][0-9a-fA-F]+)[^0-9a-fA-F]')
+
+starttagopen = re.compile('<[a-zA-Z]')
+piclose = re.compile('>')
+commentclose = re.compile(r'--\s*>')
+
+# see http://www.w3.org/TR/html5/tokenization.html#tag-open-state
+# and http://www.w3.org/TR/html5/tokenization.html#tag-name-state
+# note: if you change tagfind/attrfind remember to update locatestarttagend too
+tagfind = re.compile('([a-zA-Z][^\t\n\r\f />\x00]*)(?:\s|/(?!>))*')
+# this regex is currently unused, but left for backward compatibility
+tagfind_tolerant = re.compile('[a-zA-Z][^\t\n\r\f />\x00]*')
+
+attrfind = re.compile(
+ r'((?<=[\'"\s/])[^\s/>][^\s/=>]*)(\s*=+\s*'
+ r'(\'[^\']*\'|"[^"]*"|(?![\'"])[^>\s]*))?(?:\s|/(?!>))*')
+
+locatestarttagend = re.compile(r"""
+ <[a-zA-Z][^\t\n\r\f />\x00]* # tag name
+ (?:[\s/]* # optional whitespace before attribute name
+ (?:(?<=['"\s/])[^\s/>][^\s/=>]* # attribute name
+ (?:\s*=+\s* # value indicator
+ (?:'[^']*' # LITA-enclosed value
+ |"[^"]*" # LIT-enclosed value
+ |(?!['"])[^>\s]* # bare value
+ )
+ )?(?:\s|/(?!>))*
+ )*
+ )?
+ \s* # trailing whitespace
+""", re.VERBOSE)
+endendtag = re.compile('>')
+# the HTML 5 spec, section 8.1.2.2, doesn't allow spaces between
+# </ and the tag name, so maybe this should be fixed
+endtagfind = re.compile('</\s*([a-zA-Z][-.a-zA-Z0-9:_]*)\s*>')
+
+
+class HTMLParseError(Exception):
+ """Exception raised for all parse errors."""
+
+ def __init__(self, msg, position=(None, None)):
+ assert msg
+ self.msg = msg
+ self.lineno = position[0]
+ self.offset = position[1]
+
+ def __str__(self):
+ result = self.msg
+ if self.lineno is not None:
+ result = result + ", at line %d" % self.lineno
+ if self.offset is not None:
+ result = result + ", column %d" % (self.offset + 1)
+ return result
+
+
+class HTMLParser(markupbase.ParserBase):
+ """Find tags and other markup and call handler functions.
+
+ Usage:
+ p = HTMLParser()
+ p.feed(data)
+ ...
+ p.close()
+
+ Start tags are handled by calling self.handle_starttag() or
+ self.handle_startendtag(); end tags by self.handle_endtag(). The
+ data between tags is passed from the parser to the derived class
+ by calling self.handle_data() with the data as argument (the data
+ may be split up in arbitrary chunks). Entity references are
+ passed by calling self.handle_entityref() with the entity
+ reference as the argument. Numeric character references are
+ passed to self.handle_charref() with the string containing the
+ reference as the argument.
+ """
+
+ CDATA_CONTENT_ELEMENTS = ("script", "style")
+
+
+ def __init__(self):
+ """Initialize and reset this instance."""
+ self.reset()
+
+ def reset(self):
+ """Reset this instance. Loses all unprocessed data."""
+ self.rawdata = ''
+ self.lasttag = '???'
+ self.interesting = interesting_normal
+ self.cdata_elem = None
+ markupbase.ParserBase.reset(self)
+
+ def feed(self, data):
+ r"""Feed data to the parser.
+
+ Call this as often as you want, with as little or as much text
+ as you want (may include '\n').
+ """
+ self.rawdata = self.rawdata + data
+ self.goahead(0)
+
+ def close(self):
+ """Handle any buffered data."""
+ self.goahead(1)
+
+ def error(self, message):
+ raise HTMLParseError(message, self.getpos())
+
+ __starttag_text = None
+
+ def get_starttag_text(self):
+ """Return full source of start tag: '<...>'."""
+ return self.__starttag_text
+
+ def set_cdata_mode(self, elem):
+ self.cdata_elem = elem.lower()
+ self.interesting = re.compile(r'</\s*%s\s*>' % self.cdata_elem, re.I)
+
+ def clear_cdata_mode(self):
+ self.interesting = interesting_normal
+ self.cdata_elem = None
+
+ # Internal -- handle data as far as reasonable. May leave state
+ # and data to be processed by a subsequent call. If 'end' is
+ # true, force handling all data as if followed by EOF marker.
+ def goahead(self, end):
+ rawdata = self.rawdata
+ i = 0
+ n = len(rawdata)
+ while i < n:
+ match = self.interesting.search(rawdata, i) # < or &
+ if match:
+ j = match.start()
+ else:
+ if self.cdata_elem:
+ break
+ j = n
+ if i < j: self.handle_data(rawdata[i:j])
+ i = self.updatepos(i, j)
+ if i == n: break
+ startswith = rawdata.startswith
+ if startswith('<', i):
+ if starttagopen.match(rawdata, i): # < + letter
+ k = self.parse_starttag(i)
+ elif startswith("</", i):
+ k = self.parse_endtag(i)
+ elif startswith("<!--", i):
+ k = self.parse_comment(i)
+ elif startswith("<?", i):
+ k = self.parse_pi(i)
+ elif startswith("<!", i):
+ k = self.parse_html_declaration(i)
+ elif (i + 1) < n:
+ self.handle_data("<")
+ k = i + 1
+ else:
+ break
+ if k < 0:
+ if not end:
+ break
+ k = rawdata.find('>', i + 1)
+ if k < 0:
+ k = rawdata.find('<', i + 1)
+ if k < 0:
+ k = i + 1
+ else:
+ k += 1
+ self.handle_data(rawdata[i:k])
+ i = self.updatepos(i, k)
+ elif startswith("&#", i):
+ match = charref.match(rawdata, i)
+ if match:
+ name = match.group()[2:-1]
+ self.handle_charref(name)
+ k = match.end()
+ if not startswith(';', k-1):
+ k = k - 1
+ i = self.updatepos(i, k)
+ continue
+ else:
+ if ";" in rawdata[i:]: # bail by consuming '&#'
+ self.handle_data(rawdata[i:i+2])
+ i = self.updatepos(i, i+2)
+ break
+ elif startswith('&', i):
+ match = entityref.match(rawdata, i)
+ if match:
+ name = match.group(1)
+ self.handle_entityref(name)
+ k = match.end()
+ if not startswith(';', k-1):
+ k = k - 1
+ i = self.updatepos(i, k)
+ continue
+ match = incomplete.match(rawdata, i)
+ if match:
+ # match.group() will contain at least 2 chars
+ if end and match.group() == rawdata[i:]:
+ self.error("EOF in middle of entity or char ref")
+ # incomplete
+ break
+ elif (i + 1) < n:
+ # not the end of the buffer, and can't be confused
+ # with some other construct
+ self.handle_data("&")
+ i = self.updatepos(i, i + 1)
+ else:
+ break
+ else:
+ assert 0, "interesting.search() lied"
+ # end while
+ if end and i < n and not self.cdata_elem:
+ self.handle_data(rawdata[i:n])
+ i = self.updatepos(i, n)
+ self.rawdata = rawdata[i:]
+
+ # Internal -- parse html declarations, return length or -1 if not terminated
+ # See w3.org/TR/html5/tokenization.html#markup-declaration-open-state
+ # See also parse_declaration in _markupbase
+ def parse_html_declaration(self, i):
+ rawdata = self.rawdata
+ if rawdata[i:i+2] != '<!':
+ self.error('unexpected call to parse_html_declaration()')
+ if rawdata[i:i+4] == '<!--':
+ # this case is actually already handled in goahead()
+ return self.parse_comment(i)
+ elif rawdata[i:i+3] == '<![':
+ return self.parse_marked_section(i)
+ elif rawdata[i:i+9].lower() == '<!doctype':
+ # find the closing >
+ gtpos = rawdata.find('>', i+9)
+ if gtpos == -1:
+ return -1
+ self.handle_decl(rawdata[i+2:gtpos])
+ return gtpos+1
+ else:
+ return self.parse_bogus_comment(i)
+
+ # Internal -- parse bogus comment, return length or -1 if not terminated
+ # see http://www.w3.org/TR/html5/tokenization.html#bogus-comment-state
+ def parse_bogus_comment(self, i, report=1):
+ rawdata = self.rawdata
+ if rawdata[i:i+2] not in ('<!', '</'):
+ self.error('unexpected call to parse_comment()')
+ pos = rawdata.find('>', i+2)
+ if pos == -1:
+ return -1
+ if report:
+ self.handle_comment(rawdata[i+2:pos])
+ return pos + 1
+
+ # Internal -- parse processing instr, return end or -1 if not terminated
+ def parse_pi(self, i):
+ rawdata = self.rawdata
+ assert rawdata[i:i+2] == '<?', 'unexpected call to parse_pi()'
+ match = piclose.search(rawdata, i+2) # >
+ if not match:
+ return -1
+ j = match.start()
+ self.handle_pi(rawdata[i+2: j])
+ j = match.end()
+ return j
+
+ # Internal -- handle starttag, return end or -1 if not terminated
+ def parse_starttag(self, i):
+ self.__starttag_text = None
+ endpos = self.check_for_whole_start_tag(i)
+ if endpos < 0:
+ return endpos
+ rawdata = self.rawdata
+ self.__starttag_text = rawdata[i:endpos]
+
+ # Now parse the data between i+1 and j into a tag and attrs
+ attrs = []
+ match = tagfind.match(rawdata, i+1)
+ assert match, 'unexpected call to parse_starttag()'
+ k = match.end()
+ self.lasttag = tag = match.group(1).lower()
+
+ while k < endpos:
+ m = attrfind.match(rawdata, k)
+ if not m:
+ break
+ attrname, rest, attrvalue = m.group(1, 2, 3)
+ if not rest:
+ attrvalue = None
+ elif attrvalue[:1] == '\'' == attrvalue[-1:] or \
+ attrvalue[:1] == '"' == attrvalue[-1:]:
+ attrvalue = attrvalue[1:-1]
+ if attrvalue:
+ attrvalue = self.unescape(attrvalue)
+ attrs.append((attrname.lower(), attrvalue))
+ k = m.end()
+
+ end = rawdata[k:endpos].strip()
+ if end not in (">", "/>"):
+ lineno, offset = self.getpos()
+ if "\n" in self.__starttag_text:
+ lineno = lineno + self.__starttag_text.count("\n")
+ offset = len(self.__starttag_text) \
+ - self.__starttag_text.rfind("\n")
+ else:
+ offset = offset + len(self.__starttag_text)
+ self.handle_data(rawdata[i:endpos])
+ return endpos
+ if end.endswith('/>'):
+ # XHTML-style empty tag: <span attr="value" />
+ self.handle_startendtag(tag, attrs)
+ else:
+ self.handle_starttag(tag, attrs)
+ if tag in self.CDATA_CONTENT_ELEMENTS:
+ self.set_cdata_mode(tag)
+ return endpos
+
+ # Internal -- check to see if we have a complete starttag; return end
+ # or -1 if incomplete.
+ def check_for_whole_start_tag(self, i):
+ rawdata = self.rawdata
+ m = locatestarttagend.match(rawdata, i)
+ if m:
+ j = m.end()
+ next = rawdata[j:j+1]
+ if next == ">":
+ return j + 1
+ if next == "/":
+ if rawdata.startswith("/>", j):
+ return j + 2
+ if rawdata.startswith("/", j):
+ # buffer boundary
+ return -1
+ # else bogus input
+ self.updatepos(i, j + 1)
+ self.error("malformed empty start tag")
+ if next == "":
+ # end of input
+ return -1
+ if next in ("abcdefghijklmnopqrstuvwxyz=/"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"):
+ # end of input in or before attribute value, or we have the
+ # '/' from a '/>' ending
+ return -1
+ if j > i:
+ return j
+ else:
+ return i + 1
+ raise AssertionError("we should not get here!")
+
+ # Internal -- parse endtag, return end or -1 if incomplete
+ def parse_endtag(self, i):
+ rawdata = self.rawdata
+ assert rawdata[i:i+2] == "</", "unexpected call to parse_endtag"
+ match = endendtag.search(rawdata, i+1) # >
+ if not match:
+ return -1
+ gtpos = match.end()
+ match = endtagfind.match(rawdata, i) # </ + tag + >
+ if not match:
+ if self.cdata_elem is not None:
+ self.handle_data(rawdata[i:gtpos])
+ return gtpos
+ # find the name: w3.org/TR/html5/tokenization.html#tag-name-state
+ namematch = tagfind.match(rawdata, i+2)
+ if not namematch:
+ # w3.org/TR/html5/tokenization.html#end-tag-open-state
+ if rawdata[i:i+3] == '</>':
+ return i+3
+ else:
+ return self.parse_bogus_comment(i)
+ tagname = namematch.group(1).lower()
+ # consume and ignore other stuff between the name and the >
+ # Note: this is not 100% correct, since we might have things like
+ # </tag attr=">">, but looking for > after tha name should cover
+ # most of the cases and is much simpler
+ gtpos = rawdata.find('>', namematch.end())
+ self.handle_endtag(tagname)
+ return gtpos+1
+
+ elem = match.group(1).lower() # script or style
+ if self.cdata_elem is not None:
+ if elem != self.cdata_elem:
+ self.handle_data(rawdata[i:gtpos])
+ return gtpos
+
+ self.handle_endtag(elem)
+ self.clear_cdata_mode()
+ return gtpos
+
+ # Overridable -- finish processing of start+end tag: <tag.../>
+ def handle_startendtag(self, tag, attrs):
+ self.handle_starttag(tag, attrs)
+ self.handle_endtag(tag)
+
+ # Overridable -- handle start tag
+ def handle_starttag(self, tag, attrs):
+ pass
+
+ # Overridable -- handle end tag
+ def handle_endtag(self, tag):
+ pass
+
+ # Overridable -- handle character reference
+ def handle_charref(self, name):
+ pass
+
+ # Overridable -- handle entity reference
+ def handle_entityref(self, name):
+ pass
+
+ # Overridable -- handle data
+ def handle_data(self, data):
+ pass
+
+ # Overridable -- handle comment
+ def handle_comment(self, data):
+ pass
+
+ # Overridable -- handle declaration
+ def handle_decl(self, decl):
+ pass
+
+ # Overridable -- handle processing instruction
+ def handle_pi(self, data):
+ pass
+
+ def unknown_decl(self, data):
+ pass
+
+ # Internal -- helper to remove special character quoting
+ entitydefs = None
+ def unescape(self, s):
+ if '&' not in s:
+ return s
+ def replaceEntities(s):
+ s = s.groups()[0]
+ try:
+ if s[0] == "#":
+ s = s[1:]
+ if s[0] in ['x','X']:
+ c = int(s[1:], 16)
+ else:
+ c = int(s)
+ return unichr(c)
+ except ValueError:
+ return '&#'+s+';'
+ else:
+ # Cannot use name2codepoint directly, because HTMLParser supports apos,
+ # which is not part of HTML 4
+ import htmlentitydefs
+ if HTMLParser.entitydefs is None:
+ entitydefs = HTMLParser.entitydefs = {'apos':u"'"}
+ for k, v in htmlentitydefs.name2codepoint.iteritems():
+ entitydefs[k] = unichr(v)
+ try:
+ return self.entitydefs[s]
+ except KeyError:
+ return '&'+s+';'
+
+ return re.sub(r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));", replaceEntities, s)
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
index 0000000000..841a1cc8c6
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/SimpleHTTPServer.py
@@ -0,0 +1,235 @@
+"""Simple HTTP Server.
+
+This module builds on BaseHTTPServer by implementing the standard GET
+and HEAD requests in a fairly straightforward manner.
+
+"""
+
+
+__version__ = "0.6"
+
+__all__ = ["SimpleHTTPRequestHandler"]
+
+import os
+import posixpath
+import BaseHTTPServer
+import urllib
+import urlparse
+import cgi
+import sys
+import shutil
+import mimetypes
+try:
+ from cStringIO import StringIO
+except ImportError:
+ from StringIO import StringIO
+
+
+class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
+
+ """Simple HTTP request handler with GET and HEAD commands.
+
+ This serves files from the current directory and any of its
+ subdirectories. The MIME type for files is determined by
+ calling the .guess_type() method.
+
+ The GET and HEAD requests are identical except that the HEAD
+ request omits the actual contents of the file.
+
+ """
+
+ server_version = "SimpleHTTP/" + __version__
+
+ def do_GET(self):
+ """Serve a GET request."""
+ f = self.send_head()
+ if f:
+ try:
+ self.copyfile(f, self.wfile)
+ finally:
+ f.close()
+
+ def do_HEAD(self):
+ """Serve a HEAD request."""
+ f = self.send_head()
+ if f:
+ f.close()
+
+ def send_head(self):
+ """Common code for GET and HEAD commands.
+
+ This sends the response code and MIME headers.
+
+ Return value is either a file object (which has to be copied
+ to the outputfile by the caller unless the command was HEAD,
+ and must be closed by the caller under all circumstances), or
+ None, in which case the caller has nothing further to do.
+
+ """
+ path = self.translate_path(self.path)
+ f = None
+ if os.path.isdir(path):
+ parts = urlparse.urlsplit(self.path)
+ if not parts.path.endswith('/'):
+ # redirect browser - doing basically what apache does
+ self.send_response(301)
+ new_parts = (parts[0], parts[1], parts[2] + '/',
+ parts[3], parts[4])
+ new_url = urlparse.urlunsplit(new_parts)
+ self.send_header("Location", new_url)
+ self.end_headers()
+ return None
+ for index in "index.html", "index.htm":
+ index = os.path.join(path, index)
+ if os.path.exists(index):
+ path = index
+ break
+ else:
+ return self.list_directory(path)
+ ctype = self.guess_type(path)
+ try:
+ # Always read in binary mode. Opening files in text mode may cause
+ # newline translations, making the actual size of the content
+ # transmitted *less* than the content-length!
+ f = open(path, 'rb')
+ except IOError:
+ self.send_error(404, "File not found")
+ return None
+ try:
+ self.send_response(200)
+ self.send_header("Content-type", ctype)
+ fs = os.fstat(f.fileno())
+ self.send_header("Content-Length", str(fs[6]))
+ self.send_header("Last-Modified", self.date_time_string(fs.st_mtime))
+ self.end_headers()
+ return f
+ except:
+ f.close()
+ raise
+
+ def list_directory(self, path):
+ """Helper to produce a directory listing (absent index.html).
+
+ Return value is either a file object, or None (indicating an
+ error). In either case, the headers are sent, making the
+ interface the same as for send_head().
+
+ """
+ try:
+ list = os.listdir(path)
+ except os.error:
+ self.send_error(404, "No permission to list directory")
+ return None
+ list.sort(key=lambda a: a.lower())
+ f = StringIO()
+ displaypath = cgi.escape(urllib.unquote(self.path))
+ f.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">')
+ f.write("<html>\n<title>Directory listing for %s</title>\n" % displaypath)
+ f.write("<body>\n<h2>Directory listing for %s</h2>\n" % displaypath)
+ f.write("<hr>\n<ul>\n")
+ for name in list:
+ fullname = os.path.join(path, name)
+ displayname = linkname = name
+ # Append / for directories or @ for symbolic links
+ if os.path.isdir(fullname):
+ displayname = name + "/"
+ linkname = name + "/"
+ if os.path.islink(fullname):
+ displayname = name + "@"
+ # Note: a link to a directory displays with @ and links with /
+ f.write('<li><a href="%s">%s</a>\n'
+ % (urllib.quote(linkname), cgi.escape(displayname)))
+ f.write("</ul>\n<hr>\n</body>\n</html>\n")
+ length = f.tell()
+ f.seek(0)
+ self.send_response(200)
+ encoding = sys.getfilesystemencoding()
+ self.send_header("Content-type", "text/html; charset=%s" % encoding)
+ self.send_header("Content-Length", str(length))
+ self.end_headers()
+ return f
+
+ def translate_path(self, path):
+ """Translate a /-separated PATH to the local filename syntax.
+
+ Components that mean special things to the local file system
+ (e.g. drive or directory names) are ignored. (XXX They should
+ probably be diagnosed.)
+
+ """
+ # abandon query parameters
+ path = path.split('?',1)[0]
+ path = path.split('#',1)[0]
+ # Don't forget explicit trailing slash when normalizing. Issue17324
+ trailing_slash = path.rstrip().endswith('/')
+ path = posixpath.normpath(urllib.unquote(path))
+ words = path.split('/')
+ words = filter(None, words)
+ path = os.getcwd()
+ for word in words:
+ drive, word = os.path.splitdrive(word)
+ head, word = os.path.split(word)
+ if word in (os.curdir, os.pardir): continue
+ path = os.path.join(path, word)
+ if trailing_slash:
+ path += '/'
+ return path
+
+ def copyfile(self, source, outputfile):
+ """Copy all data between two file objects.
+
+ The SOURCE argument is a file object open for reading
+ (or anything with a read() method) and the DESTINATION
+ argument is a file object open for writing (or
+ anything with a write() method).
+
+ The only reason for overriding this would be to change
+ the block size or perhaps to replace newlines by CRLF
+ -- note however that this the default server uses this
+ to copy binary data as well.
+
+ """
+ shutil.copyfileobj(source, outputfile)
+
+ def guess_type(self, path):
+ """Guess the type of a file.
+
+ Argument is a PATH (a filename).
+
+ Return value is a string of the form type/subtype,
+ usable for a MIME Content-type header.
+
+ The default implementation looks the file's extension
+ up in the table self.extensions_map, using application/octet-stream
+ as a default; however it would be permissible (if
+ slow) to look inside the data to make a better guess.
+
+ """
+
+ base, ext = posixpath.splitext(path)
+ if ext in self.extensions_map:
+ return self.extensions_map[ext]
+ ext = ext.lower()
+ if ext in self.extensions_map:
+ return self.extensions_map[ext]
+ else:
+ return self.extensions_map['']
+
+ if not mimetypes.inited:
+ mimetypes.init() # try to read system mime.types
+ extensions_map = mimetypes.types_map.copy()
+ extensions_map.update({
+ '': 'application/octet-stream', # Default
+ '.py': 'text/plain',
+ '.c': 'text/plain',
+ '.h': 'text/plain',
+ })
+
+
+def test(HandlerClass = SimpleHTTPRequestHandler,
+ ServerClass = BaseHTTPServer.HTTPServer):
+ BaseHTTPServer.test(HandlerClass, ServerClass)
+
+
+if __name__ == '__main__':
+ test()
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
index 0000000000..64a53d4819
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/SocketServer.py
@@ -0,0 +1,737 @@
+"""Generic socket server classes.
+
+This module tries to capture the various aspects of defining a server:
+
+For socket-based servers:
+
+- address family:
+ - AF_INET{,6}: IP (Internet Protocol) sockets (default)
+ - AF_UNIX: Unix domain sockets
+ - others, e.g. AF_DECNET are conceivable (see <socket.h>
+- socket type:
+ - SOCK_STREAM (reliable stream, e.g. TCP)
+ - SOCK_DGRAM (datagrams, e.g. UDP)
+
+For request-based servers (including socket-based):
+
+- client address verification before further looking at the request
+ (This is actually a hook for any processing that needs to look
+ at the request before anything else, e.g. logging)
+- how to handle multiple requests:
+ - synchronous (one request is handled at a time)
+ - forking (each request is handled by a new process)
+ - threading (each request is handled by a new thread)
+
+The classes in this module favor the server type that is simplest to
+write: a synchronous TCP/IP server. This is bad class design, but
+save some typing. (There's also the issue that a deep class hierarchy
+slows down method lookups.)
+
+There are five classes in an inheritance diagram, four of which represent
+synchronous servers of four types:
+
+ +------------+
+ | BaseServer |
+ +------------+
+ |
+ v
+ +-----------+ +------------------+
+ | TCPServer |------->| UnixStreamServer |
+ +-----------+ +------------------+
+ |
+ v
+ +-----------+ +--------------------+
+ | UDPServer |------->| UnixDatagramServer |
+ +-----------+ +--------------------+
+
+Note that UnixDatagramServer derives from UDPServer, not from
+UnixStreamServer -- the only difference between an IP and a Unix
+stream server is the address family, which is simply repeated in both
+unix server classes.
+
+Forking and threading versions of each type of server can be created
+using the ForkingMixIn and ThreadingMixIn mix-in classes. For
+instance, a threading UDP server class is created as follows:
+
+ class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass
+
+The Mix-in class must come first, since it overrides a method defined
+in UDPServer! Setting the various member variables also changes
+the behavior of the underlying server mechanism.
+
+To implement a service, you must derive a class from
+BaseRequestHandler and redefine its handle() method. You can then run
+various versions of the service by combining one of the server classes
+with your request handler class.
+
+The request handler class must be different for datagram or stream
+services. This can be hidden by using the request handler
+subclasses StreamRequestHandler or DatagramRequestHandler.
+
+Of course, you still have to use your head!
+
+For instance, it makes no sense to use a forking server if the service
+contains state in memory that can be modified by requests (since the
+modifications in the child process would never reach the initial state
+kept in the parent process and passed to each child). In this case,
+you can use a threading server, but you will probably have to use
+locks to avoid two requests that come in nearly simultaneous to apply
+conflicting changes to the server state.
+
+On the other hand, if you are building e.g. an HTTP server, where all
+data is stored externally (e.g. in the file system), a synchronous
+class will essentially render the service "deaf" while one request is
+being handled -- which may be for a very long time if a client is slow
+to read all the data it has requested. Here a threading or forking
+server is appropriate.
+
+In some cases, it may be appropriate to process part of a request
+synchronously, but to finish processing in a forked child depending on
+the request data. This can be implemented by using a synchronous
+server and doing an explicit fork in the request handler class
+handle() method.
+
+Another approach to handling multiple simultaneous requests in an
+environment that supports neither threads nor fork (or where these are
+too expensive or inappropriate for the service) is to maintain an
+explicit table of partially finished requests and to use select() to
+decide which request to work on next (or whether to handle a new
+incoming request). This is particularly important for stream services
+where each client can potentially be connected for a long time (if
+threads or subprocesses cannot be used).
+
+Future work:
+- Standard classes for Sun RPC (which uses either UDP or TCP)
+- Standard mix-in classes to implement various authentication
+ and encryption schemes
+- Standard framework for select-based multiplexing
+
+XXX Open problems:
+- What to do with out-of-band data?
+
+BaseServer:
+- split generic "request" functionality out into BaseServer class.
+ Copyright (C) 2000 Luke Kenneth Casson Leighton <lkcl@samba.org>
+
+ example: read entries from a SQL database (requires overriding
+ get_request() to return a table entry from the database).
+ entry is processed by a RequestHandlerClass.
+
+"""
+
+# Author of the BaseServer patch: Luke Kenneth Casson Leighton
+
+# XXX Warning!
+# There is a test suite for this module, but it cannot be run by the
+# standard regression test.
+# To run it manually, run Lib/test/test_socketserver.py.
+
+__version__ = "0.4"
+
+
+import socket
+import select
+import sys
+import os
+import errno
+try:
+ import threading
+except ImportError:
+ import dummy_threading as threading
+
+__all__ = ["TCPServer","UDPServer","ForkingUDPServer","ForkingTCPServer",
+ "ThreadingUDPServer","ThreadingTCPServer","BaseRequestHandler",
+ "StreamRequestHandler","DatagramRequestHandler",
+ "ThreadingMixIn", "ForkingMixIn"]
+if hasattr(socket, "AF_UNIX"):
+ __all__.extend(["UnixStreamServer","UnixDatagramServer",
+ "ThreadingUnixStreamServer",
+ "ThreadingUnixDatagramServer"])
+
+def _eintr_retry(func, *args):
+ """restart a system call interrupted by EINTR"""
+ while True:
+ try:
+ return func(*args)
+ except (OSError, select.error) as e:
+ if e.args[0] != errno.EINTR:
+ raise
+
+class BaseServer:
+
+ """Base class for server classes.
+
+ Methods for the caller:
+
+ - __init__(server_address, RequestHandlerClass)
+ - serve_forever(poll_interval=0.5)
+ - shutdown()
+ - handle_request() # if you do not use serve_forever()
+ - fileno() -> int # for select()
+
+ Methods that may be overridden:
+
+ - server_bind()
+ - server_activate()
+ - get_request() -> request, client_address
+ - handle_timeout()
+ - verify_request(request, client_address)
+ - server_close()
+ - process_request(request, client_address)
+ - shutdown_request(request)
+ - close_request(request)
+ - handle_error()
+
+ Methods for derived classes:
+
+ - finish_request(request, client_address)
+
+ Class variables that may be overridden by derived classes or
+ instances:
+
+ - timeout
+ - address_family
+ - socket_type
+ - allow_reuse_address
+
+ Instance variables:
+
+ - RequestHandlerClass
+ - socket
+
+ """
+
+ timeout = None
+
+ def __init__(self, server_address, RequestHandlerClass):
+ """Constructor. May be extended, do not override."""
+ self.server_address = server_address
+ self.RequestHandlerClass = RequestHandlerClass
+ self.__is_shut_down = threading.Event()
+ self.__shutdown_request = False
+
+ def server_activate(self):
+ """Called by constructor to activate the server.
+
+ May be overridden.
+
+ """
+ pass
+
+ def serve_forever(self, poll_interval=0.5):
+ """Handle one request at a time until shutdown.
+
+ Polls for shutdown every poll_interval seconds. Ignores
+ self.timeout. If you need to do periodic tasks, do them in
+ another thread.
+ """
+ self.__is_shut_down.clear()
+ try:
+ while not self.__shutdown_request:
+ # XXX: Consider using another file descriptor or
+ # connecting to the socket to wake this up instead of
+ # polling. Polling reduces our responsiveness to a
+ # shutdown request and wastes cpu at all other times.
+ r, w, e = _eintr_retry(select.select, [self], [], [],
+ poll_interval)
+ if self in r:
+ self._handle_request_noblock()
+ finally:
+ self.__shutdown_request = False
+ self.__is_shut_down.set()
+
+ def shutdown(self):
+ """Stops the serve_forever loop.
+
+ Blocks until the loop has finished. This must be called while
+ serve_forever() is running in another thread, or it will
+ deadlock.
+ """
+ self.__shutdown_request = True
+ self.__is_shut_down.wait()
+
+ # The distinction between handling, getting, processing and
+ # finishing a request is fairly arbitrary. Remember:
+ #
+ # - handle_request() is the top-level call. It calls
+ # select, get_request(), verify_request() and process_request()
+ # - get_request() is different for stream or datagram sockets
+ # - process_request() is the place that may fork a new process
+ # or create a new thread to finish the request
+ # - finish_request() instantiates the request handler class;
+ # this constructor will handle the request all by itself
+
+ def handle_request(self):
+ """Handle one request, possibly blocking.
+
+ Respects self.timeout.
+ """
+ # Support people who used socket.settimeout() to escape
+ # handle_request before self.timeout was available.
+ timeout = self.socket.gettimeout()
+ if timeout is None:
+ timeout = self.timeout
+ elif self.timeout is not None:
+ timeout = min(timeout, self.timeout)
+ fd_sets = _eintr_retry(select.select, [self], [], [], timeout)
+ if not fd_sets[0]:
+ self.handle_timeout()
+ return
+ self._handle_request_noblock()
+
+ def _handle_request_noblock(self):
+ """Handle one request, without blocking.
+
+ I assume that select.select has returned that the socket is
+ readable before this function was called, so there should be
+ no risk of blocking in get_request().
+ """
+ try:
+ request, client_address = self.get_request()
+ except socket.error:
+ return
+ if self.verify_request(request, client_address):
+ try:
+ self.process_request(request, client_address)
+ except:
+ self.handle_error(request, client_address)
+ self.shutdown_request(request)
+
+ def handle_timeout(self):
+ """Called if no new request arrives within self.timeout.
+
+ Overridden by ForkingMixIn.
+ """
+ pass
+
+ def verify_request(self, request, client_address):
+ """Verify the request. May be overridden.
+
+ Return True if we should proceed with this request.
+
+ """
+ return True
+
+ def process_request(self, request, client_address):
+ """Call finish_request.
+
+ Overridden by ForkingMixIn and ThreadingMixIn.
+
+ """
+ self.finish_request(request, client_address)
+ self.shutdown_request(request)
+
+ def server_close(self):
+ """Called to clean-up the server.
+
+ May be overridden.
+
+ """
+ pass
+
+ def finish_request(self, request, client_address):
+ """Finish one request by instantiating RequestHandlerClass."""
+ self.RequestHandlerClass(request, client_address, self)
+
+ def shutdown_request(self, request):
+ """Called to shutdown and close an individual request."""
+ self.close_request(request)
+
+ def close_request(self, request):
+ """Called to clean up an individual request."""
+ pass
+
+ def handle_error(self, request, client_address):
+ """Handle an error gracefully. May be overridden.
+
+ The default is to print a traceback and continue.
+
+ """
+ print '-'*40
+ print 'Exception happened during processing of request from',
+ print client_address
+ import traceback
+ traceback.print_exc() # XXX But this goes to stderr!
+ print '-'*40
+
+
+class TCPServer(BaseServer):
+
+ """Base class for various socket-based server classes.
+
+ Defaults to synchronous IP stream (i.e., TCP).
+
+ Methods for the caller:
+
+ - __init__(server_address, RequestHandlerClass, bind_and_activate=True)
+ - serve_forever(poll_interval=0.5)
+ - shutdown()
+ - handle_request() # if you don't use serve_forever()
+ - fileno() -> int # for select()
+
+ Methods that may be overridden:
+
+ - server_bind()
+ - server_activate()
+ - get_request() -> request, client_address
+ - handle_timeout()
+ - verify_request(request, client_address)
+ - process_request(request, client_address)
+ - shutdown_request(request)
+ - close_request(request)
+ - handle_error()
+
+ Methods for derived classes:
+
+ - finish_request(request, client_address)
+
+ Class variables that may be overridden by derived classes or
+ instances:
+
+ - timeout
+ - address_family
+ - socket_type
+ - request_queue_size (only for stream sockets)
+ - allow_reuse_address
+
+ Instance variables:
+
+ - server_address
+ - RequestHandlerClass
+ - socket
+
+ """
+
+ address_family = socket.AF_INET
+
+ socket_type = socket.SOCK_STREAM
+
+ request_queue_size = 5
+
+ allow_reuse_address = False
+
+ def __init__(self, server_address, RequestHandlerClass, bind_and_activate=True):
+ """Constructor. May be extended, do not override."""
+ BaseServer.__init__(self, server_address, RequestHandlerClass)
+ self.socket = socket.socket(self.address_family,
+ self.socket_type)
+ if bind_and_activate:
+ try:
+ self.server_bind()
+ self.server_activate()
+ except:
+ self.server_close()
+ raise
+
+ def server_bind(self):
+ """Called by constructor to bind the socket.
+
+ May be overridden.
+
+ """
+ if self.allow_reuse_address:
+ self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ self.socket.bind(self.server_address)
+ self.server_address = self.socket.getsockname()
+
+ def server_activate(self):
+ """Called by constructor to activate the server.
+
+ May be overridden.
+
+ """
+ self.socket.listen(self.request_queue_size)
+
+ def server_close(self):
+ """Called to clean-up the server.
+
+ May be overridden.
+
+ """
+ self.socket.close()
+
+ def fileno(self):
+ """Return socket file number.
+
+ Interface required by select().
+
+ """
+ return self.socket.fileno()
+
+ def get_request(self):
+ """Get the request and client address from the socket.
+
+ May be overridden.
+
+ """
+ return self.socket.accept()
+
+ def shutdown_request(self, request):
+ """Called to shutdown and close an individual request."""
+ try:
+ #explicitly shutdown. socket.close() merely releases
+ #the socket and waits for GC to perform the actual close.
+ request.shutdown(socket.SHUT_WR)
+ except socket.error:
+ pass #some platforms may raise ENOTCONN here
+ self.close_request(request)
+
+ def close_request(self, request):
+ """Called to clean up an individual request."""
+ request.close()
+
+
+class UDPServer(TCPServer):
+
+ """UDP server class."""
+
+ allow_reuse_address = False
+
+ socket_type = socket.SOCK_DGRAM
+
+ max_packet_size = 8192
+
+ def get_request(self):
+ data, client_addr = self.socket.recvfrom(self.max_packet_size)
+ return (data, self.socket), client_addr
+
+ def server_activate(self):
+ # No need to call listen() for UDP.
+ pass
+
+ def shutdown_request(self, request):
+ # No need to shutdown anything.
+ self.close_request(request)
+
+ def close_request(self, request):
+ # No need to close anything.
+ pass
+
+class ForkingMixIn:
+
+ """Mix-in class to handle each request in a new process."""
+
+ timeout = 300
+ active_children = None
+ max_children = 40
+
+ def collect_children(self):
+ """Internal routine to wait for children that have exited."""
+ if self.active_children is None:
+ return
+
+ # If we're above the max number of children, wait and reap them until
+ # we go back below threshold. Note that we use waitpid(-1) below to be
+ # able to collect children in size(<defunct children>) syscalls instead
+ # of size(<children>): the downside is that this might reap children
+ # which we didn't spawn, which is why we only resort to this when we're
+ # above max_children.
+ while len(self.active_children) >= self.max_children:
+ try:
+ pid, _ = os.waitpid(-1, 0)
+ self.active_children.discard(pid)
+ except OSError as e:
+ if e.errno == errno.ECHILD:
+ # we don't have any children, we're done
+ self.active_children.clear()
+ elif e.errno != errno.EINTR:
+ break
+
+ # Now reap all defunct children.
+ for pid in self.active_children.copy():
+ try:
+ pid, _ = os.waitpid(pid, os.WNOHANG)
+ # if the child hasn't exited yet, pid will be 0 and ignored by
+ # discard() below
+ self.active_children.discard(pid)
+ except OSError as e:
+ if e.errno == errno.ECHILD:
+ # someone else reaped it
+ self.active_children.discard(pid)
+
+ def handle_timeout(self):
+ """Wait for zombies after self.timeout seconds of inactivity.
+
+ May be extended, do not override.
+ """
+ self.collect_children()
+
+ def process_request(self, request, client_address):
+ """Fork a new subprocess to process the request."""
+ self.collect_children()
+ pid = os.fork()
+ if pid:
+ # Parent process
+ if self.active_children is None:
+ self.active_children = set()
+ self.active_children.add(pid)
+ self.close_request(request) #close handle in parent process
+ return
+ else:
+ # Child process.
+ # This must never return, hence os._exit()!
+ try:
+ self.finish_request(request, client_address)
+ self.shutdown_request(request)
+ os._exit(0)
+ except:
+ try:
+ self.handle_error(request, client_address)
+ self.shutdown_request(request)
+ finally:
+ os._exit(1)
+
+
+class ThreadingMixIn:
+ """Mix-in class to handle each request in a new thread."""
+
+ # Decides how threads will act upon termination of the
+ # main process
+ daemon_threads = False
+
+ def process_request_thread(self, request, client_address):
+ """Same as in BaseServer but as a thread.
+
+ In addition, exception handling is done here.
+
+ """
+ try:
+ self.finish_request(request, client_address)
+ self.shutdown_request(request)
+ except:
+ self.handle_error(request, client_address)
+ self.shutdown_request(request)
+
+ def process_request(self, request, client_address):
+ """Start a new thread to process the request."""
+ t = threading.Thread(target = self.process_request_thread,
+ args = (request, client_address))
+ t.daemon = self.daemon_threads
+ t.start()
+
+
+class ForkingUDPServer(ForkingMixIn, UDPServer): pass
+class ForkingTCPServer(ForkingMixIn, TCPServer): pass
+
+class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass
+class ThreadingTCPServer(ThreadingMixIn, TCPServer): pass
+
+if hasattr(socket, 'AF_UNIX'):
+
+ class UnixStreamServer(TCPServer):
+ address_family = socket.AF_UNIX
+
+ class UnixDatagramServer(UDPServer):
+ address_family = socket.AF_UNIX
+
+ class ThreadingUnixStreamServer(ThreadingMixIn, UnixStreamServer): pass
+
+ class ThreadingUnixDatagramServer(ThreadingMixIn, UnixDatagramServer): pass
+
+class BaseRequestHandler:
+
+ """Base class for request handler classes.
+
+ This class is instantiated for each request to be handled. The
+ constructor sets the instance variables request, client_address
+ and server, and then calls the handle() method. To implement a
+ specific service, all you need to do is to derive a class which
+ defines a handle() method.
+
+ The handle() method can find the request as self.request, the
+ client address as self.client_address, and the server (in case it
+ needs access to per-server information) as self.server. Since a
+ separate instance is created for each request, the handle() method
+ can define arbitrary other instance variariables.
+
+ """
+
+ def __init__(self, request, client_address, server):
+ self.request = request
+ self.client_address = client_address
+ self.server = server
+ self.setup()
+ try:
+ self.handle()
+ finally:
+ self.finish()
+
+ def setup(self):
+ pass
+
+ def handle(self):
+ pass
+
+ def finish(self):
+ pass
+
+
+# The following two classes make it possible to use the same service
+# class for stream or datagram servers.
+# Each class sets up these instance variables:
+# - rfile: a file object from which receives the request is read
+# - wfile: a file object to which the reply is written
+# When the handle() method returns, wfile is flushed properly
+
+
+class StreamRequestHandler(BaseRequestHandler):
+
+ """Define self.rfile and self.wfile for stream sockets."""
+
+ # Default buffer sizes for rfile, wfile.
+ # We default rfile to buffered because otherwise it could be
+ # really slow for large data (a getc() call per byte); we make
+ # wfile unbuffered because (a) often after a write() we want to
+ # read and we need to flush the line; (b) big writes to unbuffered
+ # files are typically optimized by stdio even when big reads
+ # aren't.
+ rbufsize = -1
+ wbufsize = 0
+
+ # A timeout to apply to the request socket, if not None.
+ timeout = None
+
+ # Disable nagle algorithm for this socket, if True.
+ # Use only when wbufsize != 0, to avoid small packets.
+ disable_nagle_algorithm = False
+
+ def setup(self):
+ self.connection = self.request
+ if self.timeout is not None:
+ self.connection.settimeout(self.timeout)
+ if self.disable_nagle_algorithm:
+ self.connection.setsockopt(socket.IPPROTO_TCP,
+ socket.TCP_NODELAY, True)
+ self.rfile = self.connection.makefile('rb', self.rbufsize)
+ self.wfile = self.connection.makefile('wb', self.wbufsize)
+
+ def finish(self):
+ if not self.wfile.closed:
+ try:
+ self.wfile.flush()
+ except socket.error:
+ # An final socket error may have occurred here, such as
+ # the local error ECONNABORTED.
+ pass
+ self.wfile.close()
+ self.rfile.close()
+
+
+class DatagramRequestHandler(BaseRequestHandler):
+
+ # XXX Regrettably, I cannot get this working on Linux;
+ # s.recvfrom() doesn't return a meaningful client address.
+
+ """Define self.rfile and self.wfile for datagram sockets."""
+
+ def setup(self):
+ try:
+ from cStringIO import StringIO
+ except ImportError:
+ from StringIO import StringIO
+ self.packet, self.socket = self.request
+ self.rfile = StringIO(self.packet)
+ self.wfile = StringIO()
+
+ def finish(self):
+ self.socket.sendto(self.wfile.getvalue(), self.client_address)
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
index 0000000000..92f4b79a61
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/StringIO.py
@@ -0,0 +1,324 @@
+r"""File-like objects that read from or write to a string buffer.
+
+This implements (nearly) all stdio methods.
+
+f = StringIO() # ready for writing
+f = StringIO(buf) # ready for reading
+f.close() # explicitly release resources held
+flag = f.isatty() # always false
+pos = f.tell() # get current position
+f.seek(pos) # set current position
+f.seek(pos, mode) # mode 0: absolute; 1: relative; 2: relative to EOF
+buf = f.read() # read until EOF
+buf = f.read(n) # read up to n bytes
+buf = f.readline() # read until end of line ('\n') or EOF
+list = f.readlines()# list of f.readline() results until EOF
+f.truncate([size]) # truncate file at to at most size (default: current pos)
+f.write(buf) # write at current position
+f.writelines(list) # for line in list: f.write(line)
+f.getvalue() # return whole file's contents as a string
+
+Notes:
+- Using a real file is often faster (but less convenient).
+- There's also a much faster implementation in C, called cStringIO, but
+ it's not subclassable.
+- fileno() is left unimplemented so that code which uses it triggers
+ an exception early.
+- Seeking far beyond EOF and then writing will insert real null
+ bytes that occupy space in the buffer.
+- There's a simple test set (see end of this file).
+"""
+try:
+ from errno import EINVAL
+except ImportError:
+ EINVAL = 22
+
+__all__ = ["StringIO"]
+
+def _complain_ifclosed(closed):
+ if closed:
+ raise ValueError, "I/O operation on closed file"
+
+class StringIO:
+ """class StringIO([buffer])
+
+ When a StringIO object is created, it can be initialized to an existing
+ string by passing the string to the constructor. If no string is given,
+ the StringIO will start empty.
+
+ The StringIO object can accept either Unicode or 8-bit strings, but
+ mixing the two may take some care. If both are used, 8-bit strings that
+ cannot be interpreted as 7-bit ASCII (that use the 8th bit) will cause
+ a UnicodeError to be raised when getvalue() is called.
+ """
+ def __init__(self, buf = ''):
+ # Force self.buf to be a string or unicode
+ if not isinstance(buf, basestring):
+ buf = str(buf)
+ self.buf = buf
+ self.len = len(buf)
+ self.buflist = []
+ self.pos = 0
+ self.closed = False
+ self.softspace = 0
+
+ def __iter__(self):
+ return self
+
+ def next(self):
+ """A file object is its own iterator, for example iter(f) returns f
+ (unless f is closed). When a file is used as an iterator, typically
+ in a for loop (for example, for line in f: print line), the next()
+ method is called repeatedly. This method returns the next input line,
+ or raises StopIteration when EOF is hit.
+ """
+ _complain_ifclosed(self.closed)
+ r = self.readline()
+ if not r:
+ raise StopIteration
+ return r
+
+ def close(self):
+ """Free the memory buffer.
+ """
+ if not self.closed:
+ self.closed = True
+ del self.buf, self.pos
+
+ def isatty(self):
+ """Returns False because StringIO objects are not connected to a
+ tty-like device.
+ """
+ _complain_ifclosed(self.closed)
+ return False
+
+ def seek(self, pos, mode = 0):
+ """Set the file's current position.
+
+ The mode argument is optional and defaults to 0 (absolute file
+ positioning); other values are 1 (seek relative to the current
+ position) and 2 (seek relative to the file's end).
+
+ There is no return value.
+ """
+ _complain_ifclosed(self.closed)
+ if self.buflist:
+ self.buf += ''.join(self.buflist)
+ self.buflist = []
+ if mode == 1:
+ pos += self.pos
+ elif mode == 2:
+ pos += self.len
+ self.pos = max(0, pos)
+
+ def tell(self):
+ """Return the file's current position."""
+ _complain_ifclosed(self.closed)
+ return self.pos
+
+ def read(self, n = -1):
+ """Read at most size bytes from the file
+ (less if the read hits EOF before obtaining size bytes).
+
+ If the size argument is negative or omitted, read all data until EOF
+ is reached. The bytes are returned as a string object. An empty
+ string is returned when EOF is encountered immediately.
+ """
+ _complain_ifclosed(self.closed)
+ if self.buflist:
+ self.buf += ''.join(self.buflist)
+ self.buflist = []
+ if n is None or n < 0:
+ newpos = self.len
+ else:
+ newpos = min(self.pos+n, self.len)
+ r = self.buf[self.pos:newpos]
+ self.pos = newpos
+ return r
+
+ def readline(self, length=None):
+ r"""Read one entire line from the file.
+
+ A trailing newline character is kept in the string (but may be absent
+ when a file ends with an incomplete line). If the size argument is
+ present and non-negative, it is a maximum byte count (including the
+ trailing newline) and an incomplete line may be returned.
+
+ An empty string is returned only when EOF is encountered immediately.
+
+ Note: Unlike stdio's fgets(), the returned string contains null
+ characters ('\0') if they occurred in the input.
+ """
+ _complain_ifclosed(self.closed)
+ if self.buflist:
+ self.buf += ''.join(self.buflist)
+ self.buflist = []
+ i = self.buf.find('\n', self.pos)
+ if i < 0:
+ newpos = self.len
+ else:
+ newpos = i+1
+ if length is not None and length >= 0:
+ if self.pos + length < newpos:
+ newpos = self.pos + length
+ r = self.buf[self.pos:newpos]
+ self.pos = newpos
+ return r
+
+ def readlines(self, sizehint = 0):
+ """Read until EOF using readline() and return a list containing the
+ lines thus read.
+
+ If the optional sizehint argument is present, instead of reading up
+ to EOF, whole lines totalling approximately sizehint bytes (or more
+ to accommodate a final whole line).
+ """
+ total = 0
+ lines = []
+ line = self.readline()
+ while line:
+ lines.append(line)
+ total += len(line)
+ if 0 < sizehint <= total:
+ break
+ line = self.readline()
+ return lines
+
+ def truncate(self, size=None):
+ """Truncate the file's size.
+
+ If the optional size argument is present, the file is truncated to
+ (at most) that size. The size defaults to the current position.
+ The current file position is not changed unless the position
+ is beyond the new file size.
+
+ If the specified size exceeds the file's current size, the
+ file remains unchanged.
+ """
+ _complain_ifclosed(self.closed)
+ if size is None:
+ size = self.pos
+ elif size < 0:
+ raise IOError(EINVAL, "Negative size not allowed")
+ elif size < self.pos:
+ self.pos = size
+ self.buf = self.getvalue()[:size]
+ self.len = size
+
+ def write(self, s):
+ """Write a string to the file.
+
+ There is no return value.
+ """
+ _complain_ifclosed(self.closed)
+ if not s: return
+ # Force s to be a string or unicode
+ if not isinstance(s, basestring):
+ s = str(s)
+ spos = self.pos
+ slen = self.len
+ if spos == slen:
+ self.buflist.append(s)
+ self.len = self.pos = spos + len(s)
+ return
+ if spos > slen:
+ self.buflist.append('\0'*(spos - slen))
+ slen = spos
+ newpos = spos + len(s)
+ if spos < slen:
+ if self.buflist:
+ self.buf += ''.join(self.buflist)
+ self.buflist = [self.buf[:spos], s, self.buf[newpos:]]
+ self.buf = ''
+ if newpos > slen:
+ slen = newpos
+ else:
+ self.buflist.append(s)
+ slen = newpos
+ self.len = slen
+ self.pos = newpos
+
+ def writelines(self, iterable):
+ """Write a sequence of strings to the file. The sequence can be any
+ iterable object producing strings, typically a list of strings. There
+ is no return value.
+
+ (The name is intended to match readlines(); writelines() does not add
+ line separators.)
+ """
+ write = self.write
+ for line in iterable:
+ write(line)
+
+ def flush(self):
+ """Flush the internal buffer
+ """
+ _complain_ifclosed(self.closed)
+
+ def getvalue(self):
+ """
+ Retrieve the entire contents of the "file" at any time before
+ the StringIO object's close() method is called.
+
+ The StringIO object can accept either Unicode or 8-bit strings,
+ but mixing the two may take some care. If both are used, 8-bit
+ strings that cannot be interpreted as 7-bit ASCII (that use the
+ 8th bit) will cause a UnicodeError to be raised when getvalue()
+ is called.
+ """
+ _complain_ifclosed(self.closed)
+ if self.buflist:
+ self.buf += ''.join(self.buflist)
+ self.buflist = []
+ return self.buf
+
+
+# A little test suite
+
+def test():
+ import sys
+ if sys.argv[1:]:
+ file = sys.argv[1]
+ else:
+ file = '/etc/passwd'
+ lines = open(file, 'r').readlines()
+ text = open(file, 'r').read()
+ f = StringIO()
+ for line in lines[:-2]:
+ f.write(line)
+ f.writelines(lines[-2:])
+ if f.getvalue() != text:
+ raise RuntimeError, 'write failed'
+ length = f.tell()
+ print 'File length =', length
+ f.seek(len(lines[0]))
+ f.write(lines[1])
+ f.seek(0)
+ print 'First line =', repr(f.readline())
+ print 'Position =', f.tell()
+ line = f.readline()
+ print 'Second line =', repr(line)
+ f.seek(-len(line), 1)
+ line2 = f.read(len(line))
+ if line != line2:
+ raise RuntimeError, 'bad result after seek back'
+ f.seek(len(line2), 1)
+ list = f.readlines()
+ line = list[-1]
+ f.seek(f.tell() - len(line))
+ line2 = f.read()
+ if line != line2:
+ raise RuntimeError, 'bad result after seek back from EOF'
+ print 'Read', len(list), 'more lines'
+ print 'File length =', f.tell()
+ if f.tell() != length:
+ raise RuntimeError, 'bad length'
+ f.truncate(length/2)
+ f.seek(0, 2)
+ print 'Truncated length =', f.tell()
+ if f.tell() != length/2:
+ raise RuntimeError, 'truncate did not adjust length'
+ f.close()
+
+if __name__ == '__main__':
+ test()
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
index 0000000000..67822a300d
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/UserDict.py
@@ -0,0 +1,180 @@
+"""A more or less complete user-defined wrapper around dictionary objects."""
+
+class UserDict:
+ def __init__(self, dict=None, **kwargs):
+ self.data = {}
+ if dict is not None:
+ self.update(dict)
+ if len(kwargs):
+ self.update(kwargs)
+ def __repr__(self): return repr(self.data)
+ def __cmp__(self, dict):
+ if isinstance(dict, UserDict):
+ return cmp(self.data, dict.data)
+ else:
+ return cmp(self.data, dict)
+ __hash__ = None # Avoid Py3k warning
+ def __len__(self): return len(self.data)
+ def __getitem__(self, key):
+ if key in self.data:
+ return self.data[key]
+ if hasattr(self.__class__, "__missing__"):
+ return self.__class__.__missing__(self, key)
+ raise KeyError(key)
+ def __setitem__(self, key, item): self.data[key] = item
+ def __delitem__(self, key): del self.data[key]
+ def clear(self): self.data.clear()
+ def copy(self):
+ if self.__class__ is UserDict:
+ return UserDict(self.data.copy())
+ import copy
+ data = self.data
+ try:
+ self.data = {}
+ c = copy.copy(self)
+ finally:
+ self.data = data
+ c.update(self)
+ return c
+ def keys(self): return self.data.keys()
+ def items(self): return self.data.items()
+ def iteritems(self): return self.data.iteritems()
+ def iterkeys(self): return self.data.iterkeys()
+ def itervalues(self): return self.data.itervalues()
+ def values(self): return self.data.values()
+ def has_key(self, key): return key in self.data
+ def update(self, dict=None, **kwargs):
+ if dict is None:
+ pass
+ elif isinstance(dict, UserDict):
+ self.data.update(dict.data)
+ elif isinstance(dict, type({})) or not hasattr(dict, 'items'):
+ self.data.update(dict)
+ else:
+ for k, v in dict.items():
+ self[k] = v
+ if len(kwargs):
+ self.data.update(kwargs)
+ def get(self, key, failobj=None):
+ if key not in self:
+ return failobj
+ return self[key]
+ def setdefault(self, key, failobj=None):
+ if key not in self:
+ self[key] = failobj
+ return self[key]
+ def pop(self, key, *args):
+ return self.data.pop(key, *args)
+ def popitem(self):
+ return self.data.popitem()
+ def __contains__(self, key):
+ return key in self.data
+ @classmethod
+ def fromkeys(cls, iterable, value=None):
+ d = cls()
+ for key in iterable:
+ d[key] = value
+ return d
+
+class IterableUserDict(UserDict):
+ def __iter__(self):
+ return iter(self.data)
+
+import _abcoll
+_abcoll.MutableMapping.register(IterableUserDict)
+
+
+class DictMixin:
+ # Mixin defining all dictionary methods for classes that already have
+ # a minimum dictionary interface including getitem, setitem, delitem,
+ # and keys. Without knowledge of the subclass constructor, the mixin
+ # does not define __init__() or copy(). In addition to the four base
+ # methods, progressively more efficiency comes with defining
+ # __contains__(), __iter__(), and iteritems().
+
+ # second level definitions support higher levels
+ def __iter__(self):
+ for k in self.keys():
+ yield k
+ def has_key(self, key):
+ try:
+ self[key]
+ except KeyError:
+ return False
+ return True
+ def __contains__(self, key):
+ return self.has_key(key)
+
+ # third level takes advantage of second level definitions
+ def iteritems(self):
+ for k in self:
+ yield (k, self[k])
+ def iterkeys(self):
+ return self.__iter__()
+
+ # fourth level uses definitions from lower levels
+ def itervalues(self):
+ for _, v in self.iteritems():
+ yield v
+ def values(self):
+ return [v for _, v in self.iteritems()]
+ def items(self):
+ return list(self.iteritems())
+ def clear(self):
+ for key in self.keys():
+ del self[key]
+ def setdefault(self, key, default=None):
+ try:
+ return self[key]
+ except KeyError:
+ self[key] = default
+ return default
+ def pop(self, key, *args):
+ if len(args) > 1:
+ raise TypeError, "pop expected at most 2 arguments, got "\
+ + repr(1 + len(args))
+ try:
+ value = self[key]
+ except KeyError:
+ if args:
+ return args[0]
+ raise
+ del self[key]
+ return value
+ def popitem(self):
+ try:
+ k, v = self.iteritems().next()
+ except StopIteration:
+ raise KeyError, 'container is empty'
+ del self[k]
+ return (k, v)
+ def update(self, other=None, **kwargs):
+ # Make progressively weaker assumptions about "other"
+ if other is None:
+ pass
+ elif hasattr(other, 'iteritems'): # iteritems saves memory and lookups
+ for k, v in other.iteritems():
+ self[k] = v
+ elif hasattr(other, 'keys'):
+ for k in other.keys():
+ self[k] = other[k]
+ else:
+ for k, v in other:
+ self[k] = v
+ if kwargs:
+ self.update(kwargs)
+ def get(self, key, default=None):
+ try:
+ return self[key]
+ except KeyError:
+ return default
+ def __repr__(self):
+ return repr(dict(self.iteritems()))
+ def __cmp__(self, other):
+ if other is None:
+ return 1
+ if isinstance(other, DictMixin):
+ other = dict(other.iteritems())
+ return cmp(dict(self.iteritems()), other)
+ def __len__(self):
+ return len(self.keys())
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
index 0000000000..62f40518bb
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/_abcoll.py
@@ -0,0 +1,692 @@
+# Copyright 2007 Google, Inc. All Rights Reserved.
+# Licensed to PSF under a Contributor Agreement.
+
+"""Abstract Base Classes (ABCs) for collections, according to PEP 3119.
+
+DON'T USE THIS MODULE DIRECTLY! The classes here should be imported
+via collections; they are defined here only to alleviate certain
+bootstrapping issues. Unit tests are in test_collections.
+"""
+
+from abc import ABCMeta, abstractmethod
+import sys
+
+__all__ = ["Hashable", "Iterable", "Iterator",
+ "Sized", "Container", "Callable",
+ "Set", "MutableSet",
+ "Mapping", "MutableMapping",
+ "MappingView", "KeysView", "ItemsView", "ValuesView",
+ "Sequence", "MutableSequence",
+ ]
+
+### ONE-TRICK PONIES ###
+
+def _hasattr(C, attr):
+ try:
+ return any(attr in B.__dict__ for B in C.__mro__)
+ except AttributeError:
+ # Old-style class
+ return hasattr(C, attr)
+
+
+class Hashable:
+ __metaclass__ = ABCMeta
+
+ @abstractmethod
+ def __hash__(self):
+ return 0
+
+ @classmethod
+ def __subclasshook__(cls, C):
+ if cls is Hashable:
+ try:
+ for B in C.__mro__:
+ if "__hash__" in B.__dict__:
+ if B.__dict__["__hash__"]:
+ return True
+ break
+ except AttributeError:
+ # Old-style class
+ if getattr(C, "__hash__", None):
+ return True
+ return NotImplemented
+
+
+class Iterable:
+ __metaclass__ = ABCMeta
+
+ @abstractmethod
+ def __iter__(self):
+ while False:
+ yield None
+
+ @classmethod
+ def __subclasshook__(cls, C):
+ if cls is Iterable:
+ if _hasattr(C, "__iter__"):
+ return True
+ return NotImplemented
+
+Iterable.register(str)
+
+
+class Iterator(Iterable):
+
+ @abstractmethod
+ def next(self):
+ 'Return the next item from the iterator. When exhausted, raise StopIteration'
+ raise StopIteration
+
+ def __iter__(self):
+ return self
+
+ @classmethod
+ def __subclasshook__(cls, C):
+ if cls is Iterator:
+ if _hasattr(C, "next") and _hasattr(C, "__iter__"):
+ return True
+ return NotImplemented
+
+
+class Sized:
+ __metaclass__ = ABCMeta
+
+ @abstractmethod
+ def __len__(self):
+ return 0
+
+ @classmethod
+ def __subclasshook__(cls, C):
+ if cls is Sized:
+ if _hasattr(C, "__len__"):
+ return True
+ return NotImplemented
+
+
+class Container:
+ __metaclass__ = ABCMeta
+
+ @abstractmethod
+ def __contains__(self, x):
+ return False
+
+ @classmethod
+ def __subclasshook__(cls, C):
+ if cls is Container:
+ if _hasattr(C, "__contains__"):
+ return True
+ return NotImplemented
+
+
+class Callable:
+ __metaclass__ = ABCMeta
+
+ @abstractmethod
+ def __call__(self, *args, **kwds):
+ return False
+
+ @classmethod
+ def __subclasshook__(cls, C):
+ if cls is Callable:
+ if _hasattr(C, "__call__"):
+ return True
+ return NotImplemented
+
+
+### SETS ###
+
+
+class Set(Sized, Iterable, Container):
+ """A set is a finite, iterable container.
+
+ This class provides concrete generic implementations of all
+ methods except for __contains__, __iter__ and __len__.
+
+ To override the comparisons (presumably for speed, as the
+ semantics are fixed), redefine __le__ and __ge__,
+ then the other operations will automatically follow suit.
+ """
+
+ def __le__(self, other):
+ if not isinstance(other, Set):
+ return NotImplemented
+ if len(self) > len(other):
+ return False
+ for elem in self:
+ if elem not in other:
+ return False
+ return True
+
+ def __lt__(self, other):
+ if not isinstance(other, Set):
+ return NotImplemented
+ return len(self) < len(other) and self.__le__(other)
+
+ def __gt__(self, other):
+ if not isinstance(other, Set):
+ return NotImplemented
+ return len(self) > len(other) and self.__ge__(other)
+
+ def __ge__(self, other):
+ if not isinstance(other, Set):
+ return NotImplemented
+ if len(self) < len(other):
+ return False
+ for elem in other:
+ if elem not in self:
+ return False
+ return True
+
+ def __eq__(self, other):
+ if not isinstance(other, Set):
+ return NotImplemented
+ return len(self) == len(other) and self.__le__(other)
+
+ def __ne__(self, other):
+ return not (self == other)
+
+ @classmethod
+ def _from_iterable(cls, it):
+ '''Construct an instance of the class from any iterable input.
+
+ Must override this method if the class constructor signature
+ does not accept an iterable for an input.
+ '''
+ return cls(it)
+
+ def __and__(self, other):
+ if not isinstance(other, Iterable):
+ return NotImplemented
+ return self._from_iterable(value for value in other if value in self)
+
+ __rand__ = __and__
+
+ def isdisjoint(self, other):
+ 'Return True if two sets have a null intersection.'
+ for value in other:
+ if value in self:
+ return False
+ return True
+
+ def __or__(self, other):
+ if not isinstance(other, Iterable):
+ return NotImplemented
+ chain = (e for s in (self, other) for e in s)
+ return self._from_iterable(chain)
+
+ __ror__ = __or__
+
+ def __sub__(self, other):
+ if not isinstance(other, Set):
+ if not isinstance(other, Iterable):
+ return NotImplemented
+ other = self._from_iterable(other)
+ return self._from_iterable(value for value in self
+ if value not in other)
+
+ def __rsub__(self, other):
+ if not isinstance(other, Set):
+ if not isinstance(other, Iterable):
+ return NotImplemented
+ other = self._from_iterable(other)
+ return self._from_iterable(value for value in other
+ if value not in self)
+
+ def __xor__(self, other):
+ if not isinstance(other, Set):
+ if not isinstance(other, Iterable):
+ return NotImplemented
+ other = self._from_iterable(other)
+ return (self - other) | (other - self)
+
+ __rxor__ = __xor__
+
+ # Sets are not hashable by default, but subclasses can change this
+ __hash__ = None
+
+ def _hash(self):
+ """Compute the hash value of a set.
+
+ Note that we don't define __hash__: not all sets are hashable.
+ But if you define a hashable set type, its __hash__ should
+ call this function.
+
+ This must be compatible __eq__.
+
+ All sets ought to compare equal if they contain the same
+ elements, regardless of how they are implemented, and
+ regardless of the order of the elements; so there's not much
+ freedom for __eq__ or __hash__. We match the algorithm used
+ by the built-in frozenset type.
+ """
+ MAX = sys.maxint
+ MASK = 2 * MAX + 1
+ n = len(self)
+ h = 1927868237 * (n + 1)
+ h &= MASK
+ for x in self:
+ hx = hash(x)
+ h ^= (hx ^ (hx << 16) ^ 89869747) * 3644798167
+ h &= MASK
+ h = h * 69069 + 907133923
+ h &= MASK
+ if h > MAX:
+ h -= MASK + 1
+ if h == -1:
+ h = 590923713
+ return h
+
+Set.register(frozenset)
+
+
+class MutableSet(Set):
+ """A mutable set is a finite, iterable container.
+
+ This class provides concrete generic implementations of all
+ methods except for __contains__, __iter__, __len__,
+ add(), and discard().
+
+ To override the comparisons (presumably for speed, as the
+ semantics are fixed), all you have to do is redefine __le__ and
+ then the other operations will automatically follow suit.
+ """
+
+ @abstractmethod
+ def add(self, value):
+ """Add an element."""
+ raise NotImplementedError
+
+ @abstractmethod
+ def discard(self, value):
+ """Remove an element. Do not raise an exception if absent."""
+ raise NotImplementedError
+
+ def remove(self, value):
+ """Remove an element. If not a member, raise a KeyError."""
+ if value not in self:
+ raise KeyError(value)
+ self.discard(value)
+
+ def pop(self):
+ """Return the popped value. Raise KeyError if empty."""
+ it = iter(self)
+ try:
+ value = next(it)
+ except StopIteration:
+ raise KeyError
+ self.discard(value)
+ return value
+
+ def clear(self):
+ """This is slow (creates N new iterators!) but effective."""
+ try:
+ while True:
+ self.pop()
+ except KeyError:
+ pass
+
+ def __ior__(self, it):
+ for value in it:
+ self.add(value)
+ return self
+
+ def __iand__(self, it):
+ for value in (self - it):
+ self.discard(value)
+ return self
+
+ def __ixor__(self, it):
+ if it is self:
+ self.clear()
+ else:
+ if not isinstance(it, Set):
+ it = self._from_iterable(it)
+ for value in it:
+ if value in self:
+ self.discard(value)
+ else:
+ self.add(value)
+ return self
+
+ def __isub__(self, it):
+ if it is self:
+ self.clear()
+ else:
+ for value in it:
+ self.discard(value)
+ return self
+
+MutableSet.register(set)
+
+
+### MAPPINGS ###
+
+
+class Mapping(Sized, Iterable, Container):
+
+ """A Mapping is a generic container for associating key/value
+ pairs.
+
+ This class provides concrete generic implementations of all
+ methods except for __getitem__, __iter__, and __len__.
+
+ """
+
+ @abstractmethod
+ def __getitem__(self, key):
+ raise KeyError
+
+ def get(self, key, default=None):
+ 'D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.'
+ try:
+ return self[key]
+ except KeyError:
+ return default
+
+ def __contains__(self, key):
+ try:
+ self[key]
+ except KeyError:
+ return False
+ else:
+ return True
+
+ def iterkeys(self):
+ 'D.iterkeys() -> an iterator over the keys of D'
+ return iter(self)
+
+ def itervalues(self):
+ 'D.itervalues() -> an iterator over the values of D'
+ for key in self:
+ yield self[key]
+
+ def iteritems(self):
+ 'D.iteritems() -> an iterator over the (key, value) items of D'
+ for key in self:
+ yield (key, self[key])
+
+ def keys(self):
+ "D.keys() -> list of D's keys"
+ return list(self)
+
+ def items(self):
+ "D.items() -> list of D's (key, value) pairs, as 2-tuples"
+ return [(key, self[key]) for key in self]
+
+ def values(self):
+ "D.values() -> list of D's values"
+ return [self[key] for key in self]
+
+ # Mappings are not hashable by default, but subclasses can change this
+ __hash__ = None
+
+ def __eq__(self, other):
+ if not isinstance(other, Mapping):
+ return NotImplemented
+ return dict(self.items()) == dict(other.items())
+
+ def __ne__(self, other):
+ return not (self == other)
+
+class MappingView(Sized):
+
+ def __init__(self, mapping):
+ self._mapping = mapping
+
+ def __len__(self):
+ return len(self._mapping)
+
+ def __repr__(self):
+ return '{0.__class__.__name__}({0._mapping!r})'.format(self)
+
+
+class KeysView(MappingView, Set):
+
+ @classmethod
+ def _from_iterable(self, it):
+ return set(it)
+
+ def __contains__(self, key):
+ return key in self._mapping
+
+ def __iter__(self):
+ for key in self._mapping:
+ yield key
+
+
+class ItemsView(MappingView, Set):
+
+ @classmethod
+ def _from_iterable(self, it):
+ return set(it)
+
+ def __contains__(self, item):
+ key, value = item
+ try:
+ v = self._mapping[key]
+ except KeyError:
+ return False
+ else:
+ return v == value
+
+ def __iter__(self):
+ for key in self._mapping:
+ yield (key, self._mapping[key])
+
+
+class ValuesView(MappingView):
+
+ def __contains__(self, value):
+ for key in self._mapping:
+ if value == self._mapping[key]:
+ return True
+ return False
+
+ def __iter__(self):
+ for key in self._mapping:
+ yield self._mapping[key]
+
+
+class MutableMapping(Mapping):
+
+ """A MutableMapping is a generic container for associating
+ key/value pairs.
+
+ This class provides concrete generic implementations of all
+ methods except for __getitem__, __setitem__, __delitem__,
+ __iter__, and __len__.
+
+ """
+
+ @abstractmethod
+ def __setitem__(self, key, value):
+ raise KeyError
+
+ @abstractmethod
+ def __delitem__(self, key):
+ raise KeyError
+
+ __marker = object()
+
+ def pop(self, key, default=__marker):
+ '''D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
+ If key is not found, d is returned if given, otherwise KeyError is raised.
+ '''
+ try:
+ value = self[key]
+ except KeyError:
+ if default is self.__marker:
+ raise
+ return default
+ else:
+ del self[key]
+ return value
+
+ def popitem(self):
+ '''D.popitem() -> (k, v), remove and return some (key, value) pair
+ as a 2-tuple; but raise KeyError if D is empty.
+ '''
+ try:
+ key = next(iter(self))
+ except StopIteration:
+ raise KeyError
+ value = self[key]
+ del self[key]
+ return key, value
+
+ def clear(self):
+ 'D.clear() -> None. Remove all items from D.'
+ try:
+ while True:
+ self.popitem()
+ except KeyError:
+ pass
+
+ def update(*args, **kwds):
+ ''' D.update([E, ]**F) -> None. Update D from mapping/iterable E and F.
+ If E present and has a .keys() method, does: for k in E: D[k] = E[k]
+ If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v
+ In either case, this is followed by: for k, v in F.items(): D[k] = v
+ '''
+ if not args:
+ raise TypeError("descriptor 'update' of 'MutableMapping' object "
+ "needs an argument")
+ self = args[0]
+ args = args[1:]
+ if len(args) > 1:
+ raise TypeError('update expected at most 1 arguments, got %d' %
+ len(args))
+ if args:
+ other = args[0]
+ if isinstance(other, Mapping):
+ for key in other:
+ self[key] = other[key]
+ elif hasattr(other, "keys"):
+ for key in other.keys():
+ self[key] = other[key]
+ else:
+ for key, value in other:
+ self[key] = value
+ for key, value in kwds.items():
+ self[key] = value
+
+ def setdefault(self, key, default=None):
+ 'D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D'
+ try:
+ return self[key]
+ except KeyError:
+ self[key] = default
+ return default
+
+MutableMapping.register(dict)
+
+
+### SEQUENCES ###
+
+
+class Sequence(Sized, Iterable, Container):
+ """All the operations on a read-only sequence.
+
+ Concrete subclasses must override __new__ or __init__,
+ __getitem__, and __len__.
+ """
+
+ @abstractmethod
+ def __getitem__(self, index):
+ raise IndexError
+
+ def __iter__(self):
+ i = 0
+ try:
+ while True:
+ v = self[i]
+ yield v
+ i += 1
+ except IndexError:
+ return
+
+ def __contains__(self, value):
+ for v in self:
+ if v == value:
+ return True
+ return False
+
+ def __reversed__(self):
+ for i in reversed(range(len(self))):
+ yield self[i]
+
+ def index(self, value):
+ '''S.index(value) -> integer -- return first index of value.
+ Raises ValueError if the value is not present.
+ '''
+ for i, v in enumerate(self):
+ if v == value:
+ return i
+ raise ValueError
+
+ def count(self, value):
+ 'S.count(value) -> integer -- return number of occurrences of value'
+ return sum(1 for v in self if v == value)
+
+Sequence.register(tuple)
+Sequence.register(basestring)
+Sequence.register(buffer)
+Sequence.register(xrange)
+
+
+class MutableSequence(Sequence):
+
+ """All the operations on a read-only sequence.
+
+ Concrete subclasses must provide __new__ or __init__,
+ __getitem__, __setitem__, __delitem__, __len__, and insert().
+
+ """
+
+ @abstractmethod
+ def __setitem__(self, index, value):
+ raise IndexError
+
+ @abstractmethod
+ def __delitem__(self, index):
+ raise IndexError
+
+ @abstractmethod
+ def insert(self, index, value):
+ 'S.insert(index, object) -- insert object before index'
+ raise IndexError
+
+ def append(self, value):
+ 'S.append(object) -- append object to the end of the sequence'
+ self.insert(len(self), value)
+
+ def reverse(self):
+ 'S.reverse() -- reverse *IN PLACE*'
+ n = len(self)
+ for i in range(n//2):
+ self[i], self[n-i-1] = self[n-i-1], self[i]
+
+ def extend(self, values):
+ 'S.extend(iterable) -- extend sequence by appending elements from the iterable'
+ for v in values:
+ self.append(v)
+
+ def pop(self, index=-1):
+ '''S.pop([index]) -> item -- remove and return item at index (default last).
+ Raise IndexError if list is empty or index is out of range.
+ '''
+ v = self[index]
+ del self[index]
+ return v
+
+ def remove(self, value):
+ '''S.remove(value) -- remove first occurrence of value.
+ Raise ValueError if the value is not present.
+ '''
+ del self[self.index(value)]
+
+ def __iadd__(self, values):
+ self.extend(values)
+ return self
+
+MutableSequence.register(list)
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
index 0000000000..9cd1857731
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/_weakrefset.py
@@ -0,0 +1,204 @@
+# Access WeakSet through the weakref module.
+# This code is separated-out because it is needed
+# by abc.py to load everything else at startup.
+
+from _weakref import ref
+
+__all__ = ['WeakSet']
+
+
+class _IterationGuard(object):
+ # This context manager registers itself in the current iterators of the
+ # weak container, such as to delay all removals until the context manager
+ # exits.
+ # This technique should be relatively thread-safe (since sets are).
+
+ def __init__(self, weakcontainer):
+ # Don't create cycles
+ self.weakcontainer = ref(weakcontainer)
+
+ def __enter__(self):
+ w = self.weakcontainer()
+ if w is not None:
+ w._iterating.add(self)
+ return self
+
+ def __exit__(self, e, t, b):
+ w = self.weakcontainer()
+ if w is not None:
+ s = w._iterating
+ s.remove(self)
+ if not s:
+ w._commit_removals()
+
+
+class WeakSet(object):
+ def __init__(self, data=None):
+ self.data = set()
+ def _remove(item, selfref=ref(self)):
+ self = selfref()
+ if self is not None:
+ if self._iterating:
+ self._pending_removals.append(item)
+ else:
+ self.data.discard(item)
+ self._remove = _remove
+ # A list of keys to be removed
+ self._pending_removals = []
+ self._iterating = set()
+ if data is not None:
+ self.update(data)
+
+ def _commit_removals(self):
+ l = self._pending_removals
+ discard = self.data.discard
+ while l:
+ discard(l.pop())
+
+ def __iter__(self):
+ with _IterationGuard(self):
+ for itemref in self.data:
+ item = itemref()
+ if item is not None:
+ # Caveat: the iterator will keep a strong reference to
+ # `item` until it is resumed or closed.
+ yield item
+
+ def __len__(self):
+ return len(self.data) - len(self._pending_removals)
+
+ def __contains__(self, item):
+ try:
+ wr = ref(item)
+ except TypeError:
+ return False
+ return wr in self.data
+
+ def __reduce__(self):
+ return (self.__class__, (list(self),),
+ getattr(self, '__dict__', None))
+
+ __hash__ = None
+
+ def add(self, item):
+ if self._pending_removals:
+ self._commit_removals()
+ self.data.add(ref(item, self._remove))
+
+ def clear(self):
+ if self._pending_removals:
+ self._commit_removals()
+ self.data.clear()
+
+ def copy(self):
+ return self.__class__(self)
+
+ def pop(self):
+ if self._pending_removals:
+ self._commit_removals()
+ while True:
+ try:
+ itemref = self.data.pop()
+ except KeyError:
+ raise KeyError('pop from empty WeakSet')
+ item = itemref()
+ if item is not None:
+ return item
+
+ def remove(self, item):
+ if self._pending_removals:
+ self._commit_removals()
+ self.data.remove(ref(item))
+
+ def discard(self, item):
+ if self._pending_removals:
+ self._commit_removals()
+ self.data.discard(ref(item))
+
+ def update(self, other):
+ if self._pending_removals:
+ self._commit_removals()
+ for element in other:
+ self.add(element)
+
+ def __ior__(self, other):
+ self.update(other)
+ return self
+
+ def difference(self, other):
+ newset = self.copy()
+ newset.difference_update(other)
+ return newset
+ __sub__ = difference
+
+ def difference_update(self, other):
+ self.__isub__(other)
+ def __isub__(self, other):
+ if self._pending_removals:
+ self._commit_removals()
+ if self is other:
+ self.data.clear()
+ else:
+ self.data.difference_update(ref(item) for item in other)
+ return self
+
+ def intersection(self, other):
+ return self.__class__(item for item in other if item in self)
+ __and__ = intersection
+
+ def intersection_update(self, other):
+ self.__iand__(other)
+ def __iand__(self, other):
+ if self._pending_removals:
+ self._commit_removals()
+ self.data.intersection_update(ref(item) for item in other)
+ return self
+
+ def issubset(self, other):
+ return self.data.issubset(ref(item) for item in other)
+ __le__ = issubset
+
+ def __lt__(self, other):
+ return self.data < set(ref(item) for item in other)
+
+ def issuperset(self, other):
+ return self.data.issuperset(ref(item) for item in other)
+ __ge__ = issuperset
+
+ def __gt__(self, other):
+ return self.data > set(ref(item) for item in other)
+
+ def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return self.data == set(ref(item) for item in other)
+
+ def __ne__(self, other):
+ opposite = self.__eq__(other)
+ if opposite is NotImplemented:
+ return NotImplemented
+ return not opposite
+
+ def symmetric_difference(self, other):
+ newset = self.copy()
+ newset.symmetric_difference_update(other)
+ return newset
+ __xor__ = symmetric_difference
+
+ def symmetric_difference_update(self, other):
+ self.__ixor__(other)
+ def __ixor__(self, other):
+ if self._pending_removals:
+ self._commit_removals()
+ if self is other:
+ self.data.clear()
+ else:
+ self.data.symmetric_difference_update(ref(item, self._remove) for item in other)
+ return self
+
+ def union(self, other):
+ return self.__class__(e for s in (self, other) for e in s)
+ __or__ = union
+
+ def isdisjoint(self, other):
+ return len(self.intersection(other)) == 0
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
index 0000000000..0e1bfecc0a
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/abc.py
@@ -0,0 +1,185 @@
+# Copyright 2007 Google, Inc. All Rights Reserved.
+# Licensed to PSF under a Contributor Agreement.
+
+"""Abstract Base Classes (ABCs) according to PEP 3119."""
+
+import types
+
+from _weakrefset import WeakSet
+
+# Instance of old-style class
+class _C: pass
+_InstanceType = type(_C())
+
+
+def abstractmethod(funcobj):
+ """A decorator indicating abstract methods.
+
+ Requires that the metaclass is ABCMeta or derived from it. A
+ class that has a metaclass derived from ABCMeta cannot be
+ instantiated unless all of its abstract methods are overridden.
+ The abstract methods can be called using any of the normal
+ 'super' call mechanisms.
+
+ Usage:
+
+ class C:
+ __metaclass__ = ABCMeta
+ @abstractmethod
+ def my_abstract_method(self, ...):
+ ...
+ """
+ funcobj.__isabstractmethod__ = True
+ return funcobj
+
+
+class abstractproperty(property):
+ """A decorator indicating abstract properties.
+
+ Requires that the metaclass is ABCMeta or derived from it. A
+ class that has a metaclass derived from ABCMeta cannot be
+ instantiated unless all of its abstract properties are overridden.
+ The abstract properties can be called using any of the normal
+ 'super' call mechanisms.
+
+ Usage:
+
+ class C:
+ __metaclass__ = ABCMeta
+ @abstractproperty
+ def my_abstract_property(self):
+ ...
+
+ This defines a read-only property; you can also define a read-write
+ abstract property using the 'long' form of property declaration:
+
+ class C:
+ __metaclass__ = ABCMeta
+ def getx(self): ...
+ def setx(self, value): ...
+ x = abstractproperty(getx, setx)
+ """
+ __isabstractmethod__ = True
+
+
+class ABCMeta(type):
+
+ """Metaclass for defining Abstract Base Classes (ABCs).
+
+ Use this metaclass to create an ABC. An ABC can be subclassed
+ directly, and then acts as a mix-in class. You can also register
+ unrelated concrete classes (even built-in classes) and unrelated
+ ABCs as 'virtual subclasses' -- these and their descendants will
+ be considered subclasses of the registering ABC by the built-in
+ issubclass() function, but the registering ABC won't show up in
+ their MRO (Method Resolution Order) nor will method
+ implementations defined by the registering ABC be callable (not
+ even via super()).
+
+ """
+
+ # A global counter that is incremented each time a class is
+ # registered as a virtual subclass of anything. It forces the
+ # negative cache to be cleared before its next use.
+ _abc_invalidation_counter = 0
+
+ def __new__(mcls, name, bases, namespace):
+ cls = super(ABCMeta, mcls).__new__(mcls, name, bases, namespace)
+ # Compute set of abstract method names
+ abstracts = set(name
+ for name, value in namespace.items()
+ if getattr(value, "__isabstractmethod__", False))
+ for base in bases:
+ for name in getattr(base, "__abstractmethods__", set()):
+ value = getattr(cls, name, None)
+ if getattr(value, "__isabstractmethod__", False):
+ abstracts.add(name)
+ cls.__abstractmethods__ = frozenset(abstracts)
+ # Set up inheritance registry
+ cls._abc_registry = WeakSet()
+ cls._abc_cache = WeakSet()
+ cls._abc_negative_cache = WeakSet()
+ cls._abc_negative_cache_version = ABCMeta._abc_invalidation_counter
+ return cls
+
+ def register(cls, subclass):
+ """Register a virtual subclass of an ABC."""
+ if not isinstance(subclass, (type, types.ClassType)):
+ raise TypeError("Can only register classes")
+ if issubclass(subclass, cls):
+ return # Already a subclass
+ # Subtle: test for cycles *after* testing for "already a subclass";
+ # this means we allow X.register(X) and interpret it as a no-op.
+ if issubclass(cls, subclass):
+ # This would create a cycle, which is bad for the algorithm below
+ raise RuntimeError("Refusing to create an inheritance cycle")
+ cls._abc_registry.add(subclass)
+ ABCMeta._abc_invalidation_counter += 1 # Invalidate negative cache
+
+ def _dump_registry(cls, file=None):
+ """Debug helper to print the ABC registry."""
+ print >> file, "Class: %s.%s" % (cls.__module__, cls.__name__)
+ print >> file, "Inv.counter: %s" % ABCMeta._abc_invalidation_counter
+ for name in sorted(cls.__dict__.keys()):
+ if name.startswith("_abc_"):
+ value = getattr(cls, name)
+ print >> file, "%s: %r" % (name, value)
+
+ def __instancecheck__(cls, instance):
+ """Override for isinstance(instance, cls)."""
+ # Inline the cache checking when it's simple.
+ subclass = getattr(instance, '__class__', None)
+ if subclass is not None and subclass in cls._abc_cache:
+ return True
+ subtype = type(instance)
+ # Old-style instances
+ if subtype is _InstanceType:
+ subtype = subclass
+ if subtype is subclass or subclass is None:
+ if (cls._abc_negative_cache_version ==
+ ABCMeta._abc_invalidation_counter and
+ subtype in cls._abc_negative_cache):
+ return False
+ # Fall back to the subclass check.
+ return cls.__subclasscheck__(subtype)
+ return (cls.__subclasscheck__(subclass) or
+ cls.__subclasscheck__(subtype))
+
+ def __subclasscheck__(cls, subclass):
+ """Override for issubclass(subclass, cls)."""
+ # Check cache
+ if subclass in cls._abc_cache:
+ return True
+ # Check negative cache; may have to invalidate
+ if cls._abc_negative_cache_version < ABCMeta._abc_invalidation_counter:
+ # Invalidate the negative cache
+ cls._abc_negative_cache = WeakSet()
+ cls._abc_negative_cache_version = ABCMeta._abc_invalidation_counter
+ elif subclass in cls._abc_negative_cache:
+ return False
+ # Check the subclass hook
+ ok = cls.__subclasshook__(subclass)
+ if ok is not NotImplemented:
+ assert isinstance(ok, bool)
+ if ok:
+ cls._abc_cache.add(subclass)
+ else:
+ cls._abc_negative_cache.add(subclass)
+ return ok
+ # Check if it's a direct subclass
+ if cls in getattr(subclass, '__mro__', ()):
+ cls._abc_cache.add(subclass)
+ return True
+ # Check if it's a subclass of a registered class (recursive)
+ for rcls in cls._abc_registry:
+ if issubclass(subclass, rcls):
+ cls._abc_cache.add(subclass)
+ return True
+ # Check if it's a subclass of a subclass (recursive)
+ for scls in cls.__subclasses__():
+ if issubclass(subclass, scls):
+ cls._abc_cache.add(subclass)
+ return True
+ # No dice; update negative cache
+ cls._abc_negative_cache.add(subclass)
+ return False
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
index 0000000000..4d56aa782d
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/argparse.py
@@ -0,0 +1,2374 @@
+# Author: Steven J. Bethard <steven.bethard@gmail.com>.
+
+"""Command-line parsing library
+
+This module is an optparse-inspired command-line parsing library that:
+
+ - handles both optional and positional arguments
+ - produces highly informative usage messages
+ - supports parsers that dispatch to sub-parsers
+
+The following is a simple usage example that sums integers from the
+command-line and writes the result to a file::
+
+ parser = argparse.ArgumentParser(
+ description='sum the integers at the command line')
+ parser.add_argument(
+ 'integers', metavar='int', nargs='+', type=int,
+ help='an integer to be summed')
+ parser.add_argument(
+ '--log', default=sys.stdout, type=argparse.FileType('w'),
+ help='the file where the sum should be written')
+ args = parser.parse_args()
+ args.log.write('%s' % sum(args.integers))
+ args.log.close()
+
+The module contains the following public classes:
+
+ - ArgumentParser -- The main entry point for command-line parsing. As the
+ example above shows, the add_argument() method is used to populate
+ the parser with actions for optional and positional arguments. Then
+ the parse_args() method is invoked to convert the args at the
+ command-line into an object with attributes.
+
+ - ArgumentError -- The exception raised by ArgumentParser objects when
+ there are errors with the parser's actions. Errors raised while
+ parsing the command-line are caught by ArgumentParser and emitted
+ as command-line messages.
+
+ - FileType -- A factory for defining types of files to be created. As the
+ example above shows, instances of FileType are typically passed as
+ the type= argument of add_argument() calls.
+
+ - Action -- The base class for parser actions. Typically actions are
+ selected by passing strings like 'store_true' or 'append_const' to
+ the action= argument of add_argument(). However, for greater
+ customization of ArgumentParser actions, subclasses of Action may
+ be defined and passed as the action= argument.
+
+ - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter,
+ ArgumentDefaultsHelpFormatter -- Formatter classes which
+ may be passed as the formatter_class= argument to the
+ ArgumentParser constructor. HelpFormatter is the default,
+ RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser
+ not to change the formatting for help text, and
+ ArgumentDefaultsHelpFormatter adds information about argument defaults
+ to the help.
+
+All other classes in this module are considered implementation details.
+(Also note that HelpFormatter and RawDescriptionHelpFormatter are only
+considered public as object names -- the API of the formatter objects is
+still considered an implementation detail.)
+"""
+
+__version__ = '1.1'
+__all__ = [
+ 'ArgumentParser',
+ 'ArgumentError',
+ 'ArgumentTypeError',
+ 'FileType',
+ 'HelpFormatter',
+ 'ArgumentDefaultsHelpFormatter',
+ 'RawDescriptionHelpFormatter',
+ 'RawTextHelpFormatter',
+ 'Namespace',
+ 'Action',
+ 'ONE_OR_MORE',
+ 'OPTIONAL',
+ 'PARSER',
+ 'REMAINDER',
+ 'SUPPRESS',
+ 'ZERO_OR_MORE',
+]
+
+
+import collections as _collections
+import copy as _copy
+import os as _os
+import re as _re
+import sys as _sys
+import textwrap as _textwrap
+
+from gettext import gettext as _
+
+
+def _callable(obj):
+ return hasattr(obj, '__call__') or hasattr(obj, '__bases__')
+
+
+SUPPRESS = '==SUPPRESS=='
+
+OPTIONAL = '?'
+ZERO_OR_MORE = '*'
+ONE_OR_MORE = '+'
+PARSER = 'A...'
+REMAINDER = '...'
+_UNRECOGNIZED_ARGS_ATTR = '_unrecognized_args'
+
+# =============================
+# Utility functions and classes
+# =============================
+
+class _AttributeHolder(object):
+ """Abstract base class that provides __repr__.
+
+ The __repr__ method returns a string in the format::
+ ClassName(attr=name, attr=name, ...)
+ The attributes are determined either by a class-level attribute,
+ '_kwarg_names', or by inspecting the instance __dict__.
+ """
+
+ def __repr__(self):
+ type_name = type(self).__name__
+ arg_strings = []
+ for arg in self._get_args():
+ arg_strings.append(repr(arg))
+ for name, value in self._get_kwargs():
+ arg_strings.append('%s=%r' % (name, value))
+ return '%s(%s)' % (type_name, ', '.join(arg_strings))
+
+ def _get_kwargs(self):
+ return sorted(self.__dict__.items())
+
+ def _get_args(self):
+ return []
+
+
+def _ensure_value(namespace, name, value):
+ if getattr(namespace, name, None) is None:
+ setattr(namespace, name, value)
+ return getattr(namespace, name)
+
+
+# ===============
+# Formatting Help
+# ===============
+
+class HelpFormatter(object):
+ """Formatter for generating usage messages and argument help strings.
+
+ Only the name of this class is considered a public API. All the methods
+ provided by the class are considered an implementation detail.
+ """
+
+ def __init__(self,
+ prog,
+ indent_increment=2,
+ max_help_position=24,
+ width=None):
+
+ # default setting for width
+ if width is None:
+ try:
+ width = int(_os.environ['COLUMNS'])
+ except (KeyError, ValueError):
+ width = 80
+ width -= 2
+
+ self._prog = prog
+ self._indent_increment = indent_increment
+ self._max_help_position = max_help_position
+ self._max_help_position = min(max_help_position,
+ max(width - 20, indent_increment * 2))
+ self._width = width
+
+ self._current_indent = 0
+ self._level = 0
+ self._action_max_length = 0
+
+ self._root_section = self._Section(self, None)
+ self._current_section = self._root_section
+
+ self._whitespace_matcher = _re.compile(r'\s+')
+ self._long_break_matcher = _re.compile(r'\n\n\n+')
+
+ # ===============================
+ # Section and indentation methods
+ # ===============================
+ def _indent(self):
+ self._current_indent += self._indent_increment
+ self._level += 1
+
+ def _dedent(self):
+ self._current_indent -= self._indent_increment
+ assert self._current_indent >= 0, 'Indent decreased below 0.'
+ self._level -= 1
+
+ class _Section(object):
+
+ def __init__(self, formatter, parent, heading=None):
+ self.formatter = formatter
+ self.parent = parent
+ self.heading = heading
+ self.items = []
+
+ def format_help(self):
+ # format the indented section
+ if self.parent is not None:
+ self.formatter._indent()
+ join = self.formatter._join_parts
+ for func, args in self.items:
+ func(*args)
+ item_help = join([func(*args) for func, args in self.items])
+ if self.parent is not None:
+ self.formatter._dedent()
+
+ # return nothing if the section was empty
+ if not item_help:
+ return ''
+
+ # add the heading if the section was non-empty
+ if self.heading is not SUPPRESS and self.heading is not None:
+ current_indent = self.formatter._current_indent
+ heading = '%*s%s:\n' % (current_indent, '', self.heading)
+ else:
+ heading = ''
+
+ # join the section-initial newline, the heading and the help
+ return join(['\n', heading, item_help, '\n'])
+
+ def _add_item(self, func, args):
+ self._current_section.items.append((func, args))
+
+ # ========================
+ # Message building methods
+ # ========================
+ def start_section(self, heading):
+ self._indent()
+ section = self._Section(self, self._current_section, heading)
+ self._add_item(section.format_help, [])
+ self._current_section = section
+
+ def end_section(self):
+ self._current_section = self._current_section.parent
+ self._dedent()
+
+ def add_text(self, text):
+ if text is not SUPPRESS and text is not None:
+ self._add_item(self._format_text, [text])
+
+ def add_usage(self, usage, actions, groups, prefix=None):
+ if usage is not SUPPRESS:
+ args = usage, actions, groups, prefix
+ self._add_item(self._format_usage, args)
+
+ def add_argument(self, action):
+ if action.help is not SUPPRESS:
+
+ # find all invocations
+ get_invocation = self._format_action_invocation
+ invocations = [get_invocation(action)]
+ for subaction in self._iter_indented_subactions(action):
+ invocations.append(get_invocation(subaction))
+
+ # update the maximum item length
+ invocation_length = max([len(s) for s in invocations])
+ action_length = invocation_length + self._current_indent
+ self._action_max_length = max(self._action_max_length,
+ action_length)
+
+ # add the item to the list
+ self._add_item(self._format_action, [action])
+
+ def add_arguments(self, actions):
+ for action in actions:
+ self.add_argument(action)
+
+ # =======================
+ # Help-formatting methods
+ # =======================
+ def format_help(self):
+ help = self._root_section.format_help()
+ if help:
+ help = self._long_break_matcher.sub('\n\n', help)
+ help = help.strip('\n') + '\n'
+ return help
+
+ def _join_parts(self, part_strings):
+ return ''.join([part
+ for part in part_strings
+ if part and part is not SUPPRESS])
+
+ def _format_usage(self, usage, actions, groups, prefix):
+ if prefix is None:
+ prefix = _('usage: ')
+
+ # if usage is specified, use that
+ if usage is not None:
+ usage = usage % dict(prog=self._prog)
+
+ # if no optionals or positionals are available, usage is just prog
+ elif usage is None and not actions:
+ usage = '%(prog)s' % dict(prog=self._prog)
+
+ # if optionals and positionals are available, calculate usage
+ elif usage is None:
+ prog = '%(prog)s' % dict(prog=self._prog)
+
+ # split optionals from positionals
+ optionals = []
+ positionals = []
+ for action in actions:
+ if action.option_strings:
+ optionals.append(action)
+ else:
+ positionals.append(action)
+
+ # build full usage string
+ format = self._format_actions_usage
+ action_usage = format(optionals + positionals, groups)
+ usage = ' '.join([s for s in [prog, action_usage] if s])
+
+ # wrap the usage parts if it's too long
+ text_width = self._width - self._current_indent
+ if len(prefix) + len(usage) > text_width:
+
+ # break usage into wrappable parts
+ part_regexp = r'\(.*?\)+|\[.*?\]+|\S+'
+ opt_usage = format(optionals, groups)
+ pos_usage = format(positionals, groups)
+ opt_parts = _re.findall(part_regexp, opt_usage)
+ pos_parts = _re.findall(part_regexp, pos_usage)
+ assert ' '.join(opt_parts) == opt_usage
+ assert ' '.join(pos_parts) == pos_usage
+
+ # helper for wrapping lines
+ def get_lines(parts, indent, prefix=None):
+ lines = []
+ line = []
+ if prefix is not None:
+ line_len = len(prefix) - 1
+ else:
+ line_len = len(indent) - 1
+ for part in parts:
+ if line_len + 1 + len(part) > text_width and line:
+ lines.append(indent + ' '.join(line))
+ line = []
+ line_len = len(indent) - 1
+ line.append(part)
+ line_len += len(part) + 1
+ if line:
+ lines.append(indent + ' '.join(line))
+ if prefix is not None:
+ lines[0] = lines[0][len(indent):]
+ return lines
+
+ # if prog is short, follow it with optionals or positionals
+ if len(prefix) + len(prog) <= 0.75 * text_width:
+ indent = ' ' * (len(prefix) + len(prog) + 1)
+ if opt_parts:
+ lines = get_lines([prog] + opt_parts, indent, prefix)
+ lines.extend(get_lines(pos_parts, indent))
+ elif pos_parts:
+ lines = get_lines([prog] + pos_parts, indent, prefix)
+ else:
+ lines = [prog]
+
+ # if prog is long, put it on its own line
+ else:
+ indent = ' ' * len(prefix)
+ parts = opt_parts + pos_parts
+ lines = get_lines(parts, indent)
+ if len(lines) > 1:
+ lines = []
+ lines.extend(get_lines(opt_parts, indent))
+ lines.extend(get_lines(pos_parts, indent))
+ lines = [prog] + lines
+
+ # join lines into usage
+ usage = '\n'.join(lines)
+
+ # prefix with 'usage:'
+ return '%s%s\n\n' % (prefix, usage)
+
+ def _format_actions_usage(self, actions, groups):
+ # find group indices and identify actions in groups
+ group_actions = set()
+ inserts = {}
+ for group in groups:
+ try:
+ start = actions.index(group._group_actions[0])
+ except ValueError:
+ continue
+ else:
+ end = start + len(group._group_actions)
+ if actions[start:end] == group._group_actions:
+ for action in group._group_actions:
+ group_actions.add(action)
+ if not group.required:
+ if start in inserts:
+ inserts[start] += ' ['
+ else:
+ inserts[start] = '['
+ inserts[end] = ']'
+ else:
+ if start in inserts:
+ inserts[start] += ' ('
+ else:
+ inserts[start] = '('
+ inserts[end] = ')'
+ for i in range(start + 1, end):
+ inserts[i] = '|'
+
+ # collect all actions format strings
+ parts = []
+ for i, action in enumerate(actions):
+
+ # suppressed arguments are marked with None
+ # remove | separators for suppressed arguments
+ if action.help is SUPPRESS:
+ parts.append(None)
+ if inserts.get(i) == '|':
+ inserts.pop(i)
+ elif inserts.get(i + 1) == '|':
+ inserts.pop(i + 1)
+
+ # produce all arg strings
+ elif not action.option_strings:
+ part = self._format_args(action, action.dest)
+
+ # if it's in a group, strip the outer []
+ if action in group_actions:
+ if part[0] == '[' and part[-1] == ']':
+ part = part[1:-1]
+
+ # add the action string to the list
+ parts.append(part)
+
+ # produce the first way to invoke the option in brackets
+ else:
+ option_string = action.option_strings[0]
+
+ # if the Optional doesn't take a value, format is:
+ # -s or --long
+ if action.nargs == 0:
+ part = '%s' % option_string
+
+ # if the Optional takes a value, format is:
+ # -s ARGS or --long ARGS
+ else:
+ default = action.dest.upper()
+ args_string = self._format_args(action, default)
+ part = '%s %s' % (option_string, args_string)
+
+ # make it look optional if it's not required or in a group
+ if not action.required and action not in group_actions:
+ part = '[%s]' % part
+
+ # add the action string to the list
+ parts.append(part)
+
+ # insert things at the necessary indices
+ for i in sorted(inserts, reverse=True):
+ parts[i:i] = [inserts[i]]
+
+ # join all the action items with spaces
+ text = ' '.join([item for item in parts if item is not None])
+
+ # clean up separators for mutually exclusive groups
+ open = r'[\[(]'
+ close = r'[\])]'
+ text = _re.sub(r'(%s) ' % open, r'\1', text)
+ text = _re.sub(r' (%s)' % close, r'\1', text)
+ text = _re.sub(r'%s *%s' % (open, close), r'', text)
+ text = _re.sub(r'\(([^|]*)\)', r'\1', text)
+ text = text.strip()
+
+ # return the text
+ return text
+
+ def _format_text(self, text):
+ if '%(prog)' in text:
+ text = text % dict(prog=self._prog)
+ text_width = max(self._width - self._current_indent, 11)
+ indent = ' ' * self._current_indent
+ return self._fill_text(text, text_width, indent) + '\n\n'
+
+ def _format_action(self, action):
+ # determine the required width and the entry label
+ help_position = min(self._action_max_length + 2,
+ self._max_help_position)
+ help_width = max(self._width - help_position, 11)
+ action_width = help_position - self._current_indent - 2
+ action_header = self._format_action_invocation(action)
+
+ # ho nelp; start on same line and add a final newline
+ if not action.help:
+ tup = self._current_indent, '', action_header
+ action_header = '%*s%s\n' % tup
+
+ # short action name; start on the same line and pad two spaces
+ elif len(action_header) <= action_width:
+ tup = self._current_indent, '', action_width, action_header
+ action_header = '%*s%-*s ' % tup
+ indent_first = 0
+
+ # long action name; start on the next line
+ else:
+ tup = self._current_indent, '', action_header
+ action_header = '%*s%s\n' % tup
+ indent_first = help_position
+
+ # collect the pieces of the action help
+ parts = [action_header]
+
+ # if there was help for the action, add lines of help text
+ if action.help:
+ help_text = self._expand_help(action)
+ help_lines = self._split_lines(help_text, help_width)
+ parts.append('%*s%s\n' % (indent_first, '', help_lines[0]))
+ for line in help_lines[1:]:
+ parts.append('%*s%s\n' % (help_position, '', line))
+
+ # or add a newline if the description doesn't end with one
+ elif not action_header.endswith('\n'):
+ parts.append('\n')
+
+ # if there are any sub-actions, add their help as well
+ for subaction in self._iter_indented_subactions(action):
+ parts.append(self._format_action(subaction))
+
+ # return a single string
+ return self._join_parts(parts)
+
+ def _format_action_invocation(self, action):
+ if not action.option_strings:
+ metavar, = self._metavar_formatter(action, action.dest)(1)
+ return metavar
+
+ else:
+ parts = []
+
+ # if the Optional doesn't take a value, format is:
+ # -s, --long
+ if action.nargs == 0:
+ parts.extend(action.option_strings)
+
+ # if the Optional takes a value, format is:
+ # -s ARGS, --long ARGS
+ else:
+ default = action.dest.upper()
+ args_string = self._format_args(action, default)
+ for option_string in action.option_strings:
+ parts.append('%s %s' % (option_string, args_string))
+
+ return ', '.join(parts)
+
+ def _metavar_formatter(self, action, default_metavar):
+ if action.metavar is not None:
+ result = action.metavar
+ elif action.choices is not None:
+ choice_strs = [str(choice) for choice in action.choices]
+ result = '{%s}' % ','.join(choice_strs)
+ else:
+ result = default_metavar
+
+ def format(tuple_size):
+ if isinstance(result, tuple):
+ return result
+ else:
+ return (result, ) * tuple_size
+ return format
+
+ def _format_args(self, action, default_metavar):
+ get_metavar = self._metavar_formatter(action, default_metavar)
+ if action.nargs is None:
+ result = '%s' % get_metavar(1)
+ elif action.nargs == OPTIONAL:
+ result = '[%s]' % get_metavar(1)
+ elif action.nargs == ZERO_OR_MORE:
+ result = '[%s [%s ...]]' % get_metavar(2)
+ elif action.nargs == ONE_OR_MORE:
+ result = '%s [%s ...]' % get_metavar(2)
+ elif action.nargs == REMAINDER:
+ result = '...'
+ elif action.nargs == PARSER:
+ result = '%s ...' % get_metavar(1)
+ else:
+ formats = ['%s' for _ in range(action.nargs)]
+ result = ' '.join(formats) % get_metavar(action.nargs)
+ return result
+
+ def _expand_help(self, action):
+ params = dict(vars(action), prog=self._prog)
+ for name in list(params):
+ if params[name] is SUPPRESS:
+ del params[name]
+ for name in list(params):
+ if hasattr(params[name], '__name__'):
+ params[name] = params[name].__name__
+ if params.get('choices') is not None:
+ choices_str = ', '.join([str(c) for c in params['choices']])
+ params['choices'] = choices_str
+ return self._get_help_string(action) % params
+
+ def _iter_indented_subactions(self, action):
+ try:
+ get_subactions = action._get_subactions
+ except AttributeError:
+ pass
+ else:
+ self._indent()
+ for subaction in get_subactions():
+ yield subaction
+ self._dedent()
+
+ def _split_lines(self, text, width):
+ text = self._whitespace_matcher.sub(' ', text).strip()
+ return _textwrap.wrap(text, width)
+
+ def _fill_text(self, text, width, indent):
+ text = self._whitespace_matcher.sub(' ', text).strip()
+ return _textwrap.fill(text, width, initial_indent=indent,
+ subsequent_indent=indent)
+
+ def _get_help_string(self, action):
+ return action.help
+
+
+class RawDescriptionHelpFormatter(HelpFormatter):
+ """Help message formatter which retains any formatting in descriptions.
+
+ Only the name of this class is considered a public API. All the methods
+ provided by the class are considered an implementation detail.
+ """
+
+ def _fill_text(self, text, width, indent):
+ return ''.join([indent + line for line in text.splitlines(True)])
+
+
+class RawTextHelpFormatter(RawDescriptionHelpFormatter):
+ """Help message formatter which retains formatting of all help text.
+
+ Only the name of this class is considered a public API. All the methods
+ provided by the class are considered an implementation detail.
+ """
+
+ def _split_lines(self, text, width):
+ return text.splitlines()
+
+
+class ArgumentDefaultsHelpFormatter(HelpFormatter):
+ """Help message formatter which adds default values to argument help.
+
+ Only the name of this class is considered a public API. All the methods
+ provided by the class are considered an implementation detail.
+ """
+
+ def _get_help_string(self, action):
+ help = action.help
+ if '%(default)' not in action.help:
+ if action.default is not SUPPRESS:
+ defaulting_nargs = [OPTIONAL, ZERO_OR_MORE]
+ if action.option_strings or action.nargs in defaulting_nargs:
+ help += ' (default: %(default)s)'
+ return help
+
+
+# =====================
+# Options and Arguments
+# =====================
+
+def _get_action_name(argument):
+ if argument is None:
+ return None
+ elif argument.option_strings:
+ return '/'.join(argument.option_strings)
+ elif argument.metavar not in (None, SUPPRESS):
+ return argument.metavar
+ elif argument.dest not in (None, SUPPRESS):
+ return argument.dest
+ else:
+ return None
+
+
+class ArgumentError(Exception):
+ """An error from creating or using an argument (optional or positional).
+
+ The string value of this exception is the message, augmented with
+ information about the argument that caused it.
+ """
+
+ def __init__(self, argument, message):
+ self.argument_name = _get_action_name(argument)
+ self.message = message
+
+ def __str__(self):
+ if self.argument_name is None:
+ format = '%(message)s'
+ else:
+ format = 'argument %(argument_name)s: %(message)s'
+ return format % dict(message=self.message,
+ argument_name=self.argument_name)
+
+
+class ArgumentTypeError(Exception):
+ """An error from trying to convert a command line string to a type."""
+ pass
+
+
+# ==============
+# Action classes
+# ==============
+
+class Action(_AttributeHolder):
+ """Information about how to convert command line strings to Python objects.
+
+ Action objects are used by an ArgumentParser to represent the information
+ needed to parse a single argument from one or more strings from the
+ command line. The keyword arguments to the Action constructor are also
+ all attributes of Action instances.
+
+ Keyword Arguments:
+
+ - option_strings -- A list of command-line option strings which
+ should be associated with this action.
+
+ - dest -- The name of the attribute to hold the created object(s)
+
+ - nargs -- The number of command-line arguments that should be
+ consumed. By default, one argument will be consumed and a single
+ value will be produced. Other values include:
+ - N (an integer) consumes N arguments (and produces a list)
+ - '?' consumes zero or one arguments
+ - '*' consumes zero or more arguments (and produces a list)
+ - '+' consumes one or more arguments (and produces a list)
+ Note that the difference between the default and nargs=1 is that
+ with the default, a single value will be produced, while with
+ nargs=1, a list containing a single value will be produced.
+
+ - const -- The value to be produced if the option is specified and the
+ option uses an action that takes no values.
+
+ - default -- The value to be produced if the option is not specified.
+
+ - type -- A callable that accepts a single string argument, and
+ returns the converted value. The standard Python types str, int,
+ float, and complex are useful examples of such callables. If None,
+ str is used.
+
+ - choices -- A container of values that should be allowed. If not None,
+ after a command-line argument has been converted to the appropriate
+ type, an exception will be raised if it is not a member of this
+ collection.
+
+ - required -- True if the action must always be specified at the
+ command line. This is only meaningful for optional command-line
+ arguments.
+
+ - help -- The help string describing the argument.
+
+ - metavar -- The name to be used for the option's argument with the
+ help string. If None, the 'dest' value will be used as the name.
+ """
+
+ def __init__(self,
+ option_strings,
+ dest,
+ nargs=None,
+ const=None,
+ default=None,
+ type=None,
+ choices=None,
+ required=False,
+ help=None,
+ metavar=None):
+ self.option_strings = option_strings
+ self.dest = dest
+ self.nargs = nargs
+ self.const = const
+ self.default = default
+ self.type = type
+ self.choices = choices
+ self.required = required
+ self.help = help
+ self.metavar = metavar
+
+ def _get_kwargs(self):
+ names = [
+ 'option_strings',
+ 'dest',
+ 'nargs',
+ 'const',
+ 'default',
+ 'type',
+ 'choices',
+ 'help',
+ 'metavar',
+ ]
+ return [(name, getattr(self, name)) for name in names]
+
+ def __call__(self, parser, namespace, values, option_string=None):
+ raise NotImplementedError(_('.__call__() not defined'))
+
+
+class _StoreAction(Action):
+
+ def __init__(self,
+ option_strings,
+ dest,
+ nargs=None,
+ const=None,
+ default=None,
+ type=None,
+ choices=None,
+ required=False,
+ help=None,
+ metavar=None):
+ if nargs == 0:
+ raise ValueError('nargs for store actions must be > 0; if you '
+ 'have nothing to store, actions such as store '
+ 'true or store const may be more appropriate')
+ if const is not None and nargs != OPTIONAL:
+ raise ValueError('nargs must be %r to supply const' % OPTIONAL)
+ super(_StoreAction, self).__init__(
+ option_strings=option_strings,
+ dest=dest,
+ nargs=nargs,
+ const=const,
+ default=default,
+ type=type,
+ choices=choices,
+ required=required,
+ help=help,
+ metavar=metavar)
+
+ def __call__(self, parser, namespace, values, option_string=None):
+ setattr(namespace, self.dest, values)
+
+
+class _StoreConstAction(Action):
+
+ def __init__(self,
+ option_strings,
+ dest,
+ const,
+ default=None,
+ required=False,
+ help=None,
+ metavar=None):
+ super(_StoreConstAction, self).__init__(
+ option_strings=option_strings,
+ dest=dest,
+ nargs=0,
+ const=const,
+ default=default,
+ required=required,
+ help=help)
+
+ def __call__(self, parser, namespace, values, option_string=None):
+ setattr(namespace, self.dest, self.const)
+
+
+class _StoreTrueAction(_StoreConstAction):
+
+ def __init__(self,
+ option_strings,
+ dest,
+ default=False,
+ required=False,
+ help=None):
+ super(_StoreTrueAction, self).__init__(
+ option_strings=option_strings,
+ dest=dest,
+ const=True,
+ default=default,
+ required=required,
+ help=help)
+
+
+class _StoreFalseAction(_StoreConstAction):
+
+ def __init__(self,
+ option_strings,
+ dest,
+ default=True,
+ required=False,
+ help=None):
+ super(_StoreFalseAction, self).__init__(
+ option_strings=option_strings,
+ dest=dest,
+ const=False,
+ default=default,
+ required=required,
+ help=help)
+
+
+class _AppendAction(Action):
+
+ def __init__(self,
+ option_strings,
+ dest,
+ nargs=None,
+ const=None,
+ default=None,
+ type=None,
+ choices=None,
+ required=False,
+ help=None,
+ metavar=None):
+ if nargs == 0:
+ raise ValueError('nargs for append actions must be > 0; if arg '
+ 'strings are not supplying the value to append, '
+ 'the append const action may be more appropriate')
+ if const is not None and nargs != OPTIONAL:
+ raise ValueError('nargs must be %r to supply const' % OPTIONAL)
+ super(_AppendAction, self).__init__(
+ option_strings=option_strings,
+ dest=dest,
+ nargs=nargs,
+ const=const,
+ default=default,
+ type=type,
+ choices=choices,
+ required=required,
+ help=help,
+ metavar=metavar)
+
+ def __call__(self, parser, namespace, values, option_string=None):
+ items = _copy.copy(_ensure_value(namespace, self.dest, []))
+ items.append(values)
+ setattr(namespace, self.dest, items)
+
+
+class _AppendConstAction(Action):
+
+ def __init__(self,
+ option_strings,
+ dest,
+ const,
+ default=None,
+ required=False,
+ help=None,
+ metavar=None):
+ super(_AppendConstAction, self).__init__(
+ option_strings=option_strings,
+ dest=dest,
+ nargs=0,
+ const=const,
+ default=default,
+ required=required,
+ help=help,
+ metavar=metavar)
+
+ def __call__(self, parser, namespace, values, option_string=None):
+ items = _copy.copy(_ensure_value(namespace, self.dest, []))
+ items.append(self.const)
+ setattr(namespace, self.dest, items)
+
+
+class _CountAction(Action):
+
+ def __init__(self,
+ option_strings,
+ dest,
+ default=None,
+ required=False,
+ help=None):
+ super(_CountAction, self).__init__(
+ option_strings=option_strings,
+ dest=dest,
+ nargs=0,
+ default=default,
+ required=required,
+ help=help)
+
+ def __call__(self, parser, namespace, values, option_string=None):
+ new_count = _ensure_value(namespace, self.dest, 0) + 1
+ setattr(namespace, self.dest, new_count)
+
+
+class _HelpAction(Action):
+
+ def __init__(self,
+ option_strings,
+ dest=SUPPRESS,
+ default=SUPPRESS,
+ help=None):
+ super(_HelpAction, self).__init__(
+ option_strings=option_strings,
+ dest=dest,
+ default=default,
+ nargs=0,
+ help=help)
+
+ def __call__(self, parser, namespace, values, option_string=None):
+ parser.print_help()
+ parser.exit()
+
+
+class _VersionAction(Action):
+
+ def __init__(self,
+ option_strings,
+ version=None,
+ dest=SUPPRESS,
+ default=SUPPRESS,
+ help="show program's version number and exit"):
+ super(_VersionAction, self).__init__(
+ option_strings=option_strings,
+ dest=dest,
+ default=default,
+ nargs=0,
+ help=help)
+ self.version = version
+
+ def __call__(self, parser, namespace, values, option_string=None):
+ version = self.version
+ if version is None:
+ version = parser.version
+ formatter = parser._get_formatter()
+ formatter.add_text(version)
+ parser.exit(message=formatter.format_help())
+
+
+class _SubParsersAction(Action):
+
+ class _ChoicesPseudoAction(Action):
+
+ def __init__(self, name, help):
+ sup = super(_SubParsersAction._ChoicesPseudoAction, self)
+ sup.__init__(option_strings=[], dest=name, help=help)
+
+ def __init__(self,
+ option_strings,
+ prog,
+ parser_class,
+ dest=SUPPRESS,
+ help=None,
+ metavar=None):
+
+ self._prog_prefix = prog
+ self._parser_class = parser_class
+ self._name_parser_map = _collections.OrderedDict()
+ self._choices_actions = []
+
+ super(_SubParsersAction, self).__init__(
+ option_strings=option_strings,
+ dest=dest,
+ nargs=PARSER,
+ choices=self._name_parser_map,
+ help=help,
+ metavar=metavar)
+
+ def add_parser(self, name, **kwargs):
+ # set prog from the existing prefix
+ if kwargs.get('prog') is None:
+ kwargs['prog'] = '%s %s' % (self._prog_prefix, name)
+
+ # create a pseudo-action to hold the choice help
+ if 'help' in kwargs:
+ help = kwargs.pop('help')
+ choice_action = self._ChoicesPseudoAction(name, help)
+ self._choices_actions.append(choice_action)
+
+ # create the parser and add it to the map
+ parser = self._parser_class(**kwargs)
+ self._name_parser_map[name] = parser
+ return parser
+
+ def _get_subactions(self):
+ return self._choices_actions
+
+ def __call__(self, parser, namespace, values, option_string=None):
+ parser_name = values[0]
+ arg_strings = values[1:]
+
+ # set the parser name if requested
+ if self.dest is not SUPPRESS:
+ setattr(namespace, self.dest, parser_name)
+
+ # select the parser
+ try:
+ parser = self._name_parser_map[parser_name]
+ except KeyError:
+ tup = parser_name, ', '.join(self._name_parser_map)
+ msg = _('unknown parser %r (choices: %s)') % tup
+ raise ArgumentError(self, msg)
+
+ # parse all the remaining options into the namespace
+ # store any unrecognized options on the object, so that the top
+ # level parser can decide what to do with them
+
+ # In case this subparser defines new defaults, we parse them
+ # in a new namespace object and then update the original
+ # namespace for the relevant parts.
+ subnamespace, arg_strings = parser.parse_known_args(arg_strings, None)
+ for key, value in vars(subnamespace).items():
+ setattr(namespace, key, value)
+
+ if arg_strings:
+ vars(namespace).setdefault(_UNRECOGNIZED_ARGS_ATTR, [])
+ getattr(namespace, _UNRECOGNIZED_ARGS_ATTR).extend(arg_strings)
+
+
+# ==============
+# Type classes
+# ==============
+
+class FileType(object):
+ """Factory for creating file object types
+
+ Instances of FileType are typically passed as type= arguments to the
+ ArgumentParser add_argument() method.
+
+ Keyword Arguments:
+ - mode -- A string indicating how the file is to be opened. Accepts the
+ same values as the builtin open() function.
+ - bufsize -- The file's desired buffer size. Accepts the same values as
+ the builtin open() function.
+ """
+
+ def __init__(self, mode='r', bufsize=-1):
+ self._mode = mode
+ self._bufsize = bufsize
+
+ def __call__(self, string):
+ # the special argument "-" means sys.std{in,out}
+ if string == '-':
+ if 'r' in self._mode:
+ return _sys.stdin
+ elif 'w' in self._mode:
+ return _sys.stdout
+ else:
+ msg = _('argument "-" with mode %r') % self._mode
+ raise ValueError(msg)
+
+ # all other arguments are used as file names
+ try:
+ return open(string, self._mode, self._bufsize)
+ except IOError as e:
+ message = _("can't open '%s': %s")
+ raise ArgumentTypeError(message % (string, e))
+
+ def __repr__(self):
+ args = self._mode, self._bufsize
+ args_str = ', '.join(repr(arg) for arg in args if arg != -1)
+ return '%s(%s)' % (type(self).__name__, args_str)
+
+# ===========================
+# Optional and Positional Parsing
+# ===========================
+
+class Namespace(_AttributeHolder):
+ """Simple object for storing attributes.
+
+ Implements equality by attribute names and values, and provides a simple
+ string representation.
+ """
+
+ def __init__(self, **kwargs):
+ for name in kwargs:
+ setattr(self, name, kwargs[name])
+
+ __hash__ = None
+
+ def __eq__(self, other):
+ if not isinstance(other, Namespace):
+ return NotImplemented
+ return vars(self) == vars(other)
+
+ def __ne__(self, other):
+ if not isinstance(other, Namespace):
+ return NotImplemented
+ return not (self == other)
+
+ def __contains__(self, key):
+ return key in self.__dict__
+
+
+class _ActionsContainer(object):
+
+ def __init__(self,
+ description,
+ prefix_chars,
+ argument_default,
+ conflict_handler):
+ super(_ActionsContainer, self).__init__()
+
+ self.description = description
+ self.argument_default = argument_default
+ self.prefix_chars = prefix_chars
+ self.conflict_handler = conflict_handler
+
+ # set up registries
+ self._registries = {}
+
+ # register actions
+ self.register('action', None, _StoreAction)
+ self.register('action', 'store', _StoreAction)
+ self.register('action', 'store_const', _StoreConstAction)
+ self.register('action', 'store_true', _StoreTrueAction)
+ self.register('action', 'store_false', _StoreFalseAction)
+ self.register('action', 'append', _AppendAction)
+ self.register('action', 'append_const', _AppendConstAction)
+ self.register('action', 'count', _CountAction)
+ self.register('action', 'help', _HelpAction)
+ self.register('action', 'version', _VersionAction)
+ self.register('action', 'parsers', _SubParsersAction)
+
+ # raise an exception if the conflict handler is invalid
+ self._get_handler()
+
+ # action storage
+ self._actions = []
+ self._option_string_actions = {}
+
+ # groups
+ self._action_groups = []
+ self._mutually_exclusive_groups = []
+
+ # defaults storage
+ self._defaults = {}
+
+ # determines whether an "option" looks like a negative number
+ self._negative_number_matcher = _re.compile(r'^-\d+$|^-\d*\.\d+$')
+
+ # whether or not there are any optionals that look like negative
+ # numbers -- uses a list so it can be shared and edited
+ self._has_negative_number_optionals = []
+
+ # ====================
+ # Registration methods
+ # ====================
+ def register(self, registry_name, value, object):
+ registry = self._registries.setdefault(registry_name, {})
+ registry[value] = object
+
+ def _registry_get(self, registry_name, value, default=None):
+ return self._registries[registry_name].get(value, default)
+
+ # ==================================
+ # Namespace default accessor methods
+ # ==================================
+ def set_defaults(self, **kwargs):
+ self._defaults.update(kwargs)
+
+ # if these defaults match any existing arguments, replace
+ # the previous default on the object with the new one
+ for action in self._actions:
+ if action.dest in kwargs:
+ action.default = kwargs[action.dest]
+
+ def get_default(self, dest):
+ for action in self._actions:
+ if action.dest == dest and action.default is not None:
+ return action.default
+ return self._defaults.get(dest, None)
+
+
+ # =======================
+ # Adding argument actions
+ # =======================
+ def add_argument(self, *args, **kwargs):
+ """
+ add_argument(dest, ..., name=value, ...)
+ add_argument(option_string, option_string, ..., name=value, ...)
+ """
+
+ # if no positional args are supplied or only one is supplied and
+ # it doesn't look like an option string, parse a positional
+ # argument
+ chars = self.prefix_chars
+ if not args or len(args) == 1 and args[0][0] not in chars:
+ if args and 'dest' in kwargs:
+ raise ValueError('dest supplied twice for positional argument')
+ kwargs = self._get_positional_kwargs(*args, **kwargs)
+
+ # otherwise, we're adding an optional argument
+ else:
+ kwargs = self._get_optional_kwargs(*args, **kwargs)
+
+ # if no default was supplied, use the parser-level default
+ if 'default' not in kwargs:
+ dest = kwargs['dest']
+ if dest in self._defaults:
+ kwargs['default'] = self._defaults[dest]
+ elif self.argument_default is not None:
+ kwargs['default'] = self.argument_default
+
+ # create the action object, and add it to the parser
+ action_class = self._pop_action_class(kwargs)
+ if not _callable(action_class):
+ raise ValueError('unknown action "%s"' % (action_class,))
+ action = action_class(**kwargs)
+
+ # raise an error if the action type is not callable
+ type_func = self._registry_get('type', action.type, action.type)
+ if not _callable(type_func):
+ raise ValueError('%r is not callable' % (type_func,))
+
+ # raise an error if the metavar does not match the type
+ if hasattr(self, "_get_formatter"):
+ try:
+ self._get_formatter()._format_args(action, None)
+ except TypeError:
+ raise ValueError("length of metavar tuple does not match nargs")
+
+ return self._add_action(action)
+
+ def add_argument_group(self, *args, **kwargs):
+ group = _ArgumentGroup(self, *args, **kwargs)
+ self._action_groups.append(group)
+ return group
+
+ def add_mutually_exclusive_group(self, **kwargs):
+ group = _MutuallyExclusiveGroup(self, **kwargs)
+ self._mutually_exclusive_groups.append(group)
+ return group
+
+ def _add_action(self, action):
+ # resolve any conflicts
+ self._check_conflict(action)
+
+ # add to actions list
+ self._actions.append(action)
+ action.container = self
+
+ # index the action by any option strings it has
+ for option_string in action.option_strings:
+ self._option_string_actions[option_string] = action
+
+ # set the flag if any option strings look like negative numbers
+ for option_string in action.option_strings:
+ if self._negative_number_matcher.match(option_string):
+ if not self._has_negative_number_optionals:
+ self._has_negative_number_optionals.append(True)
+
+ # return the created action
+ return action
+
+ def _remove_action(self, action):
+ self._actions.remove(action)
+
+ def _add_container_actions(self, container):
+ # collect groups by titles
+ title_group_map = {}
+ for group in self._action_groups:
+ if group.title in title_group_map:
+ msg = _('cannot merge actions - two groups are named %r')
+ raise ValueError(msg % (group.title))
+ title_group_map[group.title] = group
+
+ # map each action to its group
+ group_map = {}
+ for group in container._action_groups:
+
+ # if a group with the title exists, use that, otherwise
+ # create a new group matching the container's group
+ if group.title not in title_group_map:
+ title_group_map[group.title] = self.add_argument_group(
+ title=group.title,
+ description=group.description,
+ conflict_handler=group.conflict_handler)
+
+ # map the actions to their new group
+ for action in group._group_actions:
+ group_map[action] = title_group_map[group.title]
+
+ # add container's mutually exclusive groups
+ # NOTE: if add_mutually_exclusive_group ever gains title= and
+ # description= then this code will need to be expanded as above
+ for group in container._mutually_exclusive_groups:
+ mutex_group = self.add_mutually_exclusive_group(
+ required=group.required)
+
+ # map the actions to their new mutex group
+ for action in group._group_actions:
+ group_map[action] = mutex_group
+
+ # add all actions to this container or their group
+ for action in container._actions:
+ group_map.get(action, self)._add_action(action)
+
+ def _get_positional_kwargs(self, dest, **kwargs):
+ # make sure required is not specified
+ if 'required' in kwargs:
+ msg = _("'required' is an invalid argument for positionals")
+ raise TypeError(msg)
+
+ # mark positional arguments as required if at least one is
+ # always required
+ if kwargs.get('nargs') not in [OPTIONAL, ZERO_OR_MORE]:
+ kwargs['required'] = True
+ if kwargs.get('nargs') == ZERO_OR_MORE and 'default' not in kwargs:
+ kwargs['required'] = True
+
+ # return the keyword arguments with no option strings
+ return dict(kwargs, dest=dest, option_strings=[])
+
+ def _get_optional_kwargs(self, *args, **kwargs):
+ # determine short and long option strings
+ option_strings = []
+ long_option_strings = []
+ for option_string in args:
+ # error on strings that don't start with an appropriate prefix
+ if not option_string[0] in self.prefix_chars:
+ msg = _('invalid option string %r: '
+ 'must start with a character %r')
+ tup = option_string, self.prefix_chars
+ raise ValueError(msg % tup)
+
+ # strings starting with two prefix characters are long options
+ option_strings.append(option_string)
+ if option_string[0] in self.prefix_chars:
+ if len(option_string) > 1:
+ if option_string[1] in self.prefix_chars:
+ long_option_strings.append(option_string)
+
+ # infer destination, '--foo-bar' -> 'foo_bar' and '-x' -> 'x'
+ dest = kwargs.pop('dest', None)
+ if dest is None:
+ if long_option_strings:
+ dest_option_string = long_option_strings[0]
+ else:
+ dest_option_string = option_strings[0]
+ dest = dest_option_string.lstrip(self.prefix_chars)
+ if not dest:
+ msg = _('dest= is required for options like %r')
+ raise ValueError(msg % option_string)
+ dest = dest.replace('-', '_')
+
+ # return the updated keyword arguments
+ return dict(kwargs, dest=dest, option_strings=option_strings)
+
+ def _pop_action_class(self, kwargs, default=None):
+ action = kwargs.pop('action', default)
+ return self._registry_get('action', action, action)
+
+ def _get_handler(self):
+ # determine function from conflict handler string
+ handler_func_name = '_handle_conflict_%s' % self.conflict_handler
+ try:
+ return getattr(self, handler_func_name)
+ except AttributeError:
+ msg = _('invalid conflict_resolution value: %r')
+ raise ValueError(msg % self.conflict_handler)
+
+ def _check_conflict(self, action):
+
+ # find all options that conflict with this option
+ confl_optionals = []
+ for option_string in action.option_strings:
+ if option_string in self._option_string_actions:
+ confl_optional = self._option_string_actions[option_string]
+ confl_optionals.append((option_string, confl_optional))
+
+ # resolve any conflicts
+ if confl_optionals:
+ conflict_handler = self._get_handler()
+ conflict_handler(action, confl_optionals)
+
+ def _handle_conflict_error(self, action, conflicting_actions):
+ message = _('conflicting option string(s): %s')
+ conflict_string = ', '.join([option_string
+ for option_string, action
+ in conflicting_actions])
+ raise ArgumentError(action, message % conflict_string)
+
+ def _handle_conflict_resolve(self, action, conflicting_actions):
+
+ # remove all conflicting options
+ for option_string, action in conflicting_actions:
+
+ # remove the conflicting option
+ action.option_strings.remove(option_string)
+ self._option_string_actions.pop(option_string, None)
+
+ # if the option now has no option string, remove it from the
+ # container holding it
+ if not action.option_strings:
+ action.container._remove_action(action)
+
+
+class _ArgumentGroup(_ActionsContainer):
+
+ def __init__(self, container, title=None, description=None, **kwargs):
+ # add any missing keyword arguments by checking the container
+ update = kwargs.setdefault
+ update('conflict_handler', container.conflict_handler)
+ update('prefix_chars', container.prefix_chars)
+ update('argument_default', container.argument_default)
+ super_init = super(_ArgumentGroup, self).__init__
+ super_init(description=description, **kwargs)
+
+ # group attributes
+ self.title = title
+ self._group_actions = []
+
+ # share most attributes with the container
+ self._registries = container._registries
+ self._actions = container._actions
+ self._option_string_actions = container._option_string_actions
+ self._defaults = container._defaults
+ self._has_negative_number_optionals = \
+ container._has_negative_number_optionals
+ self._mutually_exclusive_groups = container._mutually_exclusive_groups
+
+ def _add_action(self, action):
+ action = super(_ArgumentGroup, self)._add_action(action)
+ self._group_actions.append(action)
+ return action
+
+ def _remove_action(self, action):
+ super(_ArgumentGroup, self)._remove_action(action)
+ self._group_actions.remove(action)
+
+
+class _MutuallyExclusiveGroup(_ArgumentGroup):
+
+ def __init__(self, container, required=False):
+ super(_MutuallyExclusiveGroup, self).__init__(container)
+ self.required = required
+ self._container = container
+
+ def _add_action(self, action):
+ if action.required:
+ msg = _('mutually exclusive arguments must be optional')
+ raise ValueError(msg)
+ action = self._container._add_action(action)
+ self._group_actions.append(action)
+ return action
+
+ def _remove_action(self, action):
+ self._container._remove_action(action)
+ self._group_actions.remove(action)
+
+
+class ArgumentParser(_AttributeHolder, _ActionsContainer):
+ """Object for parsing command line strings into Python objects.
+
+ Keyword Arguments:
+ - prog -- The name of the program (default: sys.argv[0])
+ - usage -- A usage message (default: auto-generated from arguments)
+ - description -- A description of what the program does
+ - epilog -- Text following the argument descriptions
+ - parents -- Parsers whose arguments should be copied into this one
+ - formatter_class -- HelpFormatter class for printing help messages
+ - prefix_chars -- Characters that prefix optional arguments
+ - fromfile_prefix_chars -- Characters that prefix files containing
+ additional arguments
+ - argument_default -- The default value for all arguments
+ - conflict_handler -- String indicating how to handle conflicts
+ - add_help -- Add a -h/-help option
+ """
+
+ def __init__(self,
+ prog=None,
+ usage=None,
+ description=None,
+ epilog=None,
+ version=None,
+ parents=[],
+ formatter_class=HelpFormatter,
+ prefix_chars='-',
+ fromfile_prefix_chars=None,
+ argument_default=None,
+ conflict_handler='error',
+ add_help=True):
+
+ if version is not None:
+ import warnings
+ warnings.warn(
+ """The "version" argument to ArgumentParser is deprecated. """
+ """Please use """
+ """"add_argument(..., action='version', version="N", ...)" """
+ """instead""", DeprecationWarning)
+
+ superinit = super(ArgumentParser, self).__init__
+ superinit(description=description,
+ prefix_chars=prefix_chars,
+ argument_default=argument_default,
+ conflict_handler=conflict_handler)
+
+ # default setting for prog
+ if prog is None:
+ prog = _os.path.basename(_sys.argv[0])
+
+ self.prog = prog
+ self.usage = usage
+ self.epilog = epilog
+ self.version = version
+ self.formatter_class = formatter_class
+ self.fromfile_prefix_chars = fromfile_prefix_chars
+ self.add_help = add_help
+
+ add_group = self.add_argument_group
+ self._positionals = add_group(_('positional arguments'))
+ self._optionals = add_group(_('optional arguments'))
+ self._subparsers = None
+
+ # register types
+ def identity(string):
+ return string
+ self.register('type', None, identity)
+
+ # add help and version arguments if necessary
+ # (using explicit default to override global argument_default)
+ default_prefix = '-' if '-' in prefix_chars else prefix_chars[0]
+ if self.add_help:
+ self.add_argument(
+ default_prefix+'h', default_prefix*2+'help',
+ action='help', default=SUPPRESS,
+ help=_('show this help message and exit'))
+ if self.version:
+ self.add_argument(
+ default_prefix+'v', default_prefix*2+'version',
+ action='version', default=SUPPRESS,
+ version=self.version,
+ help=_("show program's version number and exit"))
+
+ # add parent arguments and defaults
+ for parent in parents:
+ self._add_container_actions(parent)
+ try:
+ defaults = parent._defaults
+ except AttributeError:
+ pass
+ else:
+ self._defaults.update(defaults)
+
+ # =======================
+ # Pretty __repr__ methods
+ # =======================
+ def _get_kwargs(self):
+ names = [
+ 'prog',
+ 'usage',
+ 'description',
+ 'version',
+ 'formatter_class',
+ 'conflict_handler',
+ 'add_help',
+ ]
+ return [(name, getattr(self, name)) for name in names]
+
+ # ==================================
+ # Optional/Positional adding methods
+ # ==================================
+ def add_subparsers(self, **kwargs):
+ if self._subparsers is not None:
+ self.error(_('cannot have multiple subparser arguments'))
+
+ # add the parser class to the arguments if it's not present
+ kwargs.setdefault('parser_class', type(self))
+
+ if 'title' in kwargs or 'description' in kwargs:
+ title = _(kwargs.pop('title', 'subcommands'))
+ description = _(kwargs.pop('description', None))
+ self._subparsers = self.add_argument_group(title, description)
+ else:
+ self._subparsers = self._positionals
+
+ # prog defaults to the usage message of this parser, skipping
+ # optional arguments and with no "usage:" prefix
+ if kwargs.get('prog') is None:
+ formatter = self._get_formatter()
+ positionals = self._get_positional_actions()
+ groups = self._mutually_exclusive_groups
+ formatter.add_usage(self.usage, positionals, groups, '')
+ kwargs['prog'] = formatter.format_help().strip()
+
+ # create the parsers action and add it to the positionals list
+ parsers_class = self._pop_action_class(kwargs, 'parsers')
+ action = parsers_class(option_strings=[], **kwargs)
+ self._subparsers._add_action(action)
+
+ # return the created parsers action
+ return action
+
+ def _add_action(self, action):
+ if action.option_strings:
+ self._optionals._add_action(action)
+ else:
+ self._positionals._add_action(action)
+ return action
+
+ def _get_optional_actions(self):
+ return [action
+ for action in self._actions
+ if action.option_strings]
+
+ def _get_positional_actions(self):
+ return [action
+ for action in self._actions
+ if not action.option_strings]
+
+ # =====================================
+ # Command line argument parsing methods
+ # =====================================
+ def parse_args(self, args=None, namespace=None):
+ args, argv = self.parse_known_args(args, namespace)
+ if argv:
+ msg = _('unrecognized arguments: %s')
+ self.error(msg % ' '.join(argv))
+ return args
+
+ def parse_known_args(self, args=None, namespace=None):
+ if args is None:
+ # args default to the system args
+ args = _sys.argv[1:]
+ else:
+ # make sure that args are mutable
+ args = list(args)
+
+ # default Namespace built from parser defaults
+ if namespace is None:
+ namespace = Namespace()
+
+ # add any action defaults that aren't present
+ for action in self._actions:
+ if action.dest is not SUPPRESS:
+ if not hasattr(namespace, action.dest):
+ if action.default is not SUPPRESS:
+ setattr(namespace, action.dest, action.default)
+
+ # add any parser defaults that aren't present
+ for dest in self._defaults:
+ if not hasattr(namespace, dest):
+ setattr(namespace, dest, self._defaults[dest])
+
+ # parse the arguments and exit if there are any errors
+ try:
+ namespace, args = self._parse_known_args(args, namespace)
+ if hasattr(namespace, _UNRECOGNIZED_ARGS_ATTR):
+ args.extend(getattr(namespace, _UNRECOGNIZED_ARGS_ATTR))
+ delattr(namespace, _UNRECOGNIZED_ARGS_ATTR)
+ return namespace, args
+ except ArgumentError:
+ err = _sys.exc_info()[1]
+ self.error(str(err))
+
+ def _parse_known_args(self, arg_strings, namespace):
+ # replace arg strings that are file references
+ if self.fromfile_prefix_chars is not None:
+ arg_strings = self._read_args_from_files(arg_strings)
+
+ # map all mutually exclusive arguments to the other arguments
+ # they can't occur with
+ action_conflicts = {}
+ for mutex_group in self._mutually_exclusive_groups:
+ group_actions = mutex_group._group_actions
+ for i, mutex_action in enumerate(mutex_group._group_actions):
+ conflicts = action_conflicts.setdefault(mutex_action, [])
+ conflicts.extend(group_actions[:i])
+ conflicts.extend(group_actions[i + 1:])
+
+ # find all option indices, and determine the arg_string_pattern
+ # which has an 'O' if there is an option at an index,
+ # an 'A' if there is an argument, or a '-' if there is a '--'
+ option_string_indices = {}
+ arg_string_pattern_parts = []
+ arg_strings_iter = iter(arg_strings)
+ for i, arg_string in enumerate(arg_strings_iter):
+
+ # all args after -- are non-options
+ if arg_string == '--':
+ arg_string_pattern_parts.append('-')
+ for arg_string in arg_strings_iter:
+ arg_string_pattern_parts.append('A')
+
+ # otherwise, add the arg to the arg strings
+ # and note the index if it was an option
+ else:
+ option_tuple = self._parse_optional(arg_string)
+ if option_tuple is None:
+ pattern = 'A'
+ else:
+ option_string_indices[i] = option_tuple
+ pattern = 'O'
+ arg_string_pattern_parts.append(pattern)
+
+ # join the pieces together to form the pattern
+ arg_strings_pattern = ''.join(arg_string_pattern_parts)
+
+ # converts arg strings to the appropriate and then takes the action
+ seen_actions = set()
+ seen_non_default_actions = set()
+
+ def take_action(action, argument_strings, option_string=None):
+ seen_actions.add(action)
+ argument_values = self._get_values(action, argument_strings)
+
+ # error if this argument is not allowed with other previously
+ # seen arguments, assuming that actions that use the default
+ # value don't really count as "present"
+ if argument_values is not action.default:
+ seen_non_default_actions.add(action)
+ for conflict_action in action_conflicts.get(action, []):
+ if conflict_action in seen_non_default_actions:
+ msg = _('not allowed with argument %s')
+ action_name = _get_action_name(conflict_action)
+ raise ArgumentError(action, msg % action_name)
+
+ # take the action if we didn't receive a SUPPRESS value
+ # (e.g. from a default)
+ if argument_values is not SUPPRESS:
+ action(self, namespace, argument_values, option_string)
+
+ # function to convert arg_strings into an optional action
+ def consume_optional(start_index):
+
+ # get the optional identified at this index
+ option_tuple = option_string_indices[start_index]
+ action, option_string, explicit_arg = option_tuple
+
+ # identify additional optionals in the same arg string
+ # (e.g. -xyz is the same as -x -y -z if no args are required)
+ match_argument = self._match_argument
+ action_tuples = []
+ while True:
+
+ # if we found no optional action, skip it
+ if action is None:
+ extras.append(arg_strings[start_index])
+ return start_index + 1
+
+ # if there is an explicit argument, try to match the
+ # optional's string arguments to only this
+ if explicit_arg is not None:
+ arg_count = match_argument(action, 'A')
+
+ # if the action is a single-dash option and takes no
+ # arguments, try to parse more single-dash options out
+ # of the tail of the option string
+ chars = self.prefix_chars
+ if arg_count == 0 and option_string[1] not in chars:
+ action_tuples.append((action, [], option_string))
+ char = option_string[0]
+ option_string = char + explicit_arg[0]
+ new_explicit_arg = explicit_arg[1:] or None
+ optionals_map = self._option_string_actions
+ if option_string in optionals_map:
+ action = optionals_map[option_string]
+ explicit_arg = new_explicit_arg
+ else:
+ msg = _('ignored explicit argument %r')
+ raise ArgumentError(action, msg % explicit_arg)
+
+ # if the action expect exactly one argument, we've
+ # successfully matched the option; exit the loop
+ elif arg_count == 1:
+ stop = start_index + 1
+ args = [explicit_arg]
+ action_tuples.append((action, args, option_string))
+ break
+
+ # error if a double-dash option did not use the
+ # explicit argument
+ else:
+ msg = _('ignored explicit argument %r')
+ raise ArgumentError(action, msg % explicit_arg)
+
+ # if there is no explicit argument, try to match the
+ # optional's string arguments with the following strings
+ # if successful, exit the loop
+ else:
+ start = start_index + 1
+ selected_patterns = arg_strings_pattern[start:]
+ arg_count = match_argument(action, selected_patterns)
+ stop = start + arg_count
+ args = arg_strings[start:stop]
+ action_tuples.append((action, args, option_string))
+ break
+
+ # add the Optional to the list and return the index at which
+ # the Optional's string args stopped
+ assert action_tuples
+ for action, args, option_string in action_tuples:
+ take_action(action, args, option_string)
+ return stop
+
+ # the list of Positionals left to be parsed; this is modified
+ # by consume_positionals()
+ positionals = self._get_positional_actions()
+
+ # function to convert arg_strings into positional actions
+ def consume_positionals(start_index):
+ # match as many Positionals as possible
+ match_partial = self._match_arguments_partial
+ selected_pattern = arg_strings_pattern[start_index:]
+ arg_counts = match_partial(positionals, selected_pattern)
+
+ # slice off the appropriate arg strings for each Positional
+ # and add the Positional and its args to the list
+ for action, arg_count in zip(positionals, arg_counts):
+ args = arg_strings[start_index: start_index + arg_count]
+ start_index += arg_count
+ take_action(action, args)
+
+ # slice off the Positionals that we just parsed and return the
+ # index at which the Positionals' string args stopped
+ positionals[:] = positionals[len(arg_counts):]
+ return start_index
+
+ # consume Positionals and Optionals alternately, until we have
+ # passed the last option string
+ extras = []
+ start_index = 0
+ if option_string_indices:
+ max_option_string_index = max(option_string_indices)
+ else:
+ max_option_string_index = -1
+ while start_index <= max_option_string_index:
+
+ # consume any Positionals preceding the next option
+ next_option_string_index = min([
+ index
+ for index in option_string_indices
+ if index >= start_index])
+ if start_index != next_option_string_index:
+ positionals_end_index = consume_positionals(start_index)
+
+ # only try to parse the next optional if we didn't consume
+ # the option string during the positionals parsing
+ if positionals_end_index > start_index:
+ start_index = positionals_end_index
+ continue
+ else:
+ start_index = positionals_end_index
+
+ # if we consumed all the positionals we could and we're not
+ # at the index of an option string, there were extra arguments
+ if start_index not in option_string_indices:
+ strings = arg_strings[start_index:next_option_string_index]
+ extras.extend(strings)
+ start_index = next_option_string_index
+
+ # consume the next optional and any arguments for it
+ start_index = consume_optional(start_index)
+
+ # consume any positionals following the last Optional
+ stop_index = consume_positionals(start_index)
+
+ # if we didn't consume all the argument strings, there were extras
+ extras.extend(arg_strings[stop_index:])
+
+ # if we didn't use all the Positional objects, there were too few
+ # arg strings supplied.
+ if positionals:
+ self.error(_('too few arguments'))
+
+ # make sure all required actions were present, and convert defaults.
+ for action in self._actions:
+ if action not in seen_actions:
+ if action.required:
+ name = _get_action_name(action)
+ self.error(_('argument %s is required') % name)
+ else:
+ # Convert action default now instead of doing it before
+ # parsing arguments to avoid calling convert functions
+ # twice (which may fail) if the argument was given, but
+ # only if it was defined already in the namespace
+ if (action.default is not None and
+ isinstance(action.default, basestring) and
+ hasattr(namespace, action.dest) and
+ action.default is getattr(namespace, action.dest)):
+ setattr(namespace, action.dest,
+ self._get_value(action, action.default))
+
+ # make sure all required groups had one option present
+ for group in self._mutually_exclusive_groups:
+ if group.required:
+ for action in group._group_actions:
+ if action in seen_non_default_actions:
+ break
+
+ # if no actions were used, report the error
+ else:
+ names = [_get_action_name(action)
+ for action in group._group_actions
+ if action.help is not SUPPRESS]
+ msg = _('one of the arguments %s is required')
+ self.error(msg % ' '.join(names))
+
+ # return the updated namespace and the extra arguments
+ return namespace, extras
+
+ def _read_args_from_files(self, arg_strings):
+ # expand arguments referencing files
+ new_arg_strings = []
+ for arg_string in arg_strings:
+
+ # for regular arguments, just add them back into the list
+ if not arg_string or arg_string[0] not in self.fromfile_prefix_chars:
+ new_arg_strings.append(arg_string)
+
+ # replace arguments referencing files with the file content
+ else:
+ try:
+ args_file = open(arg_string[1:])
+ try:
+ arg_strings = []
+ for arg_line in args_file.read().splitlines():
+ for arg in self.convert_arg_line_to_args(arg_line):
+ arg_strings.append(arg)
+ arg_strings = self._read_args_from_files(arg_strings)
+ new_arg_strings.extend(arg_strings)
+ finally:
+ args_file.close()
+ except IOError:
+ err = _sys.exc_info()[1]
+ self.error(str(err))
+
+ # return the modified argument list
+ return new_arg_strings
+
+ def convert_arg_line_to_args(self, arg_line):
+ return [arg_line]
+
+ def _match_argument(self, action, arg_strings_pattern):
+ # match the pattern for this action to the arg strings
+ nargs_pattern = self._get_nargs_pattern(action)
+ match = _re.match(nargs_pattern, arg_strings_pattern)
+
+ # raise an exception if we weren't able to find a match
+ if match is None:
+ nargs_errors = {
+ None: _('expected one argument'),
+ OPTIONAL: _('expected at most one argument'),
+ ONE_OR_MORE: _('expected at least one argument'),
+ }
+ default = _('expected %s argument(s)') % action.nargs
+ msg = nargs_errors.get(action.nargs, default)
+ raise ArgumentError(action, msg)
+
+ # return the number of arguments matched
+ return len(match.group(1))
+
+ def _match_arguments_partial(self, actions, arg_strings_pattern):
+ # progressively shorten the actions list by slicing off the
+ # final actions until we find a match
+ result = []
+ for i in range(len(actions), 0, -1):
+ actions_slice = actions[:i]
+ pattern = ''.join([self._get_nargs_pattern(action)
+ for action in actions_slice])
+ match = _re.match(pattern, arg_strings_pattern)
+ if match is not None:
+ result.extend([len(string) for string in match.groups()])
+ break
+
+ # return the list of arg string counts
+ return result
+
+ def _parse_optional(self, arg_string):
+ # if it's an empty string, it was meant to be a positional
+ if not arg_string:
+ return None
+
+ # if it doesn't start with a prefix, it was meant to be positional
+ if not arg_string[0] in self.prefix_chars:
+ return None
+
+ # if the option string is present in the parser, return the action
+ if arg_string in self._option_string_actions:
+ action = self._option_string_actions[arg_string]
+ return action, arg_string, None
+
+ # if it's just a single character, it was meant to be positional
+ if len(arg_string) == 1:
+ return None
+
+ # if the option string before the "=" is present, return the action
+ if '=' in arg_string:
+ option_string, explicit_arg = arg_string.split('=', 1)
+ if option_string in self._option_string_actions:
+ action = self._option_string_actions[option_string]
+ return action, option_string, explicit_arg
+
+ # search through all possible prefixes of the option string
+ # and all actions in the parser for possible interpretations
+ option_tuples = self._get_option_tuples(arg_string)
+
+ # if multiple actions match, the option string was ambiguous
+ if len(option_tuples) > 1:
+ options = ', '.join([option_string
+ for action, option_string, explicit_arg in option_tuples])
+ tup = arg_string, options
+ self.error(_('ambiguous option: %s could match %s') % tup)
+
+ # if exactly one action matched, this segmentation is good,
+ # so return the parsed action
+ elif len(option_tuples) == 1:
+ option_tuple, = option_tuples
+ return option_tuple
+
+ # if it was not found as an option, but it looks like a negative
+ # number, it was meant to be positional
+ # unless there are negative-number-like options
+ if self._negative_number_matcher.match(arg_string):
+ if not self._has_negative_number_optionals:
+ return None
+
+ # if it contains a space, it was meant to be a positional
+ if ' ' in arg_string:
+ return None
+
+ # it was meant to be an optional but there is no such option
+ # in this parser (though it might be a valid option in a subparser)
+ return None, arg_string, None
+
+ def _get_option_tuples(self, option_string):
+ result = []
+
+ # option strings starting with two prefix characters are only
+ # split at the '='
+ chars = self.prefix_chars
+ if option_string[0] in chars and option_string[1] in chars:
+ if '=' in option_string:
+ option_prefix, explicit_arg = option_string.split('=', 1)
+ else:
+ option_prefix = option_string
+ explicit_arg = None
+ for option_string in self._option_string_actions:
+ if option_string.startswith(option_prefix):
+ action = self._option_string_actions[option_string]
+ tup = action, option_string, explicit_arg
+ result.append(tup)
+
+ # single character options can be concatenated with their arguments
+ # but multiple character options always have to have their argument
+ # separate
+ elif option_string[0] in chars and option_string[1] not in chars:
+ option_prefix = option_string
+ explicit_arg = None
+ short_option_prefix = option_string[:2]
+ short_explicit_arg = option_string[2:]
+
+ for option_string in self._option_string_actions:
+ if option_string == short_option_prefix:
+ action = self._option_string_actions[option_string]
+ tup = action, option_string, short_explicit_arg
+ result.append(tup)
+ elif option_string.startswith(option_prefix):
+ action = self._option_string_actions[option_string]
+ tup = action, option_string, explicit_arg
+ result.append(tup)
+
+ # shouldn't ever get here
+ else:
+ self.error(_('unexpected option string: %s') % option_string)
+
+ # return the collected option tuples
+ return result
+
+ def _get_nargs_pattern(self, action):
+ # in all examples below, we have to allow for '--' args
+ # which are represented as '-' in the pattern
+ nargs = action.nargs
+
+ # the default (None) is assumed to be a single argument
+ if nargs is None:
+ nargs_pattern = '(-*A-*)'
+
+ # allow zero or one arguments
+ elif nargs == OPTIONAL:
+ nargs_pattern = '(-*A?-*)'
+
+ # allow zero or more arguments
+ elif nargs == ZERO_OR_MORE:
+ nargs_pattern = '(-*[A-]*)'
+
+ # allow one or more arguments
+ elif nargs == ONE_OR_MORE:
+ nargs_pattern = '(-*A[A-]*)'
+
+ # allow any number of options or arguments
+ elif nargs == REMAINDER:
+ nargs_pattern = '([-AO]*)'
+
+ # allow one argument followed by any number of options or arguments
+ elif nargs == PARSER:
+ nargs_pattern = '(-*A[-AO]*)'
+
+ # all others should be integers
+ else:
+ nargs_pattern = '(-*%s-*)' % '-*'.join('A' * nargs)
+
+ # if this is an optional action, -- is not allowed
+ if action.option_strings:
+ nargs_pattern = nargs_pattern.replace('-*', '')
+ nargs_pattern = nargs_pattern.replace('-', '')
+
+ # return the pattern
+ return nargs_pattern
+
+ # ========================
+ # Value conversion methods
+ # ========================
+ def _get_values(self, action, arg_strings):
+ # for everything but PARSER, REMAINDER args, strip out first '--'
+ if action.nargs not in [PARSER, REMAINDER]:
+ try:
+ arg_strings.remove('--')
+ except ValueError:
+ pass
+
+ # optional argument produces a default when not present
+ if not arg_strings and action.nargs == OPTIONAL:
+ if action.option_strings:
+ value = action.const
+ else:
+ value = action.default
+ if isinstance(value, basestring):
+ value = self._get_value(action, value)
+ self._check_value(action, value)
+
+ # when nargs='*' on a positional, if there were no command-line
+ # args, use the default if it is anything other than None
+ elif (not arg_strings and action.nargs == ZERO_OR_MORE and
+ not action.option_strings):
+ if action.default is not None:
+ value = action.default
+ else:
+ value = arg_strings
+ self._check_value(action, value)
+
+ # single argument or optional argument produces a single value
+ elif len(arg_strings) == 1 and action.nargs in [None, OPTIONAL]:
+ arg_string, = arg_strings
+ value = self._get_value(action, arg_string)
+ self._check_value(action, value)
+
+ # REMAINDER arguments convert all values, checking none
+ elif action.nargs == REMAINDER:
+ value = [self._get_value(action, v) for v in arg_strings]
+
+ # PARSER arguments convert all values, but check only the first
+ elif action.nargs == PARSER:
+ value = [self._get_value(action, v) for v in arg_strings]
+ self._check_value(action, value[0])
+
+ # all other types of nargs produce a list
+ else:
+ value = [self._get_value(action, v) for v in arg_strings]
+ for v in value:
+ self._check_value(action, v)
+
+ # return the converted value
+ return value
+
+ def _get_value(self, action, arg_string):
+ type_func = self._registry_get('type', action.type, action.type)
+ if not _callable(type_func):
+ msg = _('%r is not callable')
+ raise ArgumentError(action, msg % type_func)
+
+ # convert the value to the appropriate type
+ try:
+ result = type_func(arg_string)
+
+ # ArgumentTypeErrors indicate errors
+ except ArgumentTypeError:
+ name = getattr(action.type, '__name__', repr(action.type))
+ msg = str(_sys.exc_info()[1])
+ raise ArgumentError(action, msg)
+
+ # TypeErrors or ValueErrors also indicate errors
+ except (TypeError, ValueError):
+ name = getattr(action.type, '__name__', repr(action.type))
+ msg = _('invalid %s value: %r')
+ raise ArgumentError(action, msg % (name, arg_string))
+
+ # return the converted value
+ return result
+
+ def _check_value(self, action, value):
+ # converted value must be one of the choices (if specified)
+ if action.choices is not None and value not in action.choices:
+ tup = value, ', '.join(map(repr, action.choices))
+ msg = _('invalid choice: %r (choose from %s)') % tup
+ raise ArgumentError(action, msg)
+
+ # =======================
+ # Help-formatting methods
+ # =======================
+ def format_usage(self):
+ formatter = self._get_formatter()
+ formatter.add_usage(self.usage, self._actions,
+ self._mutually_exclusive_groups)
+ return formatter.format_help()
+
+ def format_help(self):
+ formatter = self._get_formatter()
+
+ # usage
+ formatter.add_usage(self.usage, self._actions,
+ self._mutually_exclusive_groups)
+
+ # description
+ formatter.add_text(self.description)
+
+ # positionals, optionals and user-defined groups
+ for action_group in self._action_groups:
+ formatter.start_section(action_group.title)
+ formatter.add_text(action_group.description)
+ formatter.add_arguments(action_group._group_actions)
+ formatter.end_section()
+
+ # epilog
+ formatter.add_text(self.epilog)
+
+ # determine help from format above
+ return formatter.format_help()
+
+ def format_version(self):
+ import warnings
+ warnings.warn(
+ 'The format_version method is deprecated -- the "version" '
+ 'argument to ArgumentParser is no longer supported.',
+ DeprecationWarning)
+ formatter = self._get_formatter()
+ formatter.add_text(self.version)
+ return formatter.format_help()
+
+ def _get_formatter(self):
+ return self.formatter_class(prog=self.prog)
+
+ # =====================
+ # Help-printing methods
+ # =====================
+ def print_usage(self, file=None):
+ if file is None:
+ file = _sys.stdout
+ self._print_message(self.format_usage(), file)
+
+ def print_help(self, file=None):
+ if file is None:
+ file = _sys.stdout
+ self._print_message(self.format_help(), file)
+
+ def print_version(self, file=None):
+ import warnings
+ warnings.warn(
+ 'The print_version method is deprecated -- the "version" '
+ 'argument to ArgumentParser is no longer supported.',
+ DeprecationWarning)
+ self._print_message(self.format_version(), file)
+
+ def _print_message(self, message, file=None):
+ if message:
+ if file is None:
+ file = _sys.stderr
+ file.write(message)
+
+ # ===============
+ # Exiting methods
+ # ===============
+ def exit(self, status=0, message=None):
+ if message:
+ self._print_message(message, _sys.stderr)
+ _sys.exit(status)
+
+ def error(self, message):
+ """error(message: string)
+
+ Prints a usage message incorporating the message to stderr and
+ exits.
+
+ If you override this in a subclass, it should not return -- it
+ should either exit or raise an exception.
+ """
+ self.print_usage(_sys.stderr)
+ self.exit(2, _('%s: error: %s\n') % (self.prog, message))
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
index 0000000000..4070c39a24
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/ast.py
@@ -0,0 +1,311 @@
+# -*- coding: utf-8 -*-
+"""
+ ast
+ ~~~
+
+ The `ast` module helps Python applications to process trees of the Python
+ abstract syntax grammar. The abstract syntax itself might change with
+ each Python release; this module helps to find out programmatically what
+ the current grammar looks like and allows modifications of it.
+
+ An abstract syntax tree can be generated by passing `ast.PyCF_ONLY_AST` as
+ a flag to the `compile()` builtin function or by using the `parse()`
+ function from this module. The result will be a tree of objects whose
+ classes all inherit from `ast.AST`.
+
+ A modified abstract syntax tree can be compiled into a Python code object
+ using the built-in `compile()` function.
+
+ Additionally various helper functions are provided that make working with
+ the trees simpler. The main intention of the helper functions and this
+ module in general is to provide an easy to use interface for libraries
+ that work tightly with the python syntax (template engines for example).
+
+
+ :copyright: Copyright 2008 by Armin Ronacher.
+ :license: Python License.
+"""
+from _ast import *
+from _ast import __version__
+
+
+def parse(source, filename='<unknown>', mode='exec'):
+ """
+ Parse the source into an AST node.
+ Equivalent to compile(source, filename, mode, PyCF_ONLY_AST).
+ """
+ return compile(source, filename, mode, PyCF_ONLY_AST)
+
+
+def literal_eval(node_or_string):
+ """
+ Safely evaluate an expression node or a string containing a Python
+ expression. The string or node provided may only consist of the following
+ Python literal structures: strings, numbers, tuples, lists, dicts, booleans,
+ and None.
+ """
+ _safe_names = {'None': None, 'True': True, 'False': False}
+ if isinstance(node_or_string, basestring):
+ node_or_string = parse(node_or_string, mode='eval')
+ if isinstance(node_or_string, Expression):
+ node_or_string = node_or_string.body
+ def _convert(node):
+ if isinstance(node, Str):
+ return node.s
+ elif isinstance(node, Num):
+ return node.n
+ elif isinstance(node, Tuple):
+ return tuple(map(_convert, node.elts))
+ elif isinstance(node, List):
+ return list(map(_convert, node.elts))
+ elif isinstance(node, Dict):
+ return dict((_convert(k), _convert(v)) for k, v
+ in zip(node.keys, node.values))
+ elif isinstance(node, Name):
+ if node.id in _safe_names:
+ return _safe_names[node.id]
+ elif isinstance(node, BinOp) and \
+ isinstance(node.op, (Add, Sub)) and \
+ isinstance(node.right, Num) and \
+ isinstance(node.right.n, complex) and \
+ isinstance(node.left, Num) and \
+ isinstance(node.left.n, (int, long, float)):
+ left = node.left.n
+ right = node.right.n
+ if isinstance(node.op, Add):
+ return left + right
+ else:
+ return left - right
+ raise ValueError('malformed string')
+ return _convert(node_or_string)
+
+
+def dump(node, annotate_fields=True, include_attributes=False):
+ """
+ Return a formatted dump of the tree in *node*. This is mainly useful for
+ debugging purposes. The returned string will show the names and the values
+ for fields. This makes the code impossible to evaluate, so if evaluation is
+ wanted *annotate_fields* must be set to False. Attributes such as line
+ numbers and column offsets are not dumped by default. If this is wanted,
+ *include_attributes* can be set to True.
+ """
+ def _format(node):
+ if isinstance(node, AST):
+ fields = [(a, _format(b)) for a, b in iter_fields(node)]
+ rv = '%s(%s' % (node.__class__.__name__, ', '.join(
+ ('%s=%s' % field for field in fields)
+ if annotate_fields else
+ (b for a, b in fields)
+ ))
+ if include_attributes and node._attributes:
+ rv += fields and ', ' or ' '
+ rv += ', '.join('%s=%s' % (a, _format(getattr(node, a)))
+ for a in node._attributes)
+ return rv + ')'
+ elif isinstance(node, list):
+ return '[%s]' % ', '.join(_format(x) for x in node)
+ return repr(node)
+ if not isinstance(node, AST):
+ raise TypeError('expected AST, got %r' % node.__class__.__name__)
+ return _format(node)
+
+
+def copy_location(new_node, old_node):
+ """
+ Copy source location (`lineno` and `col_offset` attributes) from
+ *old_node* to *new_node* if possible, and return *new_node*.
+ """
+ for attr in 'lineno', 'col_offset':
+ if attr in old_node._attributes and attr in new_node._attributes \
+ and hasattr(old_node, attr):
+ setattr(new_node, attr, getattr(old_node, attr))
+ return new_node
+
+
+def fix_missing_locations(node):
+ """
+ When you compile a node tree with compile(), the compiler expects lineno and
+ col_offset attributes for every node that supports them. This is rather
+ tedious to fill in for generated nodes, so this helper adds these attributes
+ recursively where not already set, by setting them to the values of the
+ parent node. It works recursively starting at *node*.
+ """
+ def _fix(node, lineno, col_offset):
+ if 'lineno' in node._attributes:
+ if not hasattr(node, 'lineno'):
+ node.lineno = lineno
+ else:
+ lineno = node.lineno
+ if 'col_offset' in node._attributes:
+ if not hasattr(node, 'col_offset'):
+ node.col_offset = col_offset
+ else:
+ col_offset = node.col_offset
+ for child in iter_child_nodes(node):
+ _fix(child, lineno, col_offset)
+ _fix(node, 1, 0)
+ return node
+
+
+def increment_lineno(node, n=1):
+ """
+ Increment the line number of each node in the tree starting at *node* by *n*.
+ This is useful to "move code" to a different location in a file.
+ """
+ for child in walk(node):
+ if 'lineno' in child._attributes:
+ child.lineno = getattr(child, 'lineno', 0) + n
+ return node
+
+
+def iter_fields(node):
+ """
+ Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields``
+ that is present on *node*.
+ """
+ for field in node._fields:
+ try:
+ yield field, getattr(node, field)
+ except AttributeError:
+ pass
+
+
+def iter_child_nodes(node):
+ """
+ Yield all direct child nodes of *node*, that is, all fields that are nodes
+ and all items of fields that are lists of nodes.
+ """
+ for name, field in iter_fields(node):
+ if isinstance(field, AST):
+ yield field
+ elif isinstance(field, list):
+ for item in field:
+ if isinstance(item, AST):
+ yield item
+
+
+def get_docstring(node, clean=True):
+ """
+ Return the docstring for the given node or None if no docstring can
+ be found. If the node provided does not have docstrings a TypeError
+ will be raised.
+ """
+ if not isinstance(node, (FunctionDef, ClassDef, Module)):
+ raise TypeError("%r can't have docstrings" % node.__class__.__name__)
+ if node.body and isinstance(node.body[0], Expr) and \
+ isinstance(node.body[0].value, Str):
+ if clean:
+ import inspect
+ return inspect.cleandoc(node.body[0].value.s)
+ return node.body[0].value.s
+
+
+def walk(node):
+ """
+ Recursively yield all descendant nodes in the tree starting at *node*
+ (including *node* itself), in no specified order. This is useful if you
+ only want to modify nodes in place and don't care about the context.
+ """
+ from collections import deque
+ todo = deque([node])
+ while todo:
+ node = todo.popleft()
+ todo.extend(iter_child_nodes(node))
+ yield node
+
+
+class NodeVisitor(object):
+ """
+ A node visitor base class that walks the abstract syntax tree and calls a
+ visitor function for every node found. This function may return a value
+ which is forwarded by the `visit` method.
+
+ This class is meant to be subclassed, with the subclass adding visitor
+ methods.
+
+ Per default the visitor functions for the nodes are ``'visit_'`` +
+ class name of the node. So a `TryFinally` node visit function would
+ be `visit_TryFinally`. This behavior can be changed by overriding
+ the `visit` method. If no visitor function exists for a node
+ (return value `None`) the `generic_visit` visitor is used instead.
+
+ Don't use the `NodeVisitor` if you want to apply changes to nodes during
+ traversing. For this a special visitor exists (`NodeTransformer`) that
+ allows modifications.
+ """
+
+ def visit(self, node):
+ """Visit a node."""
+ method = 'visit_' + node.__class__.__name__
+ visitor = getattr(self, method, self.generic_visit)
+ return visitor(node)
+
+ def generic_visit(self, node):
+ """Called if no explicit visitor function exists for a node."""
+ for field, value in iter_fields(node):
+ if isinstance(value, list):
+ for item in value:
+ if isinstance(item, AST):
+ self.visit(item)
+ elif isinstance(value, AST):
+ self.visit(value)
+
+
+class NodeTransformer(NodeVisitor):
+ """
+ A :class:`NodeVisitor` subclass that walks the abstract syntax tree and
+ allows modification of nodes.
+
+ The `NodeTransformer` will walk the AST and use the return value of the
+ visitor methods to replace or remove the old node. If the return value of
+ the visitor method is ``None``, the node will be removed from its location,
+ otherwise it is replaced with the return value. The return value may be the
+ original node in which case no replacement takes place.
+
+ Here is an example transformer that rewrites all occurrences of name lookups
+ (``foo``) to ``data['foo']``::
+
+ class RewriteName(NodeTransformer):
+
+ def visit_Name(self, node):
+ return copy_location(Subscript(
+ value=Name(id='data', ctx=Load()),
+ slice=Index(value=Str(s=node.id)),
+ ctx=node.ctx
+ ), node)
+
+ Keep in mind that if the node you're operating on has child nodes you must
+ either transform the child nodes yourself or call the :meth:`generic_visit`
+ method for the node first.
+
+ For nodes that were part of a collection of statements (that applies to all
+ statement nodes), the visitor may also return a list of nodes rather than
+ just a single node.
+
+ Usually you use the transformer like this::
+
+ node = YourTransformer().visit(node)
+ """
+
+ def generic_visit(self, node):
+ for field, old_value in iter_fields(node):
+ old_value = getattr(node, field, None)
+ if isinstance(old_value, list):
+ new_values = []
+ for value in old_value:
+ if isinstance(value, AST):
+ value = self.visit(value)
+ if value is None:
+ continue
+ elif not isinstance(value, AST):
+ new_values.extend(value)
+ continue
+ new_values.append(value)
+ old_value[:] = new_values
+ elif isinstance(old_value, AST):
+ new_node = self.visit(old_value)
+ if new_node is None:
+ delattr(node, field)
+ else:
+ setattr(node, field, new_node)
+ return node
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
index 0000000000..6c2769cdca
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/atexit.py
@@ -0,0 +1,65 @@
+"""
+atexit.py - allow programmer to define multiple exit functions to be executed
+upon normal program termination.
+
+One public function, register, is defined.
+"""
+
+__all__ = ["register"]
+
+import sys
+
+_exithandlers = []
+def _run_exitfuncs():
+ """run any registered exit functions
+
+ _exithandlers is traversed in reverse order so functions are executed
+ last in, first out.
+ """
+
+ exc_info = None
+ while _exithandlers:
+ func, targs, kargs = _exithandlers.pop()
+ try:
+ func(*targs, **kargs)
+ except SystemExit:
+ exc_info = sys.exc_info()
+ except:
+ import traceback
+ print >> sys.stderr, "Error in atexit._run_exitfuncs:"
+ traceback.print_exc()
+ exc_info = sys.exc_info()
+
+ if exc_info is not None:
+ raise exc_info[0], exc_info[1], exc_info[2]
+
+
+def register(func, *targs, **kargs):
+ """register a function to be executed upon normal program termination
+
+ func - function to be called at exit
+ targs - optional arguments to pass to func
+ kargs - optional keyword arguments to pass to func
+
+ func is returned to facilitate usage as a decorator.
+ """
+ _exithandlers.append((func, targs, kargs))
+ return func
+
+if hasattr(sys, "exitfunc"):
+ # Assume it's another registered exit function - append it to our list
+ register(sys.exitfunc)
+sys.exitfunc = _run_exitfuncs
+
+if __name__ == "__main__":
+ def x1():
+ print "running x1"
+ def x2(n):
+ print "running x2(%r)" % (n,)
+ def x3(n, kwd=None):
+ print "running x3(%r, kwd=%r)" % (n, kwd)
+
+ register(x1)
+ register(x2, 12)
+ register(x3, 5, "bar")
+ register(x3, "no kwd args")
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
index 0000000000..4828c1c62b
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/binhex.py
@@ -0,0 +1,518 @@
+"""Macintosh binhex compression/decompression.
+
+easy interface:
+binhex(inputfilename, outputfilename)
+hexbin(inputfilename, outputfilename)
+"""
+
+#
+# Jack Jansen, CWI, August 1995.
+#
+# The module is supposed to be as compatible as possible. Especially the
+# easy interface should work "as expected" on any platform.
+# XXXX Note: currently, textfiles appear in mac-form on all platforms.
+# We seem to lack a simple character-translate in python.
+# (we should probably use ISO-Latin-1 on all but the mac platform).
+# XXXX The simple routines are too simple: they expect to hold the complete
+# files in-core. Should be fixed.
+# XXXX It would be nice to handle AppleDouble format on unix
+# (for servers serving macs).
+# XXXX I don't understand what happens when you get 0x90 times the same byte on
+# input. The resulting code (xx 90 90) would appear to be interpreted as an
+# escaped *value* of 0x90. All coders I've seen appear to ignore this nicety...
+#
+import sys
+import os
+import struct
+import binascii
+
+__all__ = ["binhex","hexbin","Error"]
+
+class Error(Exception):
+ pass
+
+# States (what have we written)
+_DID_HEADER = 0
+_DID_DATA = 1
+
+# Various constants
+REASONABLY_LARGE=32768 # Minimal amount we pass the rle-coder
+LINELEN=64
+RUNCHAR=chr(0x90) # run-length introducer
+
+#
+# This code is no longer byte-order dependent
+
+#
+# Workarounds for non-mac machines.
+try:
+ from Carbon.File import FSSpec, FInfo
+ from MacOS import openrf
+
+ def getfileinfo(name):
+ finfo = FSSpec(name).FSpGetFInfo()
+ dir, file = os.path.split(name)
+ # XXX Get resource/data sizes
+ fp = open(name, 'rb')
+ fp.seek(0, 2)
+ dlen = fp.tell()
+ fp = openrf(name, '*rb')
+ fp.seek(0, 2)
+ rlen = fp.tell()
+ return file, finfo, dlen, rlen
+
+ def openrsrc(name, *mode):
+ if not mode:
+ mode = '*rb'
+ else:
+ mode = '*' + mode[0]
+ return openrf(name, mode)
+
+except ImportError:
+ #
+ # Glue code for non-macintosh usage
+ #
+
+ class FInfo:
+ def __init__(self):
+ self.Type = '????'
+ self.Creator = '????'
+ self.Flags = 0
+
+ def getfileinfo(name):
+ finfo = FInfo()
+ # Quick check for textfile
+ fp = open(name)
+ data = open(name).read(256)
+ for c in data:
+ if not c.isspace() and (c<' ' or ord(c) > 0x7f):
+ break
+ else:
+ finfo.Type = 'TEXT'
+ fp.seek(0, 2)
+ dsize = fp.tell()
+ fp.close()
+ dir, file = os.path.split(name)
+ file = file.replace(':', '-', 1)
+ return file, finfo, dsize, 0
+
+ class openrsrc:
+ def __init__(self, *args):
+ pass
+
+ def read(self, *args):
+ return ''
+
+ def write(self, *args):
+ pass
+
+ def close(self):
+ pass
+
+class _Hqxcoderengine:
+ """Write data to the coder in 3-byte chunks"""
+
+ def __init__(self, ofp):
+ self.ofp = ofp
+ self.data = ''
+ self.hqxdata = ''
+ self.linelen = LINELEN-1
+
+ def write(self, data):
+ self.data = self.data + data
+ datalen = len(self.data)
+ todo = (datalen//3)*3
+ data = self.data[:todo]
+ self.data = self.data[todo:]
+ if not data:
+ return
+ self.hqxdata = self.hqxdata + binascii.b2a_hqx(data)
+ self._flush(0)
+
+ def _flush(self, force):
+ first = 0
+ while first <= len(self.hqxdata)-self.linelen:
+ last = first + self.linelen
+ self.ofp.write(self.hqxdata[first:last]+'\n')
+ self.linelen = LINELEN
+ first = last
+ self.hqxdata = self.hqxdata[first:]
+ if force:
+ self.ofp.write(self.hqxdata + ':\n')
+
+ def close(self):
+ if self.data:
+ self.hqxdata = \
+ self.hqxdata + binascii.b2a_hqx(self.data)
+ self._flush(1)
+ self.ofp.close()
+ del self.ofp
+
+class _Rlecoderengine:
+ """Write data to the RLE-coder in suitably large chunks"""
+
+ def __init__(self, ofp):
+ self.ofp = ofp
+ self.data = ''
+
+ def write(self, data):
+ self.data = self.data + data
+ if len(self.data) < REASONABLY_LARGE:
+ return
+ rledata = binascii.rlecode_hqx(self.data)
+ self.ofp.write(rledata)
+ self.data = ''
+
+ def close(self):
+ if self.data:
+ rledata = binascii.rlecode_hqx(self.data)
+ self.ofp.write(rledata)
+ self.ofp.close()
+ del self.ofp
+
+class BinHex:
+ def __init__(self, name_finfo_dlen_rlen, ofp):
+ name, finfo, dlen, rlen = name_finfo_dlen_rlen
+ if type(ofp) == type(''):
+ ofname = ofp
+ ofp = open(ofname, 'w')
+ ofp.write('(This file must be converted with BinHex 4.0)\n\n:')
+ hqxer = _Hqxcoderengine(ofp)
+ self.ofp = _Rlecoderengine(hqxer)
+ self.crc = 0
+ if finfo is None:
+ finfo = FInfo()
+ self.dlen = dlen
+ self.rlen = rlen
+ self._writeinfo(name, finfo)
+ self.state = _DID_HEADER
+
+ def _writeinfo(self, name, finfo):
+ nl = len(name)
+ if nl > 63:
+ raise Error, 'Filename too long'
+ d = chr(nl) + name + '\0'
+ d2 = finfo.Type + finfo.Creator
+
+ # Force all structs to be packed with big-endian
+ d3 = struct.pack('>h', finfo.Flags)
+ d4 = struct.pack('>ii', self.dlen, self.rlen)
+ info = d + d2 + d3 + d4
+ self._write(info)
+ self._writecrc()
+
+ def _write(self, data):
+ self.crc = binascii.crc_hqx(data, self.crc)
+ self.ofp.write(data)
+
+ def _writecrc(self):
+ # XXXX Should this be here??
+ # self.crc = binascii.crc_hqx('\0\0', self.crc)
+ if self.crc < 0:
+ fmt = '>h'
+ else:
+ fmt = '>H'
+ self.ofp.write(struct.pack(fmt, self.crc))
+ self.crc = 0
+
+ def write(self, data):
+ if self.state != _DID_HEADER:
+ raise Error, 'Writing data at the wrong time'
+ self.dlen = self.dlen - len(data)
+ self._write(data)
+
+ def close_data(self):
+ if self.dlen != 0:
+ raise Error, 'Incorrect data size, diff=%r' % (self.rlen,)
+ self._writecrc()
+ self.state = _DID_DATA
+
+ def write_rsrc(self, data):
+ if self.state < _DID_DATA:
+ self.close_data()
+ if self.state != _DID_DATA:
+ raise Error, 'Writing resource data at the wrong time'
+ self.rlen = self.rlen - len(data)
+ self._write(data)
+
+ def close(self):
+ if self.state is None:
+ return
+ try:
+ if self.state < _DID_DATA:
+ self.close_data()
+ if self.state != _DID_DATA:
+ raise Error, 'Close at the wrong time'
+ if self.rlen != 0:
+ raise Error, \
+ "Incorrect resource-datasize, diff=%r" % (self.rlen,)
+ self._writecrc()
+ finally:
+ self.state = None
+ ofp = self.ofp
+ del self.ofp
+ ofp.close()
+
+def binhex(inp, out):
+ """(infilename, outfilename) - Create binhex-encoded copy of a file"""
+ finfo = getfileinfo(inp)
+ ofp = BinHex(finfo, out)
+
+ ifp = open(inp, 'rb')
+ # XXXX Do textfile translation on non-mac systems
+ while 1:
+ d = ifp.read(128000)
+ if not d: break
+ ofp.write(d)
+ ofp.close_data()
+ ifp.close()
+
+ ifp = openrsrc(inp, 'rb')
+ while 1:
+ d = ifp.read(128000)
+ if not d: break
+ ofp.write_rsrc(d)
+ ofp.close()
+ ifp.close()
+
+class _Hqxdecoderengine:
+ """Read data via the decoder in 4-byte chunks"""
+
+ def __init__(self, ifp):
+ self.ifp = ifp
+ self.eof = 0
+
+ def read(self, totalwtd):
+ """Read at least wtd bytes (or until EOF)"""
+ decdata = ''
+ wtd = totalwtd
+ #
+ # The loop here is convoluted, since we don't really now how
+ # much to decode: there may be newlines in the incoming data.
+ while wtd > 0:
+ if self.eof: return decdata
+ wtd = ((wtd+2)//3)*4
+ data = self.ifp.read(wtd)
+ #
+ # Next problem: there may not be a complete number of
+ # bytes in what we pass to a2b. Solve by yet another
+ # loop.
+ #
+ while 1:
+ try:
+ decdatacur, self.eof = \
+ binascii.a2b_hqx(data)
+ break
+ except binascii.Incomplete:
+ pass
+ newdata = self.ifp.read(1)
+ if not newdata:
+ raise Error, \
+ 'Premature EOF on binhex file'
+ data = data + newdata
+ decdata = decdata + decdatacur
+ wtd = totalwtd - len(decdata)
+ if not decdata and not self.eof:
+ raise Error, 'Premature EOF on binhex file'
+ return decdata
+
+ def close(self):
+ self.ifp.close()
+
+class _Rledecoderengine:
+ """Read data via the RLE-coder"""
+
+ def __init__(self, ifp):
+ self.ifp = ifp
+ self.pre_buffer = ''
+ self.post_buffer = ''
+ self.eof = 0
+
+ def read(self, wtd):
+ if wtd > len(self.post_buffer):
+ self._fill(wtd-len(self.post_buffer))
+ rv = self.post_buffer[:wtd]
+ self.post_buffer = self.post_buffer[wtd:]
+ return rv
+
+ def _fill(self, wtd):
+ self.pre_buffer = self.pre_buffer + self.ifp.read(wtd+4)
+ if self.ifp.eof:
+ self.post_buffer = self.post_buffer + \
+ binascii.rledecode_hqx(self.pre_buffer)
+ self.pre_buffer = ''
+ return
+
+ #
+ # Obfuscated code ahead. We have to take care that we don't
+ # end up with an orphaned RUNCHAR later on. So, we keep a couple
+ # of bytes in the buffer, depending on what the end of
+ # the buffer looks like:
+ # '\220\0\220' - Keep 3 bytes: repeated \220 (escaped as \220\0)
+ # '?\220' - Keep 2 bytes: repeated something-else
+ # '\220\0' - Escaped \220: Keep 2 bytes.
+ # '?\220?' - Complete repeat sequence: decode all
+ # otherwise: keep 1 byte.
+ #
+ mark = len(self.pre_buffer)
+ if self.pre_buffer[-3:] == RUNCHAR + '\0' + RUNCHAR:
+ mark = mark - 3
+ elif self.pre_buffer[-1] == RUNCHAR:
+ mark = mark - 2
+ elif self.pre_buffer[-2:] == RUNCHAR + '\0':
+ mark = mark - 2
+ elif self.pre_buffer[-2] == RUNCHAR:
+ pass # Decode all
+ else:
+ mark = mark - 1
+
+ self.post_buffer = self.post_buffer + \
+ binascii.rledecode_hqx(self.pre_buffer[:mark])
+ self.pre_buffer = self.pre_buffer[mark:]
+
+ def close(self):
+ self.ifp.close()
+
+class HexBin:
+ def __init__(self, ifp):
+ if type(ifp) == type(''):
+ ifp = open(ifp)
+ #
+ # Find initial colon.
+ #
+ while 1:
+ ch = ifp.read(1)
+ if not ch:
+ raise Error, "No binhex data found"
+ # Cater for \r\n terminated lines (which show up as \n\r, hence
+ # all lines start with \r)
+ if ch == '\r':
+ continue
+ if ch == ':':
+ break
+ if ch != '\n':
+ dummy = ifp.readline()
+
+ hqxifp = _Hqxdecoderengine(ifp)
+ self.ifp = _Rledecoderengine(hqxifp)
+ self.crc = 0
+ self._readheader()
+
+ def _read(self, len):
+ data = self.ifp.read(len)
+ self.crc = binascii.crc_hqx(data, self.crc)
+ return data
+
+ def _checkcrc(self):
+ filecrc = struct.unpack('>h', self.ifp.read(2))[0] & 0xffff
+ #self.crc = binascii.crc_hqx('\0\0', self.crc)
+ # XXXX Is this needed??
+ self.crc = self.crc & 0xffff
+ if filecrc != self.crc:
+ raise Error, 'CRC error, computed %x, read %x' \
+ %(self.crc, filecrc)
+ self.crc = 0
+
+ def _readheader(self):
+ len = self._read(1)
+ fname = self._read(ord(len))
+ rest = self._read(1+4+4+2+4+4)
+ self._checkcrc()
+
+ type = rest[1:5]
+ creator = rest[5:9]
+ flags = struct.unpack('>h', rest[9:11])[0]
+ self.dlen = struct.unpack('>l', rest[11:15])[0]
+ self.rlen = struct.unpack('>l', rest[15:19])[0]
+
+ self.FName = fname
+ self.FInfo = FInfo()
+ self.FInfo.Creator = creator
+ self.FInfo.Type = type
+ self.FInfo.Flags = flags
+
+ self.state = _DID_HEADER
+
+ def read(self, *n):
+ if self.state != _DID_HEADER:
+ raise Error, 'Read data at wrong time'
+ if n:
+ n = n[0]
+ n = min(n, self.dlen)
+ else:
+ n = self.dlen
+ rv = ''
+ while len(rv) < n:
+ rv = rv + self._read(n-len(rv))
+ self.dlen = self.dlen - n
+ return rv
+
+ def close_data(self):
+ if self.state != _DID_HEADER:
+ raise Error, 'close_data at wrong time'
+ if self.dlen:
+ dummy = self._read(self.dlen)
+ self._checkcrc()
+ self.state = _DID_DATA
+
+ def read_rsrc(self, *n):
+ if self.state == _DID_HEADER:
+ self.close_data()
+ if self.state != _DID_DATA:
+ raise Error, 'Read resource data at wrong time'
+ if n:
+ n = n[0]
+ n = min(n, self.rlen)
+ else:
+ n = self.rlen
+ self.rlen = self.rlen - n
+ return self._read(n)
+
+ def close(self):
+ if self.state is None:
+ return
+ try:
+ if self.rlen:
+ dummy = self.read_rsrc(self.rlen)
+ self._checkcrc()
+ finally:
+ self.state = None
+ self.ifp.close()
+
+def hexbin(inp, out):
+ """(infilename, outfilename) - Decode binhexed file"""
+ ifp = HexBin(inp)
+ finfo = ifp.FInfo
+ if not out:
+ out = ifp.FName
+
+ ofp = open(out, 'wb')
+ # XXXX Do translation on non-mac systems
+ while 1:
+ d = ifp.read(128000)
+ if not d: break
+ ofp.write(d)
+ ofp.close()
+ ifp.close_data()
+
+ d = ifp.read_rsrc(128000)
+ if d:
+ ofp = openrsrc(out, 'wb')
+ ofp.write(d)
+ while 1:
+ d = ifp.read_rsrc(128000)
+ if not d: break
+ ofp.write(d)
+ ofp.close()
+
+ ifp.close()
+
+def _test():
+ fname = sys.argv[1]
+ binhex(fname, fname+'.hqx')
+ hexbin(fname+'.hqx', fname+'.viahqx')
+ #hexbin(fname, fname+'.unpacked')
+ sys.exit(1)
+
+if __name__ == '__main__':
+ _test()
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
index 0000000000..d1016d940f
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/bisect.py
@@ -0,0 +1,92 @@
+"""Bisection algorithms."""
+
+def insort_right(a, x, lo=0, hi=None):
+ """Insert item x in list a, and keep it sorted assuming a is sorted.
+
+ If x is already in a, insert it to the right of the rightmost x.
+
+ Optional args lo (default 0) and hi (default len(a)) bound the
+ slice of a to be searched.
+ """
+
+ if lo < 0:
+ raise ValueError('lo must be non-negative')
+ if hi is None:
+ hi = len(a)
+ while lo < hi:
+ mid = (lo+hi)//2
+ if x < a[mid]: hi = mid
+ else: lo = mid+1
+ a.insert(lo, x)
+
+insort = insort_right # backward compatibility
+
+def bisect_right(a, x, lo=0, hi=None):
+ """Return the index where to insert item x in list a, assuming a is sorted.
+
+ The return value i is such that all e in a[:i] have e <= x, and all e in
+ a[i:] have e > x. So if x already appears in the list, a.insert(x) will
+ insert just after the rightmost x already there.
+
+ Optional args lo (default 0) and hi (default len(a)) bound the
+ slice of a to be searched.
+ """
+
+ if lo < 0:
+ raise ValueError('lo must be non-negative')
+ if hi is None:
+ hi = len(a)
+ while lo < hi:
+ mid = (lo+hi)//2
+ if x < a[mid]: hi = mid
+ else: lo = mid+1
+ return lo
+
+bisect = bisect_right # backward compatibility
+
+def insort_left(a, x, lo=0, hi=None):
+ """Insert item x in list a, and keep it sorted assuming a is sorted.
+
+ If x is already in a, insert it to the left of the leftmost x.
+
+ Optional args lo (default 0) and hi (default len(a)) bound the
+ slice of a to be searched.
+ """
+
+ if lo < 0:
+ raise ValueError('lo must be non-negative')
+ if hi is None:
+ hi = len(a)
+ while lo < hi:
+ mid = (lo+hi)//2
+ if a[mid] < x: lo = mid+1
+ else: hi = mid
+ a.insert(lo, x)
+
+
+def bisect_left(a, x, lo=0, hi=None):
+ """Return the index where to insert item x in list a, assuming a is sorted.
+
+ The return value i is such that all e in a[:i] have e < x, and all e in
+ a[i:] have e >= x. So if x already appears in the list, a.insert(x) will
+ insert just before the leftmost x already there.
+
+ Optional args lo (default 0) and hi (default len(a)) bound the
+ slice of a to be searched.
+ """
+
+ if lo < 0:
+ raise ValueError('lo must be non-negative')
+ if hi is None:
+ hi = len(a)
+ while lo < hi:
+ mid = (lo+hi)//2
+ if a[mid] < x: lo = mid+1
+ else: hi = mid
+ return lo
+
+# Overwrite above definitions with a fast C implementation
+try:
+ from _bisect import *
+except ImportError:
+ pass
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
index 0000000000..f07cb712a5
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/calendar.py
@@ -0,0 +1,713 @@
+"""Calendar printing functions
+
+Note when comparing these calendars to the ones printed by cal(1): By
+default, these calendars have Monday as the first day of the week, and
+Sunday as the last (the European convention). Use setfirstweekday() to
+set the first day of the week (0=Monday, 6=Sunday)."""
+
+import sys
+import datetime
+import locale as _locale
+
+__all__ = ["IllegalMonthError", "IllegalWeekdayError", "setfirstweekday",
+ "firstweekday", "isleap", "leapdays", "weekday", "monthrange",
+ "monthcalendar", "prmonth", "month", "prcal", "calendar",
+ "timegm", "month_name", "month_abbr", "day_name", "day_abbr"]
+
+# Exception raised for bad input (with string parameter for details)
+error = ValueError
+
+# Exceptions raised for bad input
+class IllegalMonthError(ValueError):
+ def __init__(self, month):
+ self.month = month
+ def __str__(self):
+ return "bad month number %r; must be 1-12" % self.month
+
+
+class IllegalWeekdayError(ValueError):
+ def __init__(self, weekday):
+ self.weekday = weekday
+ def __str__(self):
+ return "bad weekday number %r; must be 0 (Monday) to 6 (Sunday)" % self.weekday
+
+
+# Constants for months referenced later
+January = 1
+February = 2
+
+# Number of days per month (except for February in leap years)
+mdays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
+
+# This module used to have hard-coded lists of day and month names, as
+# English strings. The classes following emulate a read-only version of
+# that, but supply localized names. Note that the values are computed
+# fresh on each call, in case the user changes locale between calls.
+
+class _localized_month:
+
+ _months = [datetime.date(2001, i+1, 1).strftime for i in range(12)]
+ _months.insert(0, lambda x: "")
+
+ def __init__(self, format):
+ self.format = format
+
+ def __getitem__(self, i):
+ funcs = self._months[i]
+ if isinstance(i, slice):
+ return [f(self.format) for f in funcs]
+ else:
+ return funcs(self.format)
+
+ def __len__(self):
+ return 13
+
+
+class _localized_day:
+
+ # January 1, 2001, was a Monday.
+ _days = [datetime.date(2001, 1, i+1).strftime for i in range(7)]
+
+ def __init__(self, format):
+ self.format = format
+
+ def __getitem__(self, i):
+ funcs = self._days[i]
+ if isinstance(i, slice):
+ return [f(self.format) for f in funcs]
+ else:
+ return funcs(self.format)
+
+ def __len__(self):
+ return 7
+
+
+# Full and abbreviated names of weekdays
+day_name = _localized_day('%A')
+day_abbr = _localized_day('%a')
+
+# Full and abbreviated names of months (1-based arrays!!!)
+month_name = _localized_month('%B')
+month_abbr = _localized_month('%b')
+
+# Constants for weekdays
+(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY) = range(7)
+
+
+def isleap(year):
+ """Return True for leap years, False for non-leap years."""
+ return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
+
+
+def leapdays(y1, y2):
+ """Return number of leap years in range [y1, y2).
+ Assume y1 <= y2."""
+ y1 -= 1
+ y2 -= 1
+ return (y2//4 - y1//4) - (y2//100 - y1//100) + (y2//400 - y1//400)
+
+
+def weekday(year, month, day):
+ """Return weekday (0-6 ~ Mon-Sun) for year (1970-...), month (1-12),
+ day (1-31)."""
+ return datetime.date(year, month, day).weekday()
+
+
+def monthrange(year, month):
+ """Return weekday (0-6 ~ Mon-Sun) and number of days (28-31) for
+ year, month."""
+ if not 1 <= month <= 12:
+ raise IllegalMonthError(month)
+ day1 = weekday(year, month, 1)
+ ndays = mdays[month] + (month == February and isleap(year))
+ return day1, ndays
+
+
+class Calendar(object):
+ """
+ Base calendar class. This class doesn't do any formatting. It simply
+ provides data to subclasses.
+ """
+
+ def __init__(self, firstweekday=0):
+ self.firstweekday = firstweekday # 0 = Monday, 6 = Sunday
+
+ def getfirstweekday(self):
+ return self._firstweekday % 7
+
+ def setfirstweekday(self, firstweekday):
+ self._firstweekday = firstweekday
+
+ firstweekday = property(getfirstweekday, setfirstweekday)
+
+ def iterweekdays(self):
+ """
+ Return a iterator for one week of weekday numbers starting with the
+ configured first one.
+ """
+ for i in range(self.firstweekday, self.firstweekday + 7):
+ yield i%7
+
+ def itermonthdates(self, year, month):
+ """
+ Return an iterator for one month. The iterator will yield datetime.date
+ values and will always iterate through complete weeks, so it will yield
+ dates outside the specified month.
+ """
+ date = datetime.date(year, month, 1)
+ # Go back to the beginning of the week
+ days = (date.weekday() - self.firstweekday) % 7
+ date -= datetime.timedelta(days=days)
+ oneday = datetime.timedelta(days=1)
+ while True:
+ yield date
+ try:
+ date += oneday
+ except OverflowError:
+ # Adding one day could fail after datetime.MAXYEAR
+ break
+ if date.month != month and date.weekday() == self.firstweekday:
+ break
+
+ def itermonthdays2(self, year, month):
+ """
+ Like itermonthdates(), but will yield (day number, weekday number)
+ tuples. For days outside the specified month the day number is 0.
+ """
+ for date in self.itermonthdates(year, month):
+ if date.month != month:
+ yield (0, date.weekday())
+ else:
+ yield (date.day, date.weekday())
+
+ def itermonthdays(self, year, month):
+ """
+ Like itermonthdates(), but will yield day numbers. For days outside
+ the specified month the day number is 0.
+ """
+ for date in self.itermonthdates(year, month):
+ if date.month != month:
+ yield 0
+ else:
+ yield date.day
+
+ def monthdatescalendar(self, year, month):
+ """
+ Return a matrix (list of lists) representing a month's calendar.
+ Each row represents a week; week entries are datetime.date values.
+ """
+ dates = list(self.itermonthdates(year, month))
+ return [ dates[i:i+7] for i in range(0, len(dates), 7) ]
+
+ def monthdays2calendar(self, year, month):
+ """
+ Return a matrix representing a month's calendar.
+ Each row represents a week; week entries are
+ (day number, weekday number) tuples. Day numbers outside this month
+ are zero.
+ """
+ days = list(self.itermonthdays2(year, month))
+ return [ days[i:i+7] for i in range(0, len(days), 7) ]
+
+ def monthdayscalendar(self, year, month):
+ """
+ Return a matrix representing a month's calendar.
+ Each row represents a week; days outside this month are zero.
+ """
+ days = list(self.itermonthdays(year, month))
+ return [ days[i:i+7] for i in range(0, len(days), 7) ]
+
+ def yeardatescalendar(self, year, width=3):
+ """
+ Return the data for the specified year ready for formatting. The return
+ value is a list of month rows. Each month row contains up to width months.
+ Each month contains between 4 and 6 weeks and each week contains 1-7
+ days. Days are datetime.date objects.
+ """
+ months = [
+ self.monthdatescalendar(year, i)
+ for i in range(January, January+12)
+ ]
+ return [months[i:i+width] for i in range(0, len(months), width) ]
+
+ def yeardays2calendar(self, year, width=3):
+ """
+ Return the data for the specified year ready for formatting (similar to
+ yeardatescalendar()). Entries in the week lists are
+ (day number, weekday number) tuples. Day numbers outside this month are
+ zero.
+ """
+ months = [
+ self.monthdays2calendar(year, i)
+ for i in range(January, January+12)
+ ]
+ return [months[i:i+width] for i in range(0, len(months), width) ]
+
+ def yeardayscalendar(self, year, width=3):
+ """
+ Return the data for the specified year ready for formatting (similar to
+ yeardatescalendar()). Entries in the week lists are day numbers.
+ Day numbers outside this month are zero.
+ """
+ months = [
+ self.monthdayscalendar(year, i)
+ for i in range(January, January+12)
+ ]
+ return [months[i:i+width] for i in range(0, len(months), width) ]
+
+
+class TextCalendar(Calendar):
+ """
+ Subclass of Calendar that outputs a calendar as a simple plain text
+ similar to the UNIX program cal.
+ """
+
+ def prweek(self, theweek, width):
+ """
+ Print a single week (no newline).
+ """
+ print self.formatweek(theweek, width),
+
+ def formatday(self, day, weekday, width):
+ """
+ Returns a formatted day.
+ """
+ if day == 0:
+ s = ''
+ else:
+ s = '%2i' % day # right-align single-digit days
+ return s.center(width)
+
+ def formatweek(self, theweek, width):
+ """
+ Returns a single week in a string (no newline).
+ """
+ return ' '.join(self.formatday(d, wd, width) for (d, wd) in theweek)
+
+ def formatweekday(self, day, width):
+ """
+ Returns a formatted week day name.
+ """
+ if width >= 9:
+ names = day_name
+ else:
+ names = day_abbr
+ return names[day][:width].center(width)
+
+ def formatweekheader(self, width):
+ """
+ Return a header for a week.
+ """
+ return ' '.join(self.formatweekday(i, width) for i in self.iterweekdays())
+
+ def formatmonthname(self, theyear, themonth, width, withyear=True):
+ """
+ Return a formatted month name.
+ """
+ s = month_name[themonth]
+ if withyear:
+ s = "%s %r" % (s, theyear)
+ return s.center(width)
+
+ def prmonth(self, theyear, themonth, w=0, l=0):
+ """
+ Print a month's calendar.
+ """
+ print self.formatmonth(theyear, themonth, w, l),
+
+ def formatmonth(self, theyear, themonth, w=0, l=0):
+ """
+ Return a month's calendar string (multi-line).
+ """
+ w = max(2, w)
+ l = max(1, l)
+ s = self.formatmonthname(theyear, themonth, 7 * (w + 1) - 1)
+ s = s.rstrip()
+ s += '\n' * l
+ s += self.formatweekheader(w).rstrip()
+ s += '\n' * l
+ for week in self.monthdays2calendar(theyear, themonth):
+ s += self.formatweek(week, w).rstrip()
+ s += '\n' * l
+ return s
+
+ def formatyear(self, theyear, w=2, l=1, c=6, m=3):
+ """
+ Returns a year's calendar as a multi-line string.
+ """
+ w = max(2, w)
+ l = max(1, l)
+ c = max(2, c)
+ colwidth = (w + 1) * 7 - 1
+ v = []
+ a = v.append
+ a(repr(theyear).center(colwidth*m+c*(m-1)).rstrip())
+ a('\n'*l)
+ header = self.formatweekheader(w)
+ for (i, row) in enumerate(self.yeardays2calendar(theyear, m)):
+ # months in this row
+ months = range(m*i+1, min(m*(i+1)+1, 13))
+ a('\n'*l)
+ names = (self.formatmonthname(theyear, k, colwidth, False)
+ for k in months)
+ a(formatstring(names, colwidth, c).rstrip())
+ a('\n'*l)
+ headers = (header for k in months)
+ a(formatstring(headers, colwidth, c).rstrip())
+ a('\n'*l)
+ # max number of weeks for this row
+ height = max(len(cal) for cal in row)
+ for j in range(height):
+ weeks = []
+ for cal in row:
+ if j >= len(cal):
+ weeks.append('')
+ else:
+ weeks.append(self.formatweek(cal[j], w))
+ a(formatstring(weeks, colwidth, c).rstrip())
+ a('\n' * l)
+ return ''.join(v)
+
+ def pryear(self, theyear, w=0, l=0, c=6, m=3):
+ """Print a year's calendar."""
+ print self.formatyear(theyear, w, l, c, m)
+
+
+class HTMLCalendar(Calendar):
+ """
+ This calendar returns complete HTML pages.
+ """
+
+ # CSS classes for the day <td>s
+ cssclasses = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]
+
+ def formatday(self, day, weekday):
+ """
+ Return a day as a table cell.
+ """
+ if day == 0:
+ return '<td class="noday">&nbsp;</td>' # day outside month
+ else:
+ return '<td class="%s">%d</td>' % (self.cssclasses[weekday], day)
+
+ def formatweek(self, theweek):
+ """
+ Return a complete week as a table row.
+ """
+ s = ''.join(self.formatday(d, wd) for (d, wd) in theweek)
+ return '<tr>%s</tr>' % s
+
+ def formatweekday(self, day):
+ """
+ Return a weekday name as a table header.
+ """
+ return '<th class="%s">%s</th>' % (self.cssclasses[day], day_abbr[day])
+
+ def formatweekheader(self):
+ """
+ Return a header for a week as a table row.
+ """
+ s = ''.join(self.formatweekday(i) for i in self.iterweekdays())
+ return '<tr>%s</tr>' % s
+
+ def formatmonthname(self, theyear, themonth, withyear=True):
+ """
+ Return a month name as a table row.
+ """
+ if withyear:
+ s = '%s %s' % (month_name[themonth], theyear)
+ else:
+ s = '%s' % month_name[themonth]
+ return '<tr><th colspan="7" class="month">%s</th></tr>' % s
+
+ def formatmonth(self, theyear, themonth, withyear=True):
+ """
+ Return a formatted month as a table.
+ """
+ v = []
+ a = v.append
+ a('<table border="0" cellpadding="0" cellspacing="0" class="month">')
+ a('\n')
+ a(self.formatmonthname(theyear, themonth, withyear=withyear))
+ a('\n')
+ a(self.formatweekheader())
+ a('\n')
+ for week in self.monthdays2calendar(theyear, themonth):
+ a(self.formatweek(week))
+ a('\n')
+ a('</table>')
+ a('\n')
+ return ''.join(v)
+
+ def formatyear(self, theyear, width=3):
+ """
+ Return a formatted year as a table of tables.
+ """
+ v = []
+ a = v.append
+ width = max(width, 1)
+ a('<table border="0" cellpadding="0" cellspacing="0" class="year">')
+ a('\n')
+ a('<tr><th colspan="%d" class="year">%s</th></tr>' % (width, theyear))
+ for i in range(January, January+12, width):
+ # months in this row
+ months = range(i, min(i+width, 13))
+ a('<tr>')
+ for m in months:
+ a('<td>')
+ a(self.formatmonth(theyear, m, withyear=False))
+ a('</td>')
+ a('</tr>')
+ a('</table>')
+ return ''.join(v)
+
+ def formatyearpage(self, theyear, width=3, css='calendar.css', encoding=None):
+ """
+ Return a formatted year as a complete HTML page.
+ """
+ if encoding is None:
+ encoding = sys.getdefaultencoding()
+ v = []
+ a = v.append
+ a('<?xml version="1.0" encoding="%s"?>\n' % encoding)
+ a('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n')
+ a('<html>\n')
+ a('<head>\n')
+ a('<meta http-equiv="Content-Type" content="text/html; charset=%s" />\n' % encoding)
+ if css is not None:
+ a('<link rel="stylesheet" type="text/css" href="%s" />\n' % css)
+ a('<title>Calendar for %d</title>\n' % theyear)
+ a('</head>\n')
+ a('<body>\n')
+ a(self.formatyear(theyear, width))
+ a('</body>\n')
+ a('</html>\n')
+ return ''.join(v).encode(encoding, "xmlcharrefreplace")
+
+
+class TimeEncoding:
+ def __init__(self, locale):
+ self.locale = locale
+
+ def __enter__(self):
+ self.oldlocale = _locale.getlocale(_locale.LC_TIME)
+ _locale.setlocale(_locale.LC_TIME, self.locale)
+ return _locale.getlocale(_locale.LC_TIME)[1]
+
+ def __exit__(self, *args):
+ _locale.setlocale(_locale.LC_TIME, self.oldlocale)
+
+
+class LocaleTextCalendar(TextCalendar):
+ """
+ This class can be passed a locale name in the constructor and will return
+ month and weekday names in the specified locale. If this locale includes
+ an encoding all strings containing month and weekday names will be returned
+ as unicode.
+ """
+
+ def __init__(self, firstweekday=0, locale=None):
+ TextCalendar.__init__(self, firstweekday)
+ if locale is None:
+ locale = _locale.getdefaultlocale()
+ self.locale = locale
+
+ def formatweekday(self, day, width):
+ with TimeEncoding(self.locale) as encoding:
+ if width >= 9:
+ names = day_name
+ else:
+ names = day_abbr
+ name = names[day]
+ if encoding is not None:
+ name = name.decode(encoding)
+ return name[:width].center(width)
+
+ def formatmonthname(self, theyear, themonth, width, withyear=True):
+ with TimeEncoding(self.locale) as encoding:
+ s = month_name[themonth]
+ if encoding is not None:
+ s = s.decode(encoding)
+ if withyear:
+ s = "%s %r" % (s, theyear)
+ return s.center(width)
+
+
+class LocaleHTMLCalendar(HTMLCalendar):
+ """
+ This class can be passed a locale name in the constructor and will return
+ month and weekday names in the specified locale. If this locale includes
+ an encoding all strings containing month and weekday names will be returned
+ as unicode.
+ """
+ def __init__(self, firstweekday=0, locale=None):
+ HTMLCalendar.__init__(self, firstweekday)
+ if locale is None:
+ locale = _locale.getdefaultlocale()
+ self.locale = locale
+
+ def formatweekday(self, day):
+ with TimeEncoding(self.locale) as encoding:
+ s = day_abbr[day]
+ if encoding is not None:
+ s = s.decode(encoding)
+ return '<th class="%s">%s</th>' % (self.cssclasses[day], s)
+
+ def formatmonthname(self, theyear, themonth, withyear=True):
+ with TimeEncoding(self.locale) as encoding:
+ s = month_name[themonth]
+ if encoding is not None:
+ s = s.decode(encoding)
+ if withyear:
+ s = '%s %s' % (s, theyear)
+ return '<tr><th colspan="7" class="month">%s</th></tr>' % s
+
+
+# Support for old module level interface
+c = TextCalendar()
+
+firstweekday = c.getfirstweekday
+
+def setfirstweekday(firstweekday):
+ try:
+ firstweekday.__index__
+ except AttributeError:
+ raise IllegalWeekdayError(firstweekday)
+ if not MONDAY <= firstweekday <= SUNDAY:
+ raise IllegalWeekdayError(firstweekday)
+ c.firstweekday = firstweekday
+
+monthcalendar = c.monthdayscalendar
+prweek = c.prweek
+week = c.formatweek
+weekheader = c.formatweekheader
+prmonth = c.prmonth
+month = c.formatmonth
+calendar = c.formatyear
+prcal = c.pryear
+
+
+# Spacing of month columns for multi-column year calendar
+_colwidth = 7*3 - 1 # Amount printed by prweek()
+_spacing = 6 # Number of spaces between columns
+
+
+def format(cols, colwidth=_colwidth, spacing=_spacing):
+ """Prints multi-column formatting for year calendars"""
+ print formatstring(cols, colwidth, spacing)
+
+
+def formatstring(cols, colwidth=_colwidth, spacing=_spacing):
+ """Returns a string formatted from n strings, centered within n columns."""
+ spacing *= ' '
+ return spacing.join(c.center(colwidth) for c in cols)
+
+
+EPOCH = 1970
+_EPOCH_ORD = datetime.date(EPOCH, 1, 1).toordinal()
+
+
+def timegm(tuple):
+ """Unrelated but handy function to calculate Unix timestamp from GMT."""
+ year, month, day, hour, minute, second = tuple[:6]
+ days = datetime.date(year, month, 1).toordinal() - _EPOCH_ORD + day - 1
+ hours = days*24 + hour
+ minutes = hours*60 + minute
+ seconds = minutes*60 + second
+ return seconds
+
+
+def main(args):
+ import optparse
+ parser = optparse.OptionParser(usage="usage: %prog [options] [year [month]]")
+ parser.add_option(
+ "-w", "--width",
+ dest="width", type="int", default=2,
+ help="width of date column (default 2, text only)"
+ )
+ parser.add_option(
+ "-l", "--lines",
+ dest="lines", type="int", default=1,
+ help="number of lines for each week (default 1, text only)"
+ )
+ parser.add_option(
+ "-s", "--spacing",
+ dest="spacing", type="int", default=6,
+ help="spacing between months (default 6, text only)"
+ )
+ parser.add_option(
+ "-m", "--months",
+ dest="months", type="int", default=3,
+ help="months per row (default 3, text only)"
+ )
+ parser.add_option(
+ "-c", "--css",
+ dest="css", default="calendar.css",
+ help="CSS to use for page (html only)"
+ )
+ parser.add_option(
+ "-L", "--locale",
+ dest="locale", default=None,
+ help="locale to be used from month and weekday names"
+ )
+ parser.add_option(
+ "-e", "--encoding",
+ dest="encoding", default=None,
+ help="Encoding to use for output"
+ )
+ parser.add_option(
+ "-t", "--type",
+ dest="type", default="text",
+ choices=("text", "html"),
+ help="output type (text or html)"
+ )
+
+ (options, args) = parser.parse_args(args)
+
+ if options.locale and not options.encoding:
+ parser.error("if --locale is specified --encoding is required")
+ sys.exit(1)
+
+ locale = options.locale, options.encoding
+
+ if options.type == "html":
+ if options.locale:
+ cal = LocaleHTMLCalendar(locale=locale)
+ else:
+ cal = HTMLCalendar()
+ encoding = options.encoding
+ if encoding is None:
+ encoding = sys.getdefaultencoding()
+ optdict = dict(encoding=encoding, css=options.css)
+ if len(args) == 1:
+ print cal.formatyearpage(datetime.date.today().year, **optdict)
+ elif len(args) == 2:
+ print cal.formatyearpage(int(args[1]), **optdict)
+ else:
+ parser.error("incorrect number of arguments")
+ sys.exit(1)
+ else:
+ if options.locale:
+ cal = LocaleTextCalendar(locale=locale)
+ else:
+ cal = TextCalendar()
+ optdict = dict(w=options.width, l=options.lines)
+ if len(args) != 3:
+ optdict["c"] = options.spacing
+ optdict["m"] = options.months
+ if len(args) == 1:
+ result = cal.formatyear(datetime.date.today().year, **optdict)
+ elif len(args) == 2:
+ result = cal.formatyear(int(args[1]), **optdict)
+ elif len(args) == 3:
+ result = cal.formatmonth(int(args[1]), int(args[2]), **optdict)
+ else:
+ parser.error("incorrect number of arguments")
+ sys.exit(1)
+ if options.encoding:
+ result = result.encode(options.encoding)
+ print result
+
+
+if __name__ == "__main__":
+ main(sys.argv)
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
index 0000000000..33a624c898
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/cmd.py
@@ -0,0 +1,404 @@
+"""A generic class to build line-oriented command interpreters.
+
+Interpreters constructed with this class obey the following conventions:
+
+1. End of file on input is processed as the command 'EOF'.
+2. A command is parsed out of each line by collecting the prefix composed
+ of characters in the identchars member.
+3. A command `foo' is dispatched to a method 'do_foo()'; the do_ method
+ is passed a single argument consisting of the remainder of the line.
+4. Typing an empty line repeats the last command. (Actually, it calls the
+ method `emptyline', which may be overridden in a subclass.)
+5. There is a predefined `help' method. Given an argument `topic', it
+ calls the command `help_topic'. With no arguments, it lists all topics
+ with defined help_ functions, broken into up to three topics; documented
+ commands, miscellaneous help topics, and undocumented commands.
+6. The command '?' is a synonym for `help'. The command '!' is a synonym
+ for `shell', if a do_shell method exists.
+7. If completion is enabled, completing commands will be done automatically,
+ and completing of commands args is done by calling complete_foo() with
+ arguments text, line, begidx, endidx. text is string we are matching
+ against, all returned matches must begin with it. line is the current
+ input line (lstripped), begidx and endidx are the beginning and end
+ indexes of the text being matched, which could be used to provide
+ different completion depending upon which position the argument is in.
+
+The `default' method may be overridden to intercept commands for which there
+is no do_ method.
+
+The `completedefault' method may be overridden to intercept completions for
+commands that have no complete_ method.
+
+The data member `self.ruler' sets the character used to draw separator lines
+in the help messages. If empty, no ruler line is drawn. It defaults to "=".
+
+If the value of `self.intro' is nonempty when the cmdloop method is called,
+it is printed out on interpreter startup. This value may be overridden
+via an optional argument to the cmdloop() method.
+
+The data members `self.doc_header', `self.misc_header', and
+`self.undoc_header' set the headers used for the help function's
+listings of documented functions, miscellaneous topics, and undocumented
+functions respectively.
+
+These interpreters use raw_input; thus, if the readline module is loaded,
+they automatically support Emacs-like command history and editing features.
+"""
+
+import string
+
+__all__ = ["Cmd"]
+
+PROMPT = '(Cmd) '
+IDENTCHARS = string.ascii_letters + string.digits + '_'
+
+class Cmd:
+ """A simple framework for writing line-oriented command interpreters.
+
+ These are often useful for test harnesses, administrative tools, and
+ prototypes that will later be wrapped in a more sophisticated interface.
+
+ A Cmd instance or subclass instance is a line-oriented interpreter
+ framework. There is no good reason to instantiate Cmd itself; rather,
+ it's useful as a superclass of an interpreter class you define yourself
+ in order to inherit Cmd's methods and encapsulate action methods.
+
+ """
+ prompt = PROMPT
+ identchars = IDENTCHARS
+ ruler = '='
+ lastcmd = ''
+ intro = None
+ doc_leader = ""
+ doc_header = "Documented commands (type help <topic>):"
+ misc_header = "Miscellaneous help topics:"
+ undoc_header = "Undocumented commands:"
+ nohelp = "*** No help on %s"
+ use_rawinput = 1
+
+ def __init__(self, completekey='tab', stdin=None, stdout=None):
+ """Instantiate a line-oriented interpreter framework.
+
+ The optional argument 'completekey' is the readline name of a
+ completion key; it defaults to the Tab key. If completekey is
+ not None and the readline module is available, command completion
+ is done automatically. The optional arguments stdin and stdout
+ specify alternate input and output file objects; if not specified,
+ sys.stdin and sys.stdout are used.
+
+ """
+ import sys
+ if stdin is not None:
+ self.stdin = stdin
+ else:
+ self.stdin = sys.stdin
+ if stdout is not None:
+ self.stdout = stdout
+ else:
+ self.stdout = sys.stdout
+ self.cmdqueue = []
+ self.completekey = completekey
+
+ def cmdloop(self, intro=None):
+ """Repeatedly issue a prompt, accept input, parse an initial prefix
+ off the received input, and dispatch to action methods, passing them
+ the remainder of the line as argument.
+
+ """
+
+ self.preloop()
+ if self.use_rawinput and self.completekey:
+ try:
+ import readline
+ self.old_completer = readline.get_completer()
+ readline.set_completer(self.complete)
+ readline.parse_and_bind(self.completekey+": complete")
+ except ImportError:
+ pass
+ try:
+ if intro is not None:
+ self.intro = intro
+ if self.intro:
+ self.stdout.write(str(self.intro)+"\n")
+ stop = None
+ while not stop:
+ if self.cmdqueue:
+ line = self.cmdqueue.pop(0)
+ else:
+ if self.use_rawinput:
+ try:
+ line = raw_input(self.prompt)
+ except EOFError:
+ line = 'EOF'
+ else:
+ self.stdout.write(self.prompt)
+ self.stdout.flush()
+ line = self.stdin.readline()
+ if not len(line):
+ line = 'EOF'
+ else:
+ line = line.rstrip('\r\n')
+ line = self.precmd(line)
+ stop = self.onecmd(line)
+ stop = self.postcmd(stop, line)
+ self.postloop()
+ finally:
+ if self.use_rawinput and self.completekey:
+ try:
+ import readline
+ readline.set_completer(self.old_completer)
+ except ImportError:
+ pass
+
+
+ def precmd(self, line):
+ """Hook method executed just before the command line is
+ interpreted, but after the input prompt is generated and issued.
+
+ """
+ return line
+
+ def postcmd(self, stop, line):
+ """Hook method executed just after a command dispatch is finished."""
+ return stop
+
+ def preloop(self):
+ """Hook method executed once when the cmdloop() method is called."""
+ pass
+
+ def postloop(self):
+ """Hook method executed once when the cmdloop() method is about to
+ return.
+
+ """
+ pass
+
+ def parseline(self, line):
+ """Parse the line into a command name and a string containing
+ the arguments. Returns a tuple containing (command, args, line).
+ 'command' and 'args' may be None if the line couldn't be parsed.
+ """
+ line = line.strip()
+ if not line:
+ return None, None, line
+ elif line[0] == '?':
+ line = 'help ' + line[1:]
+ elif line[0] == '!':
+ if hasattr(self, 'do_shell'):
+ line = 'shell ' + line[1:]
+ else:
+ return None, None, line
+ i, n = 0, len(line)
+ while i < n and line[i] in self.identchars: i = i+1
+ cmd, arg = line[:i], line[i:].strip()
+ return cmd, arg, line
+
+ def onecmd(self, line):
+ """Interpret the argument as though it had been typed in response
+ to the prompt.
+
+ This may be overridden, but should not normally need to be;
+ see the precmd() and postcmd() methods for useful execution hooks.
+ The return value is a flag indicating whether interpretation of
+ commands by the interpreter should stop.
+
+ """
+ cmd, arg, line = self.parseline(line)
+ if not line:
+ return self.emptyline()
+ if cmd is None:
+ return self.default(line)
+ self.lastcmd = line
+ if line == 'EOF' :
+ self.lastcmd = ''
+ if cmd == '':
+ return self.default(line)
+ else:
+ try:
+ func = getattr(self, 'do_' + cmd)
+ except AttributeError:
+ return self.default(line)
+ return func(arg)
+
+ def emptyline(self):
+ """Called when an empty line is entered in response to the prompt.
+
+ If this method is not overridden, it repeats the last nonempty
+ command entered.
+
+ """
+ if self.lastcmd:
+ return self.onecmd(self.lastcmd)
+
+ def default(self, line):
+ """Called on an input line when the command prefix is not recognized.
+
+ If this method is not overridden, it prints an error message and
+ returns.
+
+ """
+ self.stdout.write('*** Unknown syntax: %s\n'%line)
+
+ def completedefault(self, *ignored):
+ """Method called to complete an input line when no command-specific
+ complete_*() method is available.
+
+ By default, it returns an empty list.
+
+ """
+ return []
+
+ def completenames(self, text, *ignored):
+ dotext = 'do_'+text
+ return [a[3:] for a in self.get_names() if a.startswith(dotext)]
+
+ def complete(self, text, state):
+ """Return the next possible completion for 'text'.
+
+ If a command has not been entered, then complete against command list.
+ Otherwise try to call complete_<command> to get list of completions.
+ """
+ if state == 0:
+ import readline
+ origline = readline.get_line_buffer()
+ line = origline.lstrip()
+ stripped = len(origline) - len(line)
+ begidx = readline.get_begidx() - stripped
+ endidx = readline.get_endidx() - stripped
+ if begidx>0:
+ cmd, args, foo = self.parseline(line)
+ if cmd == '':
+ compfunc = self.completedefault
+ else:
+ try:
+ compfunc = getattr(self, 'complete_' + cmd)
+ except AttributeError:
+ compfunc = self.completedefault
+ else:
+ compfunc = self.completenames
+ self.completion_matches = compfunc(text, line, begidx, endidx)
+ try:
+ return self.completion_matches[state]
+ except IndexError:
+ return None
+
+ def get_names(self):
+ # This method used to pull in base class attributes
+ # at a time dir() didn't do it yet.
+ return dir(self.__class__)
+
+ def complete_help(self, *args):
+ commands = set(self.completenames(*args))
+ topics = set(a[5:] for a in self.get_names()
+ if a.startswith('help_' + args[0]))
+ return list(commands | topics)
+
+ def do_help(self, arg):
+ 'List available commands with "help" or detailed help with "help cmd".'
+ if arg:
+ # XXX check arg syntax
+ try:
+ func = getattr(self, 'help_' + arg)
+ except AttributeError:
+ try:
+ doc=getattr(self, 'do_' + arg).__doc__
+ if doc:
+ self.stdout.write("%s\n"%str(doc))
+ return
+ except AttributeError:
+ pass
+ self.stdout.write("%s\n"%str(self.nohelp % (arg,)))
+ return
+ func()
+ else:
+ names = self.get_names()
+ cmds_doc = []
+ cmds_undoc = []
+ help = {}
+ for name in names:
+ if name[:5] == 'help_':
+ help[name[5:]]=1
+ names.sort()
+ # There can be duplicates if routines overridden
+ prevname = ''
+ for name in names:
+ if name[:3] == 'do_':
+ if name == prevname:
+ continue
+ prevname = name
+ cmd=name[3:]
+ if cmd in help:
+ cmds_doc.append(cmd)
+ del help[cmd]
+ elif getattr(self, name).__doc__:
+ cmds_doc.append(cmd)
+ else:
+ cmds_undoc.append(cmd)
+ self.stdout.write("%s\n"%str(self.doc_leader))
+ self.print_topics(self.doc_header, cmds_doc, 15,80)
+ self.print_topics(self.misc_header, help.keys(),15,80)
+ self.print_topics(self.undoc_header, cmds_undoc, 15,80)
+
+ def print_topics(self, header, cmds, cmdlen, maxcol):
+ if cmds:
+ self.stdout.write("%s\n"%str(header))
+ if self.ruler:
+ self.stdout.write("%s\n"%str(self.ruler * len(header)))
+ self.columnize(cmds, maxcol-1)
+ self.stdout.write("\n")
+
+ def columnize(self, list, displaywidth=80):
+ """Display a list of strings as a compact set of columns.
+
+ Each column is only as wide as necessary.
+ Columns are separated by two spaces (one was not legible enough).
+ """
+ if not list:
+ self.stdout.write("<empty>\n")
+ return
+ nonstrings = [i for i in range(len(list))
+ if not isinstance(list[i], str)]
+ if nonstrings:
+ raise TypeError, ("list[i] not a string for i in %s" %
+ ", ".join(map(str, nonstrings)))
+ size = len(list)
+ if size == 1:
+ self.stdout.write('%s\n'%str(list[0]))
+ return
+ # Try every row count from 1 upwards
+ for nrows in range(1, len(list)):
+ ncols = (size+nrows-1) // nrows
+ colwidths = []
+ totwidth = -2
+ for col in range(ncols):
+ colwidth = 0
+ for row in range(nrows):
+ i = row + nrows*col
+ if i >= size:
+ break
+ x = list[i]
+ colwidth = max(colwidth, len(x))
+ colwidths.append(colwidth)
+ totwidth += colwidth + 2
+ if totwidth > displaywidth:
+ break
+ if totwidth <= displaywidth:
+ break
+ else:
+ nrows = len(list)
+ ncols = 1
+ colwidths = [0]
+ for row in range(nrows):
+ texts = []
+ for col in range(ncols):
+ i = row + nrows*col
+ if i >= size:
+ x = ""
+ else:
+ x = list[i]
+ texts.append(x)
+ while texts and not texts[-1]:
+ del texts[-1]
+ for col in range(len(texts)):
+ texts[col] = texts[col].ljust(colwidths[col])
+ self.stdout.write("%s\n"%str(" ".join(texts)))
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
index 0000000000..452bf2fa88
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/codecs.py
@@ -0,0 +1,1101 @@
+""" codecs -- Python Codec Registry, API and helpers.
+
+
+Written by Marc-Andre Lemburg (mal@lemburg.com).
+
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
+
+"""#"
+
+import __builtin__, sys
+
+### Registry and builtin stateless codec functions
+
+try:
+ from _codecs import *
+except ImportError, why:
+ raise SystemError('Failed to load the builtin codecs: %s' % why)
+
+__all__ = ["register", "lookup", "open", "EncodedFile", "BOM", "BOM_BE",
+ "BOM_LE", "BOM32_BE", "BOM32_LE", "BOM64_BE", "BOM64_LE",
+ "BOM_UTF8", "BOM_UTF16", "BOM_UTF16_LE", "BOM_UTF16_BE",
+ "BOM_UTF32", "BOM_UTF32_LE", "BOM_UTF32_BE",
+ "CodecInfo", "Codec", "IncrementalEncoder", "IncrementalDecoder",
+ "StreamReader", "StreamWriter",
+ "StreamReaderWriter", "StreamRecoder",
+ "getencoder", "getdecoder", "getincrementalencoder",
+ "getincrementaldecoder", "getreader", "getwriter",
+ "encode", "decode", "iterencode", "iterdecode",
+ "strict_errors", "ignore_errors", "replace_errors",
+ "xmlcharrefreplace_errors", "backslashreplace_errors",
+ "register_error", "lookup_error"]
+
+### Constants
+
+#
+# Byte Order Mark (BOM = ZERO WIDTH NO-BREAK SPACE = U+FEFF)
+# and its possible byte string values
+# for UTF8/UTF16/UTF32 output and little/big endian machines
+#
+
+# UTF-8
+BOM_UTF8 = '\xef\xbb\xbf'
+
+# UTF-16, little endian
+BOM_LE = BOM_UTF16_LE = '\xff\xfe'
+
+# UTF-16, big endian
+BOM_BE = BOM_UTF16_BE = '\xfe\xff'
+
+# UTF-32, little endian
+BOM_UTF32_LE = '\xff\xfe\x00\x00'
+
+# UTF-32, big endian
+BOM_UTF32_BE = '\x00\x00\xfe\xff'
+
+if sys.byteorder == 'little':
+
+ # UTF-16, native endianness
+ BOM = BOM_UTF16 = BOM_UTF16_LE
+
+ # UTF-32, native endianness
+ BOM_UTF32 = BOM_UTF32_LE
+
+else:
+
+ # UTF-16, native endianness
+ BOM = BOM_UTF16 = BOM_UTF16_BE
+
+ # UTF-32, native endianness
+ BOM_UTF32 = BOM_UTF32_BE
+
+# Old broken names (don't use in new code)
+BOM32_LE = BOM_UTF16_LE
+BOM32_BE = BOM_UTF16_BE
+BOM64_LE = BOM_UTF32_LE
+BOM64_BE = BOM_UTF32_BE
+
+
+### Codec base classes (defining the API)
+
+class CodecInfo(tuple):
+
+ def __new__(cls, encode, decode, streamreader=None, streamwriter=None,
+ incrementalencoder=None, incrementaldecoder=None, name=None):
+ self = tuple.__new__(cls, (encode, decode, streamreader, streamwriter))
+ self.name = name
+ self.encode = encode
+ self.decode = decode
+ self.incrementalencoder = incrementalencoder
+ self.incrementaldecoder = incrementaldecoder
+ self.streamwriter = streamwriter
+ self.streamreader = streamreader
+ return self
+
+ def __repr__(self):
+ return "<%s.%s object for encoding %s at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, id(self))
+
+class Codec:
+
+ """ Defines the interface for stateless encoders/decoders.
+
+ The .encode()/.decode() methods may use different error
+ handling schemes by providing the errors argument. These
+ string values are predefined:
+
+ 'strict' - raise a ValueError error (or a subclass)
+ 'ignore' - ignore the character and continue with the next
+ 'replace' - replace with a suitable replacement character;
+ Python will use the official U+FFFD REPLACEMENT
+ CHARACTER for the builtin Unicode codecs on
+ decoding and '?' on encoding.
+ 'xmlcharrefreplace' - Replace with the appropriate XML
+ character reference (only for encoding).
+ 'backslashreplace' - Replace with backslashed escape sequences
+ (only for encoding).
+
+ The set of allowed values can be extended via register_error.
+
+ """
+ def encode(self, input, errors='strict'):
+
+ """ Encodes the object input and returns a tuple (output
+ object, length consumed).
+
+ errors defines the error handling to apply. It defaults to
+ 'strict' handling.
+
+ The method may not store state in the Codec instance. Use
+ StreamCodec for codecs which have to keep state in order to
+ make encoding/decoding efficient.
+
+ The encoder must be able to handle zero length input and
+ return an empty object of the output object type in this
+ situation.
+
+ """
+ raise NotImplementedError
+
+ def decode(self, input, errors='strict'):
+
+ """ Decodes the object input and returns a tuple (output
+ object, length consumed).
+
+ input must be an object which provides the bf_getreadbuf
+ buffer slot. Python strings, buffer objects and memory
+ mapped files are examples of objects providing this slot.
+
+ errors defines the error handling to apply. It defaults to
+ 'strict' handling.
+
+ The method may not store state in the Codec instance. Use
+ StreamCodec for codecs which have to keep state in order to
+ make encoding/decoding efficient.
+
+ The decoder must be able to handle zero length input and
+ return an empty object of the output object type in this
+ situation.
+
+ """
+ raise NotImplementedError
+
+class IncrementalEncoder(object):
+ """
+ An IncrementalEncoder encodes an input in multiple steps. The input can be
+ passed piece by piece to the encode() method. The IncrementalEncoder remembers
+ the state of the Encoding process between calls to encode().
+ """
+ def __init__(self, errors='strict'):
+ """
+ Creates an IncrementalEncoder instance.
+
+ The IncrementalEncoder may use different error handling schemes by
+ providing the errors keyword argument. See the module docstring
+ for a list of possible values.
+ """
+ self.errors = errors
+ self.buffer = ""
+
+ def encode(self, input, final=False):
+ """
+ Encodes input and returns the resulting object.
+ """
+ raise NotImplementedError
+
+ def reset(self):
+ """
+ Resets the encoder to the initial state.
+ """
+
+ def getstate(self):
+ """
+ Return the current state of the encoder.
+ """
+ return 0
+
+ def setstate(self, state):
+ """
+ Set the current state of the encoder. state must have been
+ returned by getstate().
+ """
+
+class BufferedIncrementalEncoder(IncrementalEncoder):
+ """
+ This subclass of IncrementalEncoder can be used as the baseclass for an
+ incremental encoder if the encoder must keep some of the output in a
+ buffer between calls to encode().
+ """
+ def __init__(self, errors='strict'):
+ IncrementalEncoder.__init__(self, errors)
+ self.buffer = "" # unencoded input that is kept between calls to encode()
+
+ def _buffer_encode(self, input, errors, final):
+ # Overwrite this method in subclasses: It must encode input
+ # and return an (output, length consumed) tuple
+ raise NotImplementedError
+
+ def encode(self, input, final=False):
+ # encode input (taking the buffer into account)
+ data = self.buffer + input
+ (result, consumed) = self._buffer_encode(data, self.errors, final)
+ # keep unencoded input until the next call
+ self.buffer = data[consumed:]
+ return result
+
+ def reset(self):
+ IncrementalEncoder.reset(self)
+ self.buffer = ""
+
+ def getstate(self):
+ return self.buffer or 0
+
+ def setstate(self, state):
+ self.buffer = state or ""
+
+class IncrementalDecoder(object):
+ """
+ An IncrementalDecoder decodes an input in multiple steps. The input can be
+ passed piece by piece to the decode() method. The IncrementalDecoder
+ remembers the state of the decoding process between calls to decode().
+ """
+ def __init__(self, errors='strict'):
+ """
+ Creates a IncrementalDecoder instance.
+
+ The IncrementalDecoder may use different error handling schemes by
+ providing the errors keyword argument. See the module docstring
+ for a list of possible values.
+ """
+ self.errors = errors
+
+ def decode(self, input, final=False):
+ """
+ Decodes input and returns the resulting object.
+ """
+ raise NotImplementedError
+
+ def reset(self):
+ """
+ Resets the decoder to the initial state.
+ """
+
+ def getstate(self):
+ """
+ Return the current state of the decoder.
+
+ This must be a (buffered_input, additional_state_info) tuple.
+ buffered_input must be a bytes object containing bytes that
+ were passed to decode() that have not yet been converted.
+ additional_state_info must be a non-negative integer
+ representing the state of the decoder WITHOUT yet having
+ processed the contents of buffered_input. In the initial state
+ and after reset(), getstate() must return (b"", 0).
+ """
+ return (b"", 0)
+
+ def setstate(self, state):
+ """
+ Set the current state of the decoder.
+
+ state must have been returned by getstate(). The effect of
+ setstate((b"", 0)) must be equivalent to reset().
+ """
+
+class BufferedIncrementalDecoder(IncrementalDecoder):
+ """
+ This subclass of IncrementalDecoder can be used as the baseclass for an
+ incremental decoder if the decoder must be able to handle incomplete byte
+ sequences.
+ """
+ def __init__(self, errors='strict'):
+ IncrementalDecoder.__init__(self, errors)
+ self.buffer = "" # undecoded input that is kept between calls to decode()
+
+ def _buffer_decode(self, input, errors, final):
+ # Overwrite this method in subclasses: It must decode input
+ # and return an (output, length consumed) tuple
+ raise NotImplementedError
+
+ def decode(self, input, final=False):
+ # decode input (taking the buffer into account)
+ data = self.buffer + input
+ (result, consumed) = self._buffer_decode(data, self.errors, final)
+ # keep undecoded input until the next call
+ self.buffer = data[consumed:]
+ return result
+
+ def reset(self):
+ IncrementalDecoder.reset(self)
+ self.buffer = ""
+
+ def getstate(self):
+ # additional state info is always 0
+ return (self.buffer, 0)
+
+ def setstate(self, state):
+ # ignore additional state info
+ self.buffer = state[0]
+
+#
+# The StreamWriter and StreamReader class provide generic working
+# interfaces which can be used to implement new encoding submodules
+# very easily. See encodings/utf_8.py for an example on how this is
+# done.
+#
+
+class StreamWriter(Codec):
+
+ def __init__(self, stream, errors='strict'):
+
+ """ Creates a StreamWriter instance.
+
+ stream must be a file-like object open for writing
+ (binary) data.
+
+ The StreamWriter may use different error handling
+ schemes by providing the errors keyword argument. These
+ parameters are predefined:
+
+ 'strict' - raise a ValueError (or a subclass)
+ 'ignore' - ignore the character and continue with the next
+ 'replace'- replace with a suitable replacement character
+ 'xmlcharrefreplace' - Replace with the appropriate XML
+ character reference.
+ 'backslashreplace' - Replace with backslashed escape
+ sequences (only for encoding).
+
+ The set of allowed parameter values can be extended via
+ register_error.
+ """
+ self.stream = stream
+ self.errors = errors
+
+ def write(self, object):
+
+ """ Writes the object's contents encoded to self.stream.
+ """
+ data, consumed = self.encode(object, self.errors)
+ self.stream.write(data)
+
+ def writelines(self, list):
+
+ """ Writes the concatenated list of strings to the stream
+ using .write().
+ """
+ self.write(''.join(list))
+
+ def reset(self):
+
+ """ Flushes and resets the codec buffers used for keeping state.
+
+ Calling this method should ensure that the data on the
+ output is put into a clean state, that allows appending
+ of new fresh data without having to rescan the whole
+ stream to recover state.
+
+ """
+ pass
+
+ def seek(self, offset, whence=0):
+ self.stream.seek(offset, whence)
+ if whence == 0 and offset == 0:
+ self.reset()
+
+ def __getattr__(self, name,
+ getattr=getattr):
+
+ """ Inherit all other methods from the underlying stream.
+ """
+ return getattr(self.stream, name)
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, type, value, tb):
+ self.stream.close()
+
+###
+
+class StreamReader(Codec):
+
+ def __init__(self, stream, errors='strict'):
+
+ """ Creates a StreamReader instance.
+
+ stream must be a file-like object open for reading
+ (binary) data.
+
+ The StreamReader may use different error handling
+ schemes by providing the errors keyword argument. These
+ parameters are predefined:
+
+ 'strict' - raise a ValueError (or a subclass)
+ 'ignore' - ignore the character and continue with the next
+ 'replace'- replace with a suitable replacement character;
+
+ The set of allowed parameter values can be extended via
+ register_error.
+ """
+ self.stream = stream
+ self.errors = errors
+ self.bytebuffer = ""
+ # For str->str decoding this will stay a str
+ # For str->unicode decoding the first read will promote it to unicode
+ self.charbuffer = ""
+ self.linebuffer = None
+
+ def decode(self, input, errors='strict'):
+ raise NotImplementedError
+
+ def read(self, size=-1, chars=-1, firstline=False):
+
+ """ Decodes data from the stream self.stream and returns the
+ resulting object.
+
+ chars indicates the number of characters to read from the
+ stream. read() will never return more than chars
+ characters, but it might return less, if there are not enough
+ characters available.
+
+ size indicates the approximate maximum number of bytes to
+ read from the stream for decoding purposes. The decoder
+ can modify this setting as appropriate. The default value
+ -1 indicates to read and decode as much as possible. size
+ is intended to prevent having to decode huge files in one
+ step.
+
+ If firstline is true, and a UnicodeDecodeError happens
+ after the first line terminator in the input only the first line
+ will be returned, the rest of the input will be kept until the
+ next call to read().
+
+ The method should use a greedy read strategy meaning that
+ it should read as much data as is allowed within the
+ definition of the encoding and the given size, e.g. if
+ optional encoding endings or state markers are available
+ on the stream, these should be read too.
+ """
+ # If we have lines cached, first merge them back into characters
+ if self.linebuffer:
+ self.charbuffer = "".join(self.linebuffer)
+ self.linebuffer = None
+
+ # read until we get the required number of characters (if available)
+ while True:
+ # can the request be satisfied from the character buffer?
+ if chars >= 0:
+ if len(self.charbuffer) >= chars:
+ break
+ elif size >= 0:
+ if len(self.charbuffer) >= size:
+ break
+ # we need more data
+ if size < 0:
+ newdata = self.stream.read()
+ else:
+ newdata = self.stream.read(size)
+ # decode bytes (those remaining from the last call included)
+ data = self.bytebuffer + newdata
+ try:
+ newchars, decodedbytes = self.decode(data, self.errors)
+ except UnicodeDecodeError, exc:
+ if firstline:
+ newchars, decodedbytes = self.decode(data[:exc.start], self.errors)
+ lines = newchars.splitlines(True)
+ if len(lines)<=1:
+ raise
+ else:
+ raise
+ # keep undecoded bytes until the next call
+ self.bytebuffer = data[decodedbytes:]
+ # put new characters in the character buffer
+ self.charbuffer += newchars
+ # there was no data available
+ if not newdata:
+ break
+ if chars < 0:
+ # Return everything we've got
+ result = self.charbuffer
+ self.charbuffer = ""
+ else:
+ # Return the first chars characters
+ result = self.charbuffer[:chars]
+ self.charbuffer = self.charbuffer[chars:]
+ return result
+
+ def readline(self, size=None, keepends=True):
+
+ """ Read one line from the input stream and return the
+ decoded data.
+
+ size, if given, is passed as size argument to the
+ read() method.
+
+ """
+ # If we have lines cached from an earlier read, return
+ # them unconditionally
+ if self.linebuffer:
+ line = self.linebuffer[0]
+ del self.linebuffer[0]
+ if len(self.linebuffer) == 1:
+ # revert to charbuffer mode; we might need more data
+ # next time
+ self.charbuffer = self.linebuffer[0]
+ self.linebuffer = None
+ if not keepends:
+ line = line.splitlines(False)[0]
+ return line
+
+ readsize = size or 72
+ line = ""
+ # If size is given, we call read() only once
+ while True:
+ data = self.read(readsize, firstline=True)
+ if data:
+ # If we're at a "\r" read one extra character (which might
+ # be a "\n") to get a proper line ending. If the stream is
+ # temporarily exhausted we return the wrong line ending.
+ if data.endswith("\r"):
+ data += self.read(size=1, chars=1)
+
+ line += data
+ lines = line.splitlines(True)
+ if lines:
+ if len(lines) > 1:
+ # More than one line result; the first line is a full line
+ # to return
+ line = lines[0]
+ del lines[0]
+ if len(lines) > 1:
+ # cache the remaining lines
+ lines[-1] += self.charbuffer
+ self.linebuffer = lines
+ self.charbuffer = None
+ else:
+ # only one remaining line, put it back into charbuffer
+ self.charbuffer = lines[0] + self.charbuffer
+ if not keepends:
+ line = line.splitlines(False)[0]
+ break
+ line0withend = lines[0]
+ line0withoutend = lines[0].splitlines(False)[0]
+ if line0withend != line0withoutend: # We really have a line end
+ # Put the rest back together and keep it until the next call
+ self.charbuffer = "".join(lines[1:]) + self.charbuffer
+ if keepends:
+ line = line0withend
+ else:
+ line = line0withoutend
+ break
+ # we didn't get anything or this was our only try
+ if not data or size is not None:
+ if line and not keepends:
+ line = line.splitlines(False)[0]
+ break
+ if readsize<8000:
+ readsize *= 2
+ return line
+
+ def readlines(self, sizehint=None, keepends=True):
+
+ """ Read all lines available on the input stream
+ and return them as list of lines.
+
+ Line breaks are implemented using the codec's decoder
+ method and are included in the list entries.
+
+ sizehint, if given, is ignored since there is no efficient
+ way to finding the true end-of-line.
+
+ """
+ data = self.read()
+ return data.splitlines(keepends)
+
+ def reset(self):
+
+ """ Resets the codec buffers used for keeping state.
+
+ Note that no stream repositioning should take place.
+ This method is primarily intended to be able to recover
+ from decoding errors.
+
+ """
+ self.bytebuffer = ""
+ self.charbuffer = u""
+ self.linebuffer = None
+
+ def seek(self, offset, whence=0):
+ """ Set the input stream's current position.
+
+ Resets the codec buffers used for keeping state.
+ """
+ self.stream.seek(offset, whence)
+ self.reset()
+
+ def next(self):
+
+ """ Return the next decoded line from the input stream."""
+ line = self.readline()
+ if line:
+ return line
+ raise StopIteration
+
+ def __iter__(self):
+ return self
+
+ def __getattr__(self, name,
+ getattr=getattr):
+
+ """ Inherit all other methods from the underlying stream.
+ """
+ return getattr(self.stream, name)
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, type, value, tb):
+ self.stream.close()
+
+###
+
+class StreamReaderWriter:
+
+ """ StreamReaderWriter instances allow wrapping streams which
+ work in both read and write modes.
+
+ The design is such that one can use the factory functions
+ returned by the codec.lookup() function to construct the
+ instance.
+
+ """
+ # Optional attributes set by the file wrappers below
+ encoding = 'unknown'
+
+ def __init__(self, stream, Reader, Writer, errors='strict'):
+
+ """ Creates a StreamReaderWriter instance.
+
+ stream must be a Stream-like object.
+
+ Reader, Writer must be factory functions or classes
+ providing the StreamReader, StreamWriter interface resp.
+
+ Error handling is done in the same way as defined for the
+ StreamWriter/Readers.
+
+ """
+ self.stream = stream
+ self.reader = Reader(stream, errors)
+ self.writer = Writer(stream, errors)
+ self.errors = errors
+
+ def read(self, size=-1):
+
+ return self.reader.read(size)
+
+ def readline(self, size=None):
+
+ return self.reader.readline(size)
+
+ def readlines(self, sizehint=None):
+
+ return self.reader.readlines(sizehint)
+
+ def next(self):
+
+ """ Return the next decoded line from the input stream."""
+ return self.reader.next()
+
+ def __iter__(self):
+ return self
+
+ def write(self, data):
+
+ return self.writer.write(data)
+
+ def writelines(self, list):
+
+ return self.writer.writelines(list)
+
+ def reset(self):
+
+ self.reader.reset()
+ self.writer.reset()
+
+ def seek(self, offset, whence=0):
+ self.stream.seek(offset, whence)
+ self.reader.reset()
+ if whence == 0 and offset == 0:
+ self.writer.reset()
+
+ def __getattr__(self, name,
+ getattr=getattr):
+
+ """ Inherit all other methods from the underlying stream.
+ """
+ return getattr(self.stream, name)
+
+ # these are needed to make "with codecs.open(...)" work properly
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, type, value, tb):
+ self.stream.close()
+
+###
+
+class StreamRecoder:
+
+ """ StreamRecoder instances provide a frontend - backend
+ view of encoding data.
+
+ They use the complete set of APIs returned by the
+ codecs.lookup() function to implement their task.
+
+ Data written to the stream is first decoded into an
+ intermediate format (which is dependent on the given codec
+ combination) and then written to the stream using an instance
+ of the provided Writer class.
+
+ In the other direction, data is read from the stream using a
+ Reader instance and then return encoded data to the caller.
+
+ """
+ # Optional attributes set by the file wrappers below
+ data_encoding = 'unknown'
+ file_encoding = 'unknown'
+
+ def __init__(self, stream, encode, decode, Reader, Writer,
+ errors='strict'):
+
+ """ Creates a StreamRecoder instance which implements a two-way
+ conversion: encode and decode work on the frontend (the
+ input to .read() and output of .write()) while
+ Reader and Writer work on the backend (reading and
+ writing to the stream).
+
+ You can use these objects to do transparent direct
+ recodings from e.g. latin-1 to utf-8 and back.
+
+ stream must be a file-like object.
+
+ encode, decode must adhere to the Codec interface, Reader,
+ Writer must be factory functions or classes providing the
+ StreamReader, StreamWriter interface resp.
+
+ encode and decode are needed for the frontend translation,
+ Reader and Writer for the backend translation. Unicode is
+ used as intermediate encoding.
+
+ Error handling is done in the same way as defined for the
+ StreamWriter/Readers.
+
+ """
+ self.stream = stream
+ self.encode = encode
+ self.decode = decode
+ self.reader = Reader(stream, errors)
+ self.writer = Writer(stream, errors)
+ self.errors = errors
+
+ def read(self, size=-1):
+
+ data = self.reader.read(size)
+ data, bytesencoded = self.encode(data, self.errors)
+ return data
+
+ def readline(self, size=None):
+
+ if size is None:
+ data = self.reader.readline()
+ else:
+ data = self.reader.readline(size)
+ data, bytesencoded = self.encode(data, self.errors)
+ return data
+
+ def readlines(self, sizehint=None):
+
+ data = self.reader.read()
+ data, bytesencoded = self.encode(data, self.errors)
+ return data.splitlines(1)
+
+ def next(self):
+
+ """ Return the next decoded line from the input stream."""
+ data = self.reader.next()
+ data, bytesencoded = self.encode(data, self.errors)
+ return data
+
+ def __iter__(self):
+ return self
+
+ def write(self, data):
+
+ data, bytesdecoded = self.decode(data, self.errors)
+ return self.writer.write(data)
+
+ def writelines(self, list):
+
+ data = ''.join(list)
+ data, bytesdecoded = self.decode(data, self.errors)
+ return self.writer.write(data)
+
+ def reset(self):
+
+ self.reader.reset()
+ self.writer.reset()
+
+ def __getattr__(self, name,
+ getattr=getattr):
+
+ """ Inherit all other methods from the underlying stream.
+ """
+ return getattr(self.stream, name)
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, type, value, tb):
+ self.stream.close()
+
+### Shortcuts
+
+def open(filename, mode='rb', encoding=None, errors='strict', buffering=1):
+
+ """ Open an encoded file using the given mode and return
+ a wrapped version providing transparent encoding/decoding.
+
+ Note: The wrapped version will only accept the object format
+ defined by the codecs, i.e. Unicode objects for most builtin
+ codecs. Output is also codec dependent and will usually be
+ Unicode as well.
+
+ Files are always opened in binary mode, even if no binary mode
+ was specified. This is done to avoid data loss due to encodings
+ using 8-bit values. The default file mode is 'rb' meaning to
+ open the file in binary read mode.
+
+ encoding specifies the encoding which is to be used for the
+ file.
+
+ errors may be given to define the error handling. It defaults
+ to 'strict' which causes ValueErrors to be raised in case an
+ encoding error occurs.
+
+ buffering has the same meaning as for the builtin open() API.
+ It defaults to line buffered.
+
+ The returned wrapped file object provides an extra attribute
+ .encoding which allows querying the used encoding. This
+ attribute is only available if an encoding was specified as
+ parameter.
+
+ """
+ if encoding is not None:
+ if 'U' in mode:
+ # No automatic conversion of '\n' is done on reading and writing
+ mode = mode.strip().replace('U', '')
+ if mode[:1] not in set('rwa'):
+ mode = 'r' + mode
+ if 'b' not in mode:
+ # Force opening of the file in binary mode
+ mode = mode + 'b'
+ file = __builtin__.open(filename, mode, buffering)
+ if encoding is None:
+ return file
+ info = lookup(encoding)
+ srw = StreamReaderWriter(file, info.streamreader, info.streamwriter, errors)
+ # Add attributes to simplify introspection
+ srw.encoding = encoding
+ return srw
+
+def EncodedFile(file, data_encoding, file_encoding=None, errors='strict'):
+
+ """ Return a wrapped version of file which provides transparent
+ encoding translation.
+
+ Strings written to the wrapped file are interpreted according
+ to the given data_encoding and then written to the original
+ file as string using file_encoding. The intermediate encoding
+ will usually be Unicode but depends on the specified codecs.
+
+ Strings are read from the file using file_encoding and then
+ passed back to the caller as string using data_encoding.
+
+ If file_encoding is not given, it defaults to data_encoding.
+
+ errors may be given to define the error handling. It defaults
+ to 'strict' which causes ValueErrors to be raised in case an
+ encoding error occurs.
+
+ The returned wrapped file object provides two extra attributes
+ .data_encoding and .file_encoding which reflect the given
+ parameters of the same name. The attributes can be used for
+ introspection by Python programs.
+
+ """
+ if file_encoding is None:
+ file_encoding = data_encoding
+ data_info = lookup(data_encoding)
+ file_info = lookup(file_encoding)
+ sr = StreamRecoder(file, data_info.encode, data_info.decode,
+ file_info.streamreader, file_info.streamwriter, errors)
+ # Add attributes to simplify introspection
+ sr.data_encoding = data_encoding
+ sr.file_encoding = file_encoding
+ return sr
+
+### Helpers for codec lookup
+
+def getencoder(encoding):
+
+ """ Lookup up the codec for the given encoding and return
+ its encoder function.
+
+ Raises a LookupError in case the encoding cannot be found.
+
+ """
+ return lookup(encoding).encode
+
+def getdecoder(encoding):
+
+ """ Lookup up the codec for the given encoding and return
+ its decoder function.
+
+ Raises a LookupError in case the encoding cannot be found.
+
+ """
+ return lookup(encoding).decode
+
+def getincrementalencoder(encoding):
+
+ """ Lookup up the codec for the given encoding and return
+ its IncrementalEncoder class or factory function.
+
+ Raises a LookupError in case the encoding cannot be found
+ or the codecs doesn't provide an incremental encoder.
+
+ """
+ encoder = lookup(encoding).incrementalencoder
+ if encoder is None:
+ raise LookupError(encoding)
+ return encoder
+
+def getincrementaldecoder(encoding):
+
+ """ Lookup up the codec for the given encoding and return
+ its IncrementalDecoder class or factory function.
+
+ Raises a LookupError in case the encoding cannot be found
+ or the codecs doesn't provide an incremental decoder.
+
+ """
+ decoder = lookup(encoding).incrementaldecoder
+ if decoder is None:
+ raise LookupError(encoding)
+ return decoder
+
+def getreader(encoding):
+
+ """ Lookup up the codec for the given encoding and return
+ its StreamReader class or factory function.
+
+ Raises a LookupError in case the encoding cannot be found.
+
+ """
+ return lookup(encoding).streamreader
+
+def getwriter(encoding):
+
+ """ Lookup up the codec for the given encoding and return
+ its StreamWriter class or factory function.
+
+ Raises a LookupError in case the encoding cannot be found.
+
+ """
+ return lookup(encoding).streamwriter
+
+def iterencode(iterator, encoding, errors='strict', **kwargs):
+ """
+ Encoding iterator.
+
+ Encodes the input strings from the iterator using a IncrementalEncoder.
+
+ errors and kwargs are passed through to the IncrementalEncoder
+ constructor.
+ """
+ encoder = getincrementalencoder(encoding)(errors, **kwargs)
+ for input in iterator:
+ output = encoder.encode(input)
+ if output:
+ yield output
+ output = encoder.encode("", True)
+ if output:
+ yield output
+
+def iterdecode(iterator, encoding, errors='strict', **kwargs):
+ """
+ Decoding iterator.
+
+ Decodes the input strings from the iterator using a IncrementalDecoder.
+
+ errors and kwargs are passed through to the IncrementalDecoder
+ constructor.
+ """
+ decoder = getincrementaldecoder(encoding)(errors, **kwargs)
+ for input in iterator:
+ output = decoder.decode(input)
+ if output:
+ yield output
+ output = decoder.decode("", True)
+ if output:
+ yield output
+
+### Helpers for charmap-based codecs
+
+def make_identity_dict(rng):
+
+ """ make_identity_dict(rng) -> dict
+
+ Return a dictionary where elements of the rng sequence are
+ mapped to themselves.
+
+ """
+ res = {}
+ for i in rng:
+ res[i]=i
+ return res
+
+def make_encoding_map(decoding_map):
+
+ """ Creates an encoding map from a decoding map.
+
+ If a target mapping in the decoding map occurs multiple
+ times, then that target is mapped to None (undefined mapping),
+ causing an exception when encountered by the charmap codec
+ during translation.
+
+ One example where this happens is cp875.py which decodes
+ multiple character to \\u001a.
+
+ """
+ m = {}
+ for k,v in decoding_map.items():
+ if not v in m:
+ m[v] = k
+ else:
+ m[v] = None
+ return m
+
+### error handlers
+
+try:
+ strict_errors = lookup_error("strict")
+ ignore_errors = lookup_error("ignore")
+ replace_errors = lookup_error("replace")
+ xmlcharrefreplace_errors = lookup_error("xmlcharrefreplace")
+ backslashreplace_errors = lookup_error("backslashreplace")
+except LookupError:
+ # In --disable-unicode builds, these error handler are missing
+ strict_errors = None
+ ignore_errors = None
+ replace_errors = None
+ xmlcharrefreplace_errors = None
+ backslashreplace_errors = None
+
+# Tell modulefinder that using codecs probably needs the encodings
+# package
+_false = 0
+if _false:
+ import encodings
+
+### Tests
+
+if __name__ == '__main__':
+
+ # Make stdout translate Latin-1 output into UTF-8 output
+ sys.stdout = EncodedFile(sys.stdout, 'latin-1', 'utf-8')
+
+ # Have stdin translate Latin-1 input into UTF-8 input
+ sys.stdin = EncodedFile(sys.stdin, 'utf-8', 'latin-1')
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
index 0000000000..82bf490ee4
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/collections.py
@@ -0,0 +1,730 @@
+__all__ = ['Counter', 'deque', 'defaultdict', 'namedtuple', 'OrderedDict']
+# For bootstrapping reasons, the collection ABCs are defined in _abcoll.py.
+# They should however be considered an integral part of collections.py.
+from _abcoll import *
+import _abcoll
+__all__ += _abcoll.__all__
+
+from _collections import deque, defaultdict
+from operator import itemgetter as _itemgetter, eq as _eq
+from keyword import iskeyword as _iskeyword
+import sys as _sys
+import heapq as _heapq
+from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
+from itertools import imap as _imap
+
+try:
+ from thread import get_ident as _get_ident
+except ImportError:
+ from dummy_thread import get_ident as _get_ident
+
+
+################################################################################
+### OrderedDict
+################################################################################
+
+class OrderedDict(dict):
+ 'Dictionary that remembers insertion order'
+ # An inherited dict maps keys to values.
+ # The inherited dict provides __getitem__, __len__, __contains__, and get.
+ # The remaining methods are order-aware.
+ # Big-O running times for all methods are the same as regular dictionaries.
+
+ # The internal self.__map dict maps keys to links in a doubly linked list.
+ # The circular doubly linked list starts and ends with a sentinel element.
+ # The sentinel element never gets deleted (this simplifies the algorithm).
+ # Each link is stored as a list of length three: [PREV, NEXT, KEY].
+
+ def __init__(*args, **kwds):
+ '''Initialize an ordered dictionary. The signature is the same as
+ regular dictionaries, but keyword arguments are not recommended because
+ their insertion order is arbitrary.
+
+ '''
+ if not args:
+ raise TypeError("descriptor '__init__' of 'OrderedDict' object "
+ "needs an argument")
+ self = args[0]
+ args = args[1:]
+ if len(args) > 1:
+ raise TypeError('expected at most 1 arguments, got %d' % len(args))
+ try:
+ self.__root
+ except AttributeError:
+ self.__root = root = [] # sentinel node
+ root[:] = [root, root, None]
+ self.__map = {}
+ self.__update(*args, **kwds)
+
+ def __setitem__(self, key, value, dict_setitem=dict.__setitem__):
+ 'od.__setitem__(i, y) <==> od[i]=y'
+ # Setting a new item creates a new link at the end of the linked list,
+ # and the inherited dictionary is updated with the new key/value pair.
+ if key not in self:
+ root = self.__root
+ last = root[0]
+ last[1] = root[0] = self.__map[key] = [last, root, key]
+ return dict_setitem(self, key, value)
+
+ def __delitem__(self, key, dict_delitem=dict.__delitem__):
+ 'od.__delitem__(y) <==> del od[y]'
+ # Deleting an existing item uses self.__map to find the link which gets
+ # removed by updating the links in the predecessor and successor nodes.
+ dict_delitem(self, key)
+ link_prev, link_next, _ = self.__map.pop(key)
+ link_prev[1] = link_next # update link_prev[NEXT]
+ link_next[0] = link_prev # update link_next[PREV]
+
+ def __iter__(self):
+ 'od.__iter__() <==> iter(od)'
+ # Traverse the linked list in order.
+ root = self.__root
+ curr = root[1] # start at the first node
+ while curr is not root:
+ yield curr[2] # yield the curr[KEY]
+ curr = curr[1] # move to next node
+
+ def __reversed__(self):
+ 'od.__reversed__() <==> reversed(od)'
+ # Traverse the linked list in reverse order.
+ root = self.__root
+ curr = root[0] # start at the last node
+ while curr is not root:
+ yield curr[2] # yield the curr[KEY]
+ curr = curr[0] # move to previous node
+
+ def clear(self):
+ 'od.clear() -> None. Remove all items from od.'
+ root = self.__root
+ root[:] = [root, root, None]
+ self.__map.clear()
+ dict.clear(self)
+
+ # -- the following methods do not depend on the internal structure --
+
+ def keys(self):
+ 'od.keys() -> list of keys in od'
+ return list(self)
+
+ def values(self):
+ 'od.values() -> list of values in od'
+ return [self[key] for key in self]
+
+ def items(self):
+ 'od.items() -> list of (key, value) pairs in od'
+ return [(key, self[key]) for key in self]
+
+ def iterkeys(self):
+ 'od.iterkeys() -> an iterator over the keys in od'
+ return iter(self)
+
+ def itervalues(self):
+ 'od.itervalues -> an iterator over the values in od'
+ for k in self:
+ yield self[k]
+
+ def iteritems(self):
+ 'od.iteritems -> an iterator over the (key, value) pairs in od'
+ for k in self:
+ yield (k, self[k])
+
+ update = MutableMapping.update
+
+ __update = update # let subclasses override update without breaking __init__
+
+ __marker = object()
+
+ def pop(self, key, default=__marker):
+ '''od.pop(k[,d]) -> v, remove specified key and return the corresponding
+ value. If key is not found, d is returned if given, otherwise KeyError
+ is raised.
+
+ '''
+ if key in self:
+ result = self[key]
+ del self[key]
+ return result
+ if default is self.__marker:
+ raise KeyError(key)
+ return default
+
+ def setdefault(self, key, default=None):
+ 'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od'
+ if key in self:
+ return self[key]
+ self[key] = default
+ return default
+
+ def popitem(self, last=True):
+ '''od.popitem() -> (k, v), return and remove a (key, value) pair.
+ Pairs are returned in LIFO order if last is true or FIFO order if false.
+
+ '''
+ if not self:
+ raise KeyError('dictionary is empty')
+ key = next(reversed(self) if last else iter(self))
+ value = self.pop(key)
+ return key, value
+
+ def __repr__(self, _repr_running={}):
+ 'od.__repr__() <==> repr(od)'
+ call_key = id(self), _get_ident()
+ if call_key in _repr_running:
+ return '...'
+ _repr_running[call_key] = 1
+ try:
+ if not self:
+ return '%s()' % (self.__class__.__name__,)
+ return '%s(%r)' % (self.__class__.__name__, self.items())
+ finally:
+ del _repr_running[call_key]
+
+ def __reduce__(self):
+ 'Return state information for pickling'
+ items = [[k, self[k]] for k in self]
+ inst_dict = vars(self).copy()
+ for k in vars(OrderedDict()):
+ inst_dict.pop(k, None)
+ if inst_dict:
+ return (self.__class__, (items,), inst_dict)
+ return self.__class__, (items,)
+
+ def copy(self):
+ 'od.copy() -> a shallow copy of od'
+ return self.__class__(self)
+
+ @classmethod
+ def fromkeys(cls, iterable, value=None):
+ '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S.
+ If not specified, the value defaults to None.
+
+ '''
+ self = cls()
+ for key in iterable:
+ self[key] = value
+ return self
+
+ def __eq__(self, other):
+ '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive
+ while comparison to a regular mapping is order-insensitive.
+
+ '''
+ if isinstance(other, OrderedDict):
+ return dict.__eq__(self, other) and all(_imap(_eq, self, other))
+ return dict.__eq__(self, other)
+
+ def __ne__(self, other):
+ 'od.__ne__(y) <==> od!=y'
+ return not self == other
+
+ # -- the following methods support python 3.x style dictionary views --
+
+ def viewkeys(self):
+ "od.viewkeys() -> a set-like object providing a view on od's keys"
+ return KeysView(self)
+
+ def viewvalues(self):
+ "od.viewvalues() -> an object providing a view on od's values"
+ return ValuesView(self)
+
+ def viewitems(self):
+ "od.viewitems() -> a set-like object providing a view on od's items"
+ return ItemsView(self)
+
+
+################################################################################
+### namedtuple
+################################################################################
+
+_class_template = '''\
+class {typename}(tuple):
+ '{typename}({arg_list})'
+
+ __slots__ = ()
+
+ _fields = {field_names!r}
+
+ def __new__(_cls, {arg_list}):
+ 'Create new instance of {typename}({arg_list})'
+ return _tuple.__new__(_cls, ({arg_list}))
+
+ @classmethod
+ def _make(cls, iterable, new=tuple.__new__, len=len):
+ 'Make a new {typename} object from a sequence or iterable'
+ result = new(cls, iterable)
+ if len(result) != {num_fields:d}:
+ raise TypeError('Expected {num_fields:d} arguments, got %d' % len(result))
+ return result
+
+ def __repr__(self):
+ 'Return a nicely formatted representation string'
+ return '{typename}({repr_fmt})' % self
+
+ def _asdict(self):
+ 'Return a new OrderedDict which maps field names to their values'
+ return OrderedDict(zip(self._fields, self))
+
+ def _replace(_self, **kwds):
+ 'Return a new {typename} object replacing specified fields with new values'
+ result = _self._make(map(kwds.pop, {field_names!r}, _self))
+ if kwds:
+ raise ValueError('Got unexpected field names: %r' % kwds.keys())
+ return result
+
+ def __getnewargs__(self):
+ 'Return self as a plain tuple. Used by copy and pickle.'
+ return tuple(self)
+
+ __dict__ = _property(_asdict)
+
+ def __getstate__(self):
+ 'Exclude the OrderedDict from pickling'
+ pass
+
+{field_defs}
+'''
+
+_repr_template = '{name}=%r'
+
+_field_template = '''\
+ {name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}')
+'''
+
+def namedtuple(typename, field_names, verbose=False, rename=False):
+ """Returns a new subclass of tuple with named fields.
+
+ >>> Point = namedtuple('Point', ['x', 'y'])
+ >>> Point.__doc__ # docstring for the new class
+ 'Point(x, y)'
+ >>> p = Point(11, y=22) # instantiate with positional args or keywords
+ >>> p[0] + p[1] # indexable like a plain tuple
+ 33
+ >>> x, y = p # unpack like a regular tuple
+ >>> x, y
+ (11, 22)
+ >>> p.x + p.y # fields also accessable by name
+ 33
+ >>> d = p._asdict() # convert to a dictionary
+ >>> d['x']
+ 11
+ >>> Point(**d) # convert from a dictionary
+ Point(x=11, y=22)
+ >>> p._replace(x=100) # _replace() is like str.replace() but targets named fields
+ Point(x=100, y=22)
+
+ """
+
+ # Validate the field names. At the user's option, either generate an error
+ # message or automatically replace the field name with a valid name.
+ if isinstance(field_names, basestring):
+ field_names = field_names.replace(',', ' ').split()
+ field_names = map(str, field_names)
+ typename = str(typename)
+ if rename:
+ seen = set()
+ for index, name in enumerate(field_names):
+ if (not all(c.isalnum() or c=='_' for c in name)
+ or _iskeyword(name)
+ or not name
+ or name[0].isdigit()
+ or name.startswith('_')
+ or name in seen):
+ field_names[index] = '_%d' % index
+ seen.add(name)
+ for name in [typename] + field_names:
+ if type(name) != str:
+ raise TypeError('Type names and field names must be strings')
+ if not all(c.isalnum() or c=='_' for c in name):
+ raise ValueError('Type names and field names can only contain '
+ 'alphanumeric characters and underscores: %r' % name)
+ if _iskeyword(name):
+ raise ValueError('Type names and field names cannot be a '
+ 'keyword: %r' % name)
+ if name[0].isdigit():
+ raise ValueError('Type names and field names cannot start with '
+ 'a number: %r' % name)
+ seen = set()
+ for name in field_names:
+ if name.startswith('_') and not rename:
+ raise ValueError('Field names cannot start with an underscore: '
+ '%r' % name)
+ if name in seen:
+ raise ValueError('Encountered duplicate field name: %r' % name)
+ seen.add(name)
+
+ # Fill-in the class template
+ class_definition = _class_template.format(
+ typename = typename,
+ field_names = tuple(field_names),
+ num_fields = len(field_names),
+ arg_list = repr(tuple(field_names)).replace("'", "")[1:-1],
+ repr_fmt = ', '.join(_repr_template.format(name=name)
+ for name in field_names),
+ field_defs = '\n'.join(_field_template.format(index=index, name=name)
+ for index, name in enumerate(field_names))
+ )
+ if verbose:
+ print class_definition
+
+ # Execute the template string in a temporary namespace and support
+ # tracing utilities by setting a value for frame.f_globals['__name__']
+ namespace = dict(_itemgetter=_itemgetter, __name__='namedtuple_%s' % typename,
+ OrderedDict=OrderedDict, _property=property, _tuple=tuple)
+ try:
+ exec class_definition in namespace
+ except SyntaxError as e:
+ raise SyntaxError(e.message + ':\n' + class_definition)
+ result = namespace[typename]
+
+ # For pickling to work, the __module__ variable needs to be set to the frame
+ # where the named tuple is created. Bypass this step in environments where
+ # sys._getframe is not defined (Jython for example) or sys._getframe is not
+ # defined for arguments greater than 0 (IronPython).
+ try:
+ result.__module__ = _sys._getframe(1).f_globals.get('__name__', '__main__')
+ except (AttributeError, ValueError):
+ pass
+
+ return result
+
+
+########################################################################
+### Counter
+########################################################################
+
+class Counter(dict):
+ '''Dict subclass for counting hashable items. Sometimes called a bag
+ or multiset. Elements are stored as dictionary keys and their counts
+ are stored as dictionary values.
+
+ >>> c = Counter('abcdeabcdabcaba') # count elements from a string
+
+ >>> c.most_common(3) # three most common elements
+ [('a', 5), ('b', 4), ('c', 3)]
+ >>> sorted(c) # list all unique elements
+ ['a', 'b', 'c', 'd', 'e']
+ >>> ''.join(sorted(c.elements())) # list elements with repetitions
+ 'aaaaabbbbcccdde'
+ >>> sum(c.values()) # total of all counts
+ 15
+
+ >>> c['a'] # count of letter 'a'
+ 5
+ >>> for elem in 'shazam': # update counts from an iterable
+ ... c[elem] += 1 # by adding 1 to each element's count
+ >>> c['a'] # now there are seven 'a'
+ 7
+ >>> del c['b'] # remove all 'b'
+ >>> c['b'] # now there are zero 'b'
+ 0
+
+ >>> d = Counter('simsalabim') # make another counter
+ >>> c.update(d) # add in the second counter
+ >>> c['a'] # now there are nine 'a'
+ 9
+
+ >>> c.clear() # empty the counter
+ >>> c
+ Counter()
+
+ Note: If a count is set to zero or reduced to zero, it will remain
+ in the counter until the entry is deleted or the counter is cleared:
+
+ >>> c = Counter('aaabbc')
+ >>> c['b'] -= 2 # reduce the count of 'b' by two
+ >>> c.most_common() # 'b' is still in, but its count is zero
+ [('a', 3), ('c', 1), ('b', 0)]
+
+ '''
+ # References:
+ # http://en.wikipedia.org/wiki/Multiset
+ # http://www.gnu.org/software/smalltalk/manual-base/html_node/Bag.html
+ # http://www.demo2s.com/Tutorial/Cpp/0380__set-multiset/Catalog0380__set-multiset.htm
+ # http://code.activestate.com/recipes/259174/
+ # Knuth, TAOCP Vol. II section 4.6.3
+
+ def __init__(*args, **kwds):
+ '''Create a new, empty Counter object. And if given, count elements
+ from an input iterable. Or, initialize the count from another mapping
+ of elements to their counts.
+
+ >>> c = Counter() # a new, empty counter
+ >>> c = Counter('gallahad') # a new counter from an iterable
+ >>> c = Counter({'a': 4, 'b': 2}) # a new counter from a mapping
+ >>> c = Counter(a=4, b=2) # a new counter from keyword args
+
+ '''
+ if not args:
+ raise TypeError("descriptor '__init__' of 'Counter' object "
+ "needs an argument")
+ self = args[0]
+ args = args[1:]
+ if len(args) > 1:
+ raise TypeError('expected at most 1 arguments, got %d' % len(args))
+ super(Counter, self).__init__()
+ self.update(*args, **kwds)
+
+ def __missing__(self, key):
+ 'The count of elements not in the Counter is zero.'
+ # Needed so that self[missing_item] does not raise KeyError
+ return 0
+
+ def most_common(self, n=None):
+ '''List the n most common elements and their counts from the most
+ common to the least. If n is None, then list all element counts.
+
+ >>> Counter('abcdeabcdabcaba').most_common(3)
+ [('a', 5), ('b', 4), ('c', 3)]
+
+ '''
+ # Emulate Bag.sortedByCount from Smalltalk
+ if n is None:
+ return sorted(self.iteritems(), key=_itemgetter(1), reverse=True)
+ return _heapq.nlargest(n, self.iteritems(), key=_itemgetter(1))
+
+ def elements(self):
+ '''Iterator over elements repeating each as many times as its count.
+
+ >>> c = Counter('ABCABC')
+ >>> sorted(c.elements())
+ ['A', 'A', 'B', 'B', 'C', 'C']
+
+ # Knuth's example for prime factors of 1836: 2**2 * 3**3 * 17**1
+ >>> prime_factors = Counter({2: 2, 3: 3, 17: 1})
+ >>> product = 1
+ >>> for factor in prime_factors.elements(): # loop over factors
+ ... product *= factor # and multiply them
+ >>> product
+ 1836
+
+ Note, if an element's count has been set to zero or is a negative
+ number, elements() will ignore it.
+
+ '''
+ # Emulate Bag.do from Smalltalk and Multiset.begin from C++.
+ return _chain.from_iterable(_starmap(_repeat, self.iteritems()))
+
+ # Override dict methods where necessary
+
+ @classmethod
+ def fromkeys(cls, iterable, v=None):
+ # There is no equivalent method for counters because setting v=1
+ # means that no element can have a count greater than one.
+ raise NotImplementedError(
+ 'Counter.fromkeys() is undefined. Use Counter(iterable) instead.')
+
+ def update(*args, **kwds):
+ '''Like dict.update() but add counts instead of replacing them.
+
+ Source can be an iterable, a dictionary, or another Counter instance.
+
+ >>> c = Counter('which')
+ >>> c.update('witch') # add elements from another iterable
+ >>> d = Counter('watch')
+ >>> c.update(d) # add elements from another counter
+ >>> c['h'] # four 'h' in which, witch, and watch
+ 4
+
+ '''
+ # The regular dict.update() operation makes no sense here because the
+ # replace behavior results in the some of original untouched counts
+ # being mixed-in with all of the other counts for a mismash that
+ # doesn't have a straight-forward interpretation in most counting
+ # contexts. Instead, we implement straight-addition. Both the inputs
+ # and outputs are allowed to contain zero and negative counts.
+
+ if not args:
+ raise TypeError("descriptor 'update' of 'Counter' object "
+ "needs an argument")
+ self = args[0]
+ args = args[1:]
+ if len(args) > 1:
+ raise TypeError('expected at most 1 arguments, got %d' % len(args))
+ iterable = args[0] if args else None
+ if iterable is not None:
+ if isinstance(iterable, Mapping):
+ if self:
+ self_get = self.get
+ for elem, count in iterable.iteritems():
+ self[elem] = self_get(elem, 0) + count
+ else:
+ super(Counter, self).update(iterable) # fast path when counter is empty
+ else:
+ self_get = self.get
+ for elem in iterable:
+ self[elem] = self_get(elem, 0) + 1
+ if kwds:
+ self.update(kwds)
+
+ def subtract(*args, **kwds):
+ '''Like dict.update() but subtracts counts instead of replacing them.
+ Counts can be reduced below zero. Both the inputs and outputs are
+ allowed to contain zero and negative counts.
+
+ Source can be an iterable, a dictionary, or another Counter instance.
+
+ >>> c = Counter('which')
+ >>> c.subtract('witch') # subtract elements from another iterable
+ >>> c.subtract(Counter('watch')) # subtract elements from another counter
+ >>> c['h'] # 2 in which, minus 1 in witch, minus 1 in watch
+ 0
+ >>> c['w'] # 1 in which, minus 1 in witch, minus 1 in watch
+ -1
+
+ '''
+ if not args:
+ raise TypeError("descriptor 'subtract' of 'Counter' object "
+ "needs an argument")
+ self = args[0]
+ args = args[1:]
+ if len(args) > 1:
+ raise TypeError('expected at most 1 arguments, got %d' % len(args))
+ iterable = args[0] if args else None
+ if iterable is not None:
+ self_get = self.get
+ if isinstance(iterable, Mapping):
+ for elem, count in iterable.items():
+ self[elem] = self_get(elem, 0) - count
+ else:
+ for elem in iterable:
+ self[elem] = self_get(elem, 0) - 1
+ if kwds:
+ self.subtract(kwds)
+
+ def copy(self):
+ 'Return a shallow copy.'
+ return self.__class__(self)
+
+ def __reduce__(self):
+ return self.__class__, (dict(self),)
+
+ def __delitem__(self, elem):
+ 'Like dict.__delitem__() but does not raise KeyError for missing values.'
+ if elem in self:
+ super(Counter, self).__delitem__(elem)
+
+ def __repr__(self):
+ if not self:
+ return '%s()' % self.__class__.__name__
+ items = ', '.join(map('%r: %r'.__mod__, self.most_common()))
+ return '%s({%s})' % (self.__class__.__name__, items)
+
+ # Multiset-style mathematical operations discussed in:
+ # Knuth TAOCP Volume II section 4.6.3 exercise 19
+ # and at http://en.wikipedia.org/wiki/Multiset
+ #
+ # Outputs guaranteed to only include positive counts.
+ #
+ # To strip negative and zero counts, add-in an empty counter:
+ # c += Counter()
+
+ def __add__(self, other):
+ '''Add counts from two counters.
+
+ >>> Counter('abbb') + Counter('bcc')
+ Counter({'b': 4, 'c': 2, 'a': 1})
+
+ '''
+ if not isinstance(other, Counter):
+ return NotImplemented
+ result = Counter()
+ for elem, count in self.items():
+ newcount = count + other[elem]
+ if newcount > 0:
+ result[elem] = newcount
+ for elem, count in other.items():
+ if elem not in self and count > 0:
+ result[elem] = count
+ return result
+
+ def __sub__(self, other):
+ ''' Subtract count, but keep only results with positive counts.
+
+ >>> Counter('abbbc') - Counter('bccd')
+ Counter({'b': 2, 'a': 1})
+
+ '''
+ if not isinstance(other, Counter):
+ return NotImplemented
+ result = Counter()
+ for elem, count in self.items():
+ newcount = count - other[elem]
+ if newcount > 0:
+ result[elem] = newcount
+ for elem, count in other.items():
+ if elem not in self and count < 0:
+ result[elem] = 0 - count
+ return result
+
+ def __or__(self, other):
+ '''Union is the maximum of value in either of the input counters.
+
+ >>> Counter('abbb') | Counter('bcc')
+ Counter({'b': 3, 'c': 2, 'a': 1})
+
+ '''
+ if not isinstance(other, Counter):
+ return NotImplemented
+ result = Counter()
+ for elem, count in self.items():
+ other_count = other[elem]
+ newcount = other_count if count < other_count else count
+ if newcount > 0:
+ result[elem] = newcount
+ for elem, count in other.items():
+ if elem not in self and count > 0:
+ result[elem] = count
+ return result
+
+ def __and__(self, other):
+ ''' Intersection is the minimum of corresponding counts.
+
+ >>> Counter('abbb') & Counter('bcc')
+ Counter({'b': 1})
+
+ '''
+ if not isinstance(other, Counter):
+ return NotImplemented
+ result = Counter()
+ for elem, count in self.items():
+ other_count = other[elem]
+ newcount = count if count < other_count else other_count
+ if newcount > 0:
+ result[elem] = newcount
+ return result
+
+
+if __name__ == '__main__':
+ # verify that instances can be pickled
+ from cPickle import loads, dumps
+ Point = namedtuple('Point', 'x, y', True)
+ p = Point(x=10, y=20)
+ assert p == loads(dumps(p))
+
+ # test and demonstrate ability to override methods
+ class Point(namedtuple('Point', 'x y')):
+ __slots__ = ()
+ @property
+ def hypot(self):
+ return (self.x ** 2 + self.y ** 2) ** 0.5
+ def __str__(self):
+ return 'Point: x=%6.3f y=%6.3f hypot=%6.3f' % (self.x, self.y, self.hypot)
+
+ for p in Point(3, 4), Point(14, 5/7.):
+ print p
+
+ class Point(namedtuple('Point', 'x y')):
+ 'Point class with optimized _make() and _replace() without error-checking'
+ __slots__ = ()
+ _make = classmethod(tuple.__new__)
+ def _replace(self, _map=map, **kwds):
+ return self._make(_map(kwds.get, ('x', 'y'), self))
+
+ print Point(11, 22)._replace(x=100)
+
+ Point3D = namedtuple('Point3D', Point._fields + ('z',))
+ print Point3D.__doc__
+
+ import doctest
+ TestResults = namedtuple('TestResults', 'failed attempted')
+ print TestResults(*doctest.testmod())
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
index 0000000000..839649d61b
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/compileall.py
@@ -0,0 +1,227 @@
+"""Module/script to byte-compile all .py files to .pyc (or .pyo) files.
+
+When called as a script with arguments, this compiles the directories
+given as arguments recursively; the -l option prevents it from
+recursing into directories.
+
+Without arguments, if compiles all modules on sys.path, without
+recursing into subdirectories. (Even though it should do so for
+packages -- for now, you'll have to deal with packages separately.)
+
+See module py_compile for details of the actual byte-compilation.
+"""
+import os
+import sys
+import py_compile
+import struct
+import imp
+
+__all__ = ["compile_dir","compile_file","compile_path"]
+
+def compile_dir(dir, maxlevels=10, ddir=None,
+ force=0, rx=None, quiet=0):
+ """Byte-compile all modules in the given directory tree.
+
+ Arguments (only dir is required):
+
+ dir: the directory to byte-compile
+ maxlevels: maximum recursion level (default 10)
+ ddir: the directory that will be prepended to the path to the
+ file as it is compiled into each byte-code file.
+ force: if 1, force compilation, even if timestamps are up-to-date
+ quiet: if 1, be quiet during compilation
+ """
+ if not quiet:
+ print 'Listing', dir, '...'
+ try:
+ names = os.listdir(dir)
+ except os.error:
+ print "Can't list", dir
+ names = []
+ names.sort()
+ success = 1
+ for name in names:
+ fullname = os.path.join(dir, name)
+ if ddir is not None:
+ dfile = os.path.join(ddir, name)
+ else:
+ dfile = None
+ if not os.path.isdir(fullname):
+ if not compile_file(fullname, ddir, force, rx, quiet):
+ success = 0
+ elif maxlevels > 0 and \
+ name != os.curdir and name != os.pardir and \
+ os.path.isdir(fullname) and \
+ not os.path.islink(fullname):
+ if not compile_dir(fullname, maxlevels - 1, dfile, force, rx,
+ quiet):
+ success = 0
+ return success
+
+def compile_file(fullname, ddir=None, force=0, rx=None, quiet=0):
+ """Byte-compile one file.
+
+ Arguments (only fullname is required):
+
+ fullname: the file to byte-compile
+ ddir: if given, the directory name compiled in to the
+ byte-code file.
+ force: if 1, force compilation, even if timestamps are up-to-date
+ quiet: if 1, be quiet during compilation
+ """
+ success = 1
+ name = os.path.basename(fullname)
+ if ddir is not None:
+ dfile = os.path.join(ddir, name)
+ else:
+ dfile = None
+ if rx is not None:
+ mo = rx.search(fullname)
+ if mo:
+ return success
+ if os.path.isfile(fullname):
+ head, tail = name[:-3], name[-3:]
+ if tail == '.py':
+ if not force:
+ try:
+ mtime = int(os.stat(fullname).st_mtime)
+ expect = struct.pack('<4sl', imp.get_magic(), mtime)
+ cfile = fullname + (__debug__ and 'c' or 'o')
+ with open(cfile, 'rb') as chandle:
+ actual = chandle.read(8)
+ if expect == actual:
+ return success
+ except IOError:
+ pass
+ if not quiet:
+ print 'Compiling', fullname, '...'
+ try:
+ ok = py_compile.compile(fullname, None, dfile, True)
+ except py_compile.PyCompileError,err:
+ if quiet:
+ print 'Compiling', fullname, '...'
+ print err.msg
+ success = 0
+ except IOError, e:
+ print "Sorry", e
+ success = 0
+ else:
+ if ok == 0:
+ success = 0
+ return success
+
+def compile_path(skip_curdir=1, maxlevels=0, force=0, quiet=0):
+ """Byte-compile all module on sys.path.
+
+ Arguments (all optional):
+
+ skip_curdir: if true, skip current directory (default true)
+ maxlevels: max recursion level (default 0)
+ force: as for compile_dir() (default 0)
+ quiet: as for compile_dir() (default 0)
+ """
+ success = 1
+ for dir in sys.path:
+ if (not dir or dir == os.curdir) and skip_curdir:
+ print 'Skipping current directory'
+ else:
+ success = success and compile_dir(dir, maxlevels, None,
+ force, quiet=quiet)
+ return success
+
+def expand_args(args, flist):
+ """read names in flist and append to args"""
+ expanded = args[:]
+ if flist:
+ try:
+ if flist == '-':
+ fd = sys.stdin
+ else:
+ fd = open(flist)
+ while 1:
+ line = fd.readline()
+ if not line:
+ break
+ expanded.append(line[:-1])
+ except IOError:
+ print "Error reading file list %s" % flist
+ raise
+ return expanded
+
+def main():
+ """Script main program."""
+ import getopt
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], 'lfqd:x:i:')
+ except getopt.error, msg:
+ print msg
+ print "usage: python compileall.py [-l] [-f] [-q] [-d destdir] " \
+ "[-x regexp] [-i list] [directory|file ...]"
+ print
+ print "arguments: zero or more file and directory names to compile; " \
+ "if no arguments given, "
+ print " defaults to the equivalent of -l sys.path"
+ print
+ print "options:"
+ print "-l: don't recurse into subdirectories"
+ print "-f: force rebuild even if timestamps are up-to-date"
+ print "-q: output only error messages"
+ print "-d destdir: directory to prepend to file paths for use in " \
+ "compile-time tracebacks and in"
+ print " runtime tracebacks in cases where the source " \
+ "file is unavailable"
+ print "-x regexp: skip files matching the regular expression regexp; " \
+ "the regexp is searched for"
+ print " in the full path of each file considered for " \
+ "compilation"
+ print "-i file: add all the files and directories listed in file to " \
+ "the list considered for"
+ print ' compilation; if "-", names are read from stdin'
+
+ sys.exit(2)
+ maxlevels = 10
+ ddir = None
+ force = 0
+ quiet = 0
+ rx = None
+ flist = None
+ for o, a in opts:
+ if o == '-l': maxlevels = 0
+ if o == '-d': ddir = a
+ if o == '-f': force = 1
+ if o == '-q': quiet = 1
+ if o == '-x':
+ import re
+ rx = re.compile(a)
+ if o == '-i': flist = a
+ if ddir:
+ if len(args) != 1 and not os.path.isdir(args[0]):
+ print "-d destdir require exactly one directory argument"
+ sys.exit(2)
+ success = 1
+ try:
+ if args or flist:
+ try:
+ if flist:
+ args = expand_args(args, flist)
+ except IOError:
+ success = 0
+ if success:
+ for arg in args:
+ if os.path.isdir(arg):
+ if not compile_dir(arg, maxlevels, ddir,
+ force, rx, quiet):
+ success = 0
+ else:
+ if not compile_file(arg, ddir, force, rx, quiet):
+ success = 0
+ else:
+ success = compile_path()
+ except KeyboardInterrupt:
+ print "\n[interrupted]"
+ success = 0
+ return success
+
+if __name__ == '__main__':
+ exit_status = int(not main())
+ sys.exit(exit_status)
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
index 0000000000..c9792f7687
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/copy.py
@@ -0,0 +1,433 @@
+"""Generic (shallow and deep) copying operations.
+
+Interface summary:
+
+ import copy
+
+ x = copy.copy(y) # make a shallow copy of y
+ x = copy.deepcopy(y) # make a deep copy of y
+
+For module specific errors, copy.Error is raised.
+
+The difference between shallow and deep copying is only relevant for
+compound objects (objects that contain other objects, like lists or
+class instances).
+
+- A shallow copy constructs a new compound object and then (to the
+ extent possible) inserts *the same objects* into it that the
+ original contains.
+
+- A deep copy constructs a new compound object and then, recursively,
+ inserts *copies* into it of the objects found in the original.
+
+Two problems often exist with deep copy operations that don't exist
+with shallow copy operations:
+
+ a) recursive objects (compound objects that, directly or indirectly,
+ contain a reference to themselves) may cause a recursive loop
+
+ b) because deep copy copies *everything* it may copy too much, e.g.
+ administrative data structures that should be shared even between
+ copies
+
+Python's deep copy operation avoids these problems by:
+
+ a) keeping a table of objects already copied during the current
+ copying pass
+
+ b) letting user-defined classes override the copying operation or the
+ set of components copied
+
+This version does not copy types like module, class, function, method,
+nor stack trace, stack frame, nor file, socket, window, nor array, nor
+any similar types.
+
+Classes can use the same interfaces to control copying that they use
+to control pickling: they can define methods called __getinitargs__(),
+__getstate__() and __setstate__(). See the documentation for module
+"pickle" for information on these methods.
+"""
+
+import types
+import weakref
+from copy_reg import dispatch_table
+
+class Error(Exception):
+ pass
+error = Error # backward compatibility
+
+try:
+ from org.python.core import PyStringMap
+except ImportError:
+ PyStringMap = None
+
+__all__ = ["Error", "copy", "deepcopy"]
+
+def copy(x):
+ """Shallow copy operation on arbitrary Python objects.
+
+ See the module's __doc__ string for more info.
+ """
+
+ cls = type(x)
+
+ copier = _copy_dispatch.get(cls)
+ if copier:
+ return copier(x)
+
+ copier = getattr(cls, "__copy__", None)
+ if copier:
+ return copier(x)
+
+ reductor = dispatch_table.get(cls)
+ if reductor:
+ rv = reductor(x)
+ else:
+ reductor = getattr(x, "__reduce_ex__", None)
+ if reductor:
+ rv = reductor(2)
+ else:
+ reductor = getattr(x, "__reduce__", None)
+ if reductor:
+ rv = reductor()
+ else:
+ raise Error("un(shallow)copyable object of type %s" % cls)
+
+ return _reconstruct(x, rv, 0)
+
+
+_copy_dispatch = d = {}
+
+def _copy_immutable(x):
+ return x
+for t in (type(None), int, long, float, bool, str, tuple,
+ frozenset, type, xrange, types.ClassType,
+ types.BuiltinFunctionType, type(Ellipsis),
+ types.FunctionType, weakref.ref):
+ d[t] = _copy_immutable
+for name in ("ComplexType", "UnicodeType", "CodeType"):
+ t = getattr(types, name, None)
+ if t is not None:
+ d[t] = _copy_immutable
+
+def _copy_with_constructor(x):
+ return type(x)(x)
+for t in (list, dict, set):
+ d[t] = _copy_with_constructor
+
+def _copy_with_copy_method(x):
+ return x.copy()
+if PyStringMap is not None:
+ d[PyStringMap] = _copy_with_copy_method
+
+def _copy_inst(x):
+ if hasattr(x, '__copy__'):
+ return x.__copy__()
+ if hasattr(x, '__getinitargs__'):
+ args = x.__getinitargs__()
+ y = x.__class__(*args)
+ else:
+ y = _EmptyClass()
+ y.__class__ = x.__class__
+ if hasattr(x, '__getstate__'):
+ state = x.__getstate__()
+ else:
+ state = x.__dict__
+ if hasattr(y, '__setstate__'):
+ y.__setstate__(state)
+ else:
+ y.__dict__.update(state)
+ return y
+d[types.InstanceType] = _copy_inst
+
+del d
+
+def deepcopy(x, memo=None, _nil=[]):
+ """Deep copy operation on arbitrary Python objects.
+
+ See the module's __doc__ string for more info.
+ """
+
+ if memo is None:
+ memo = {}
+
+ d = id(x)
+ y = memo.get(d, _nil)
+ if y is not _nil:
+ return y
+
+ cls = type(x)
+
+ copier = _deepcopy_dispatch.get(cls)
+ if copier:
+ y = copier(x, memo)
+ else:
+ try:
+ issc = issubclass(cls, type)
+ except TypeError: # cls is not a class (old Boost; see SF #502085)
+ issc = 0
+ if issc:
+ y = _deepcopy_atomic(x, memo)
+ else:
+ copier = getattr(x, "__deepcopy__", None)
+ if copier:
+ y = copier(memo)
+ else:
+ reductor = dispatch_table.get(cls)
+ if reductor:
+ rv = reductor(x)
+ else:
+ reductor = getattr(x, "__reduce_ex__", None)
+ if reductor:
+ rv = reductor(2)
+ else:
+ reductor = getattr(x, "__reduce__", None)
+ if reductor:
+ rv = reductor()
+ else:
+ raise Error(
+ "un(deep)copyable object of type %s" % cls)
+ y = _reconstruct(x, rv, 1, memo)
+
+ memo[d] = y
+ _keep_alive(x, memo) # Make sure x lives at least as long as d
+ return y
+
+_deepcopy_dispatch = d = {}
+
+def _deepcopy_atomic(x, memo):
+ return x
+d[type(None)] = _deepcopy_atomic
+d[type(Ellipsis)] = _deepcopy_atomic
+d[int] = _deepcopy_atomic
+d[long] = _deepcopy_atomic
+d[float] = _deepcopy_atomic
+d[bool] = _deepcopy_atomic
+try:
+ d[complex] = _deepcopy_atomic
+except NameError:
+ pass
+d[str] = _deepcopy_atomic
+try:
+ d[unicode] = _deepcopy_atomic
+except NameError:
+ pass
+try:
+ d[types.CodeType] = _deepcopy_atomic
+except AttributeError:
+ pass
+d[type] = _deepcopy_atomic
+d[xrange] = _deepcopy_atomic
+d[types.ClassType] = _deepcopy_atomic
+d[types.BuiltinFunctionType] = _deepcopy_atomic
+d[types.FunctionType] = _deepcopy_atomic
+d[weakref.ref] = _deepcopy_atomic
+
+def _deepcopy_list(x, memo):
+ y = []
+ memo[id(x)] = y
+ for a in x:
+ y.append(deepcopy(a, memo))
+ return y
+d[list] = _deepcopy_list
+
+def _deepcopy_tuple(x, memo):
+ y = []
+ for a in x:
+ y.append(deepcopy(a, memo))
+ d = id(x)
+ try:
+ return memo[d]
+ except KeyError:
+ pass
+ for i in range(len(x)):
+ if x[i] is not y[i]:
+ y = tuple(y)
+ break
+ else:
+ y = x
+ memo[d] = y
+ return y
+d[tuple] = _deepcopy_tuple
+
+def _deepcopy_dict(x, memo):
+ y = {}
+ memo[id(x)] = y
+ for key, value in x.iteritems():
+ y[deepcopy(key, memo)] = deepcopy(value, memo)
+ return y
+d[dict] = _deepcopy_dict
+if PyStringMap is not None:
+ d[PyStringMap] = _deepcopy_dict
+
+def _deepcopy_method(x, memo): # Copy instance methods
+ return type(x)(x.im_func, deepcopy(x.im_self, memo), x.im_class)
+_deepcopy_dispatch[types.MethodType] = _deepcopy_method
+
+def _keep_alive(x, memo):
+ """Keeps a reference to the object x in the memo.
+
+ Because we remember objects by their id, we have
+ to assure that possibly temporary objects are kept
+ alive by referencing them.
+ We store a reference at the id of the memo, which should
+ normally not be used unless someone tries to deepcopy
+ the memo itself...
+ """
+ try:
+ memo[id(memo)].append(x)
+ except KeyError:
+ # aha, this is the first one :-)
+ memo[id(memo)]=[x]
+
+def _deepcopy_inst(x, memo):
+ if hasattr(x, '__deepcopy__'):
+ return x.__deepcopy__(memo)
+ if hasattr(x, '__getinitargs__'):
+ args = x.__getinitargs__()
+ args = deepcopy(args, memo)
+ y = x.__class__(*args)
+ else:
+ y = _EmptyClass()
+ y.__class__ = x.__class__
+ memo[id(x)] = y
+ if hasattr(x, '__getstate__'):
+ state = x.__getstate__()
+ else:
+ state = x.__dict__
+ state = deepcopy(state, memo)
+ if hasattr(y, '__setstate__'):
+ y.__setstate__(state)
+ else:
+ y.__dict__.update(state)
+ return y
+d[types.InstanceType] = _deepcopy_inst
+
+def _reconstruct(x, info, deep, memo=None):
+ if isinstance(info, str):
+ return x
+ assert isinstance(info, tuple)
+ if memo is None:
+ memo = {}
+ n = len(info)
+ assert n in (2, 3, 4, 5)
+ callable, args = info[:2]
+ if n > 2:
+ state = info[2]
+ else:
+ state = {}
+ if n > 3:
+ listiter = info[3]
+ else:
+ listiter = None
+ if n > 4:
+ dictiter = info[4]
+ else:
+ dictiter = None
+ if deep:
+ args = deepcopy(args, memo)
+ y = callable(*args)
+ memo[id(x)] = y
+
+ if state:
+ if deep:
+ state = deepcopy(state, memo)
+ if hasattr(y, '__setstate__'):
+ y.__setstate__(state)
+ else:
+ if isinstance(state, tuple) and len(state) == 2:
+ state, slotstate = state
+ else:
+ slotstate = None
+ if state is not None:
+ y.__dict__.update(state)
+ if slotstate is not None:
+ for key, value in slotstate.iteritems():
+ setattr(y, key, value)
+
+ if listiter is not None:
+ for item in listiter:
+ if deep:
+ item = deepcopy(item, memo)
+ y.append(item)
+ if dictiter is not None:
+ for key, value in dictiter:
+ if deep:
+ key = deepcopy(key, memo)
+ value = deepcopy(value, memo)
+ y[key] = value
+ return y
+
+del d
+
+del types
+
+# Helper for instance creation without calling __init__
+class _EmptyClass:
+ pass
+
+def _test():
+ l = [None, 1, 2L, 3.14, 'xyzzy', (1, 2L), [3.14, 'abc'],
+ {'abc': 'ABC'}, (), [], {}]
+ l1 = copy(l)
+ print l1==l
+ l1 = map(copy, l)
+ print l1==l
+ l1 = deepcopy(l)
+ print l1==l
+ class C:
+ def __init__(self, arg=None):
+ self.a = 1
+ self.arg = arg
+ if __name__ == '__main__':
+ import sys
+ file = sys.argv[0]
+ else:
+ file = __file__
+ self.fp = open(file)
+ self.fp.close()
+ def __getstate__(self):
+ return {'a': self.a, 'arg': self.arg}
+ def __setstate__(self, state):
+ for key, value in state.iteritems():
+ setattr(self, key, value)
+ def __deepcopy__(self, memo=None):
+ new = self.__class__(deepcopy(self.arg, memo))
+ new.a = self.a
+ return new
+ c = C('argument sketch')
+ l.append(c)
+ l2 = copy(l)
+ print l == l2
+ print l
+ print l2
+ l2 = deepcopy(l)
+ print l == l2
+ print l
+ print l2
+ l.append({l[1]: l, 'xyz': l[2]})
+ l3 = copy(l)
+ import repr
+ print map(repr.repr, l)
+ print map(repr.repr, l1)
+ print map(repr.repr, l2)
+ print map(repr.repr, l3)
+ l3 = deepcopy(l)
+ import repr
+ print map(repr.repr, l)
+ print map(repr.repr, l1)
+ print map(repr.repr, l2)
+ print map(repr.repr, l3)
+ class odict(dict):
+ def __init__(self, d = {}):
+ self.a = 99
+ dict.__init__(self, d)
+ def __setitem__(self, k, i):
+ dict.__setitem__(self, k, i)
+ self.a
+ o = odict({"A" : "B"})
+ x = deepcopy(o)
+ print(o, x)
+
+if __name__ == '__main__':
+ _test()
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
index 0000000000..72db74d8a8
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/copy_reg.py
@@ -0,0 +1,201 @@
+"""Helper to provide extensibility for pickle/cPickle.
+
+This is only useful to add pickle support for extension types defined in
+C, not for instances of user-defined classes.
+"""
+
+from types import ClassType as _ClassType
+
+__all__ = ["pickle", "constructor",
+ "add_extension", "remove_extension", "clear_extension_cache"]
+
+dispatch_table = {}
+
+def pickle(ob_type, pickle_function, constructor_ob=None):
+ if type(ob_type) is _ClassType:
+ raise TypeError("copy_reg is not intended for use with classes")
+
+ if not hasattr(pickle_function, '__call__'):
+ raise TypeError("reduction functions must be callable")
+ dispatch_table[ob_type] = pickle_function
+
+ # The constructor_ob function is a vestige of safe for unpickling.
+ # There is no reason for the caller to pass it anymore.
+ if constructor_ob is not None:
+ constructor(constructor_ob)
+
+def constructor(object):
+ if not hasattr(object, '__call__'):
+ raise TypeError("constructors must be callable")
+
+# Example: provide pickling support for complex numbers.
+
+try:
+ complex
+except NameError:
+ pass
+else:
+
+ def pickle_complex(c):
+ return complex, (c.real, c.imag)
+
+ pickle(complex, pickle_complex, complex)
+
+# Support for pickling new-style objects
+
+def _reconstructor(cls, base, state):
+ if base is object:
+ obj = object.__new__(cls)
+ else:
+ obj = base.__new__(cls, state)
+ if base.__init__ != object.__init__:
+ base.__init__(obj, state)
+ return obj
+
+_HEAPTYPE = 1<<9
+
+# Python code for object.__reduce_ex__ for protocols 0 and 1
+
+def _reduce_ex(self, proto):
+ assert proto < 2
+ for base in self.__class__.__mro__:
+ if hasattr(base, '__flags__') and not base.__flags__ & _HEAPTYPE:
+ break
+ else:
+ base = object # not really reachable
+ if base is object:
+ state = None
+ else:
+ if base is self.__class__:
+ raise TypeError, "can't pickle %s objects" % base.__name__
+ state = base(self)
+ args = (self.__class__, base, state)
+ try:
+ getstate = self.__getstate__
+ except AttributeError:
+ if getattr(self, "__slots__", None):
+ raise TypeError("a class that defines __slots__ without "
+ "defining __getstate__ cannot be pickled")
+ try:
+ dict = self.__dict__
+ except AttributeError:
+ dict = None
+ else:
+ dict = getstate()
+ if dict:
+ return _reconstructor, args, dict
+ else:
+ return _reconstructor, args
+
+# Helper for __reduce_ex__ protocol 2
+
+def __newobj__(cls, *args):
+ return cls.__new__(cls, *args)
+
+def _slotnames(cls):
+ """Return a list of slot names for a given class.
+
+ This needs to find slots defined by the class and its bases, so we
+ can't simply return the __slots__ attribute. We must walk down
+ the Method Resolution Order and concatenate the __slots__ of each
+ class found there. (This assumes classes don't modify their
+ __slots__ attribute to misrepresent their slots after the class is
+ defined.)
+ """
+
+ # Get the value from a cache in the class if possible
+ names = cls.__dict__.get("__slotnames__")
+ if names is not None:
+ return names
+
+ # Not cached -- calculate the value
+ names = []
+ if not hasattr(cls, "__slots__"):
+ # This class has no slots
+ pass
+ else:
+ # Slots found -- gather slot names from all base classes
+ for c in cls.__mro__:
+ if "__slots__" in c.__dict__:
+ slots = c.__dict__['__slots__']
+ # if class has a single slot, it can be given as a string
+ if isinstance(slots, basestring):
+ slots = (slots,)
+ for name in slots:
+ # special descriptors
+ if name in ("__dict__", "__weakref__"):
+ continue
+ # mangled names
+ elif name.startswith('__') and not name.endswith('__'):
+ names.append('_%s%s' % (c.__name__, name))
+ else:
+ names.append(name)
+
+ # Cache the outcome in the class if at all possible
+ try:
+ cls.__slotnames__ = names
+ except:
+ pass # But don't die if we can't
+
+ return names
+
+# A registry of extension codes. This is an ad-hoc compression
+# mechanism. Whenever a global reference to <module>, <name> is about
+# to be pickled, the (<module>, <name>) tuple is looked up here to see
+# if it is a registered extension code for it. Extension codes are
+# universal, so that the meaning of a pickle does not depend on
+# context. (There are also some codes reserved for local use that
+# don't have this restriction.) Codes are positive ints; 0 is
+# reserved.
+
+_extension_registry = {} # key -> code
+_inverted_registry = {} # code -> key
+_extension_cache = {} # code -> object
+# Don't ever rebind those names: cPickle grabs a reference to them when
+# it's initialized, and won't see a rebinding.
+
+def add_extension(module, name, code):
+ """Register an extension code."""
+ code = int(code)
+ if not 1 <= code <= 0x7fffffff:
+ raise ValueError, "code out of range"
+ key = (module, name)
+ if (_extension_registry.get(key) == code and
+ _inverted_registry.get(code) == key):
+ return # Redundant registrations are benign
+ if key in _extension_registry:
+ raise ValueError("key %s is already registered with code %s" %
+ (key, _extension_registry[key]))
+ if code in _inverted_registry:
+ raise ValueError("code %s is already in use for key %s" %
+ (code, _inverted_registry[code]))
+ _extension_registry[key] = code
+ _inverted_registry[code] = key
+
+def remove_extension(module, name, code):
+ """Unregister an extension code. For testing only."""
+ key = (module, name)
+ if (_extension_registry.get(key) != code or
+ _inverted_registry.get(code) != key):
+ raise ValueError("key %s is not registered with code %s" %
+ (key, code))
+ del _extension_registry[key]
+ del _inverted_registry[code]
+ if code in _extension_cache:
+ del _extension_cache[code]
+
+def clear_extension_cache():
+ _extension_cache.clear()
+
+# Standard extension code assignments
+
+# Reserved ranges
+
+# First Last Count Purpose
+# 1 127 127 Reserved for Python standard library
+# 128 191 64 Reserved for Zope
+# 192 239 48 Reserved for 3rd parties
+# 240 255 16 Reserved for private use (will never be assigned)
+# 256 Inf Inf Reserved for future assignment
+
+# Extension codes are assigned by the Python Software Foundation.
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
index 0000000000..081df79c8b
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/csv.py
@@ -0,0 +1,456 @@
+
+"""
+csv.py - read/write/investigate CSV files
+"""
+
+import re
+from functools import reduce
+from _csv import Error, __version__, writer, reader, register_dialect, \
+ unregister_dialect, get_dialect, list_dialects, \
+ field_size_limit, \
+ QUOTE_MINIMAL, QUOTE_ALL, QUOTE_NONNUMERIC, QUOTE_NONE, \
+ __doc__
+from _csv import Dialect as _Dialect
+
+try:
+ from cStringIO import StringIO
+except ImportError:
+ from StringIO import StringIO
+
+__all__ = [ "QUOTE_MINIMAL", "QUOTE_ALL", "QUOTE_NONNUMERIC", "QUOTE_NONE",
+ "Error", "Dialect", "__doc__", "excel", "excel_tab",
+ "field_size_limit", "reader", "writer",
+ "register_dialect", "get_dialect", "list_dialects", "Sniffer",
+ "unregister_dialect", "__version__", "DictReader", "DictWriter" ]
+
+class Dialect:
+ """Describe an Excel dialect.
+
+ This must be subclassed (see csv.excel). Valid attributes are:
+ delimiter, quotechar, escapechar, doublequote, skipinitialspace,
+ lineterminator, quoting.
+
+ """
+ _name = ""
+ _valid = False
+ # placeholders
+ delimiter = None
+ quotechar = None
+ escapechar = None
+ doublequote = None
+ skipinitialspace = None
+ lineterminator = None
+ quoting = None
+
+ def __init__(self):
+ if self.__class__ != Dialect:
+ self._valid = True
+ self._validate()
+
+ def _validate(self):
+ try:
+ _Dialect(self)
+ except TypeError, e:
+ # We do this for compatibility with py2.3
+ raise Error(str(e))
+
+class excel(Dialect):
+ """Describe the usual properties of Excel-generated CSV files."""
+ delimiter = ','
+ quotechar = '"'
+ doublequote = True
+ skipinitialspace = False
+ lineterminator = '\r\n'
+ quoting = QUOTE_MINIMAL
+register_dialect("excel", excel)
+
+class excel_tab(excel):
+ """Describe the usual properties of Excel-generated TAB-delimited files."""
+ delimiter = '\t'
+register_dialect("excel-tab", excel_tab)
+
+
+class DictReader:
+ def __init__(self, f, fieldnames=None, restkey=None, restval=None,
+ dialect="excel", *args, **kwds):
+ self._fieldnames = fieldnames # list of keys for the dict
+ self.restkey = restkey # key to catch long rows
+ self.restval = restval # default value for short rows
+ self.reader = reader(f, dialect, *args, **kwds)
+ self.dialect = dialect
+ self.line_num = 0
+
+ def __iter__(self):
+ return self
+
+ @property
+ def fieldnames(self):
+ if self._fieldnames is None:
+ try:
+ self._fieldnames = self.reader.next()
+ except StopIteration:
+ pass
+ self.line_num = self.reader.line_num
+ return self._fieldnames
+
+ # Issue 20004: Because DictReader is a classic class, this setter is
+ # ignored. At this point in 2.7's lifecycle, it is too late to change the
+ # base class for fear of breaking working code. If you want to change
+ # fieldnames without overwriting the getter, set _fieldnames directly.
+ @fieldnames.setter
+ def fieldnames(self, value):
+ self._fieldnames = value
+
+ def next(self):
+ if self.line_num == 0:
+ # Used only for its side effect.
+ self.fieldnames
+ row = self.reader.next()
+ self.line_num = self.reader.line_num
+
+ # unlike the basic reader, we prefer not to return blanks,
+ # because we will typically wind up with a dict full of None
+ # values
+ while row == []:
+ row = self.reader.next()
+ d = dict(zip(self.fieldnames, row))
+ lf = len(self.fieldnames)
+ lr = len(row)
+ if lf < lr:
+ d[self.restkey] = row[lf:]
+ elif lf > lr:
+ for key in self.fieldnames[lr:]:
+ d[key] = self.restval
+ return d
+
+
+class DictWriter:
+ def __init__(self, f, fieldnames, restval="", extrasaction="raise",
+ dialect="excel", *args, **kwds):
+ self.fieldnames = fieldnames # list of keys for the dict
+ self.restval = restval # for writing short dicts
+ if extrasaction.lower() not in ("raise", "ignore"):
+ raise ValueError, \
+ ("extrasaction (%s) must be 'raise' or 'ignore'" %
+ extrasaction)
+ self.extrasaction = extrasaction
+ self.writer = writer(f, dialect, *args, **kwds)
+
+ def writeheader(self):
+ header = dict(zip(self.fieldnames, self.fieldnames))
+ self.writerow(header)
+
+ def _dict_to_list(self, rowdict):
+ if self.extrasaction == "raise":
+ wrong_fields = [k for k in rowdict if k not in self.fieldnames]
+ if wrong_fields:
+ raise ValueError("dict contains fields not in fieldnames: "
+ + ", ".join([repr(x) for x in wrong_fields]))
+ return [rowdict.get(key, self.restval) for key in self.fieldnames]
+
+ def writerow(self, rowdict):
+ return self.writer.writerow(self._dict_to_list(rowdict))
+
+ def writerows(self, rowdicts):
+ rows = []
+ for rowdict in rowdicts:
+ rows.append(self._dict_to_list(rowdict))
+ return self.writer.writerows(rows)
+
+# Guard Sniffer's type checking against builds that exclude complex()
+try:
+ complex
+except NameError:
+ complex = float
+
+class Sniffer:
+ '''
+ "Sniffs" the format of a CSV file (i.e. delimiter, quotechar)
+ Returns a Dialect object.
+ '''
+ def __init__(self):
+ # in case there is more than one possible delimiter
+ self.preferred = [',', '\t', ';', ' ', ':']
+
+
+ def sniff(self, sample, delimiters=None):
+ """
+ Returns a dialect (or None) corresponding to the sample
+ """
+
+ quotechar, doublequote, delimiter, skipinitialspace = \
+ self._guess_quote_and_delimiter(sample, delimiters)
+ if not delimiter:
+ delimiter, skipinitialspace = self._guess_delimiter(sample,
+ delimiters)
+
+ if not delimiter:
+ raise Error, "Could not determine delimiter"
+
+ class dialect(Dialect):
+ _name = "sniffed"
+ lineterminator = '\r\n'
+ quoting = QUOTE_MINIMAL
+ # escapechar = ''
+
+ dialect.doublequote = doublequote
+ dialect.delimiter = delimiter
+ # _csv.reader won't accept a quotechar of ''
+ dialect.quotechar = quotechar or '"'
+ dialect.skipinitialspace = skipinitialspace
+
+ return dialect
+
+
+ def _guess_quote_and_delimiter(self, data, delimiters):
+ """
+ Looks for text enclosed between two identical quotes
+ (the probable quotechar) which are preceded and followed
+ by the same character (the probable delimiter).
+ For example:
+ ,'some text',
+ The quote with the most wins, same with the delimiter.
+ If there is no quotechar the delimiter can't be determined
+ this way.
+ """
+
+ matches = []
+ for restr in ('(?P<delim>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?P=delim)', # ,".*?",
+ '(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?P<delim>[^\w\n"\'])(?P<space> ?)', # ".*?",
+ '(?P<delim>>[^\w\n"\'])(?P<space> ?)(?P<quote>["\']).*?(?P=quote)(?:$|\n)', # ,".*?"
+ '(?:^|\n)(?P<quote>["\']).*?(?P=quote)(?:$|\n)'): # ".*?" (no delim, no space)
+ regexp = re.compile(restr, re.DOTALL | re.MULTILINE)
+ matches = regexp.findall(data)
+ if matches:
+ break
+
+ if not matches:
+ # (quotechar, doublequote, delimiter, skipinitialspace)
+ return ('', False, None, 0)
+ quotes = {}
+ delims = {}
+ spaces = 0
+ for m in matches:
+ n = regexp.groupindex['quote'] - 1
+ key = m[n]
+ if key:
+ quotes[key] = quotes.get(key, 0) + 1
+ try:
+ n = regexp.groupindex['delim'] - 1
+ key = m[n]
+ except KeyError:
+ continue
+ if key and (delimiters is None or key in delimiters):
+ delims[key] = delims.get(key, 0) + 1
+ try:
+ n = regexp.groupindex['space'] - 1
+ except KeyError:
+ continue
+ if m[n]:
+ spaces += 1
+
+ quotechar = reduce(lambda a, b, quotes = quotes:
+ (quotes[a] > quotes[b]) and a or b, quotes.keys())
+
+ if delims:
+ delim = reduce(lambda a, b, delims = delims:
+ (delims[a] > delims[b]) and a or b, delims.keys())
+ skipinitialspace = delims[delim] == spaces
+ if delim == '\n': # most likely a file with a single column
+ delim = ''
+ else:
+ # there is *no* delimiter, it's a single column of quoted data
+ delim = ''
+ skipinitialspace = 0
+
+ # if we see an extra quote between delimiters, we've got a
+ # double quoted format
+ dq_regexp = re.compile(
+ r"((%(delim)s)|^)\W*%(quote)s[^%(delim)s\n]*%(quote)s[^%(delim)s\n]*%(quote)s\W*((%(delim)s)|$)" % \
+ {'delim':re.escape(delim), 'quote':quotechar}, re.MULTILINE)
+
+
+
+ if dq_regexp.search(data):
+ doublequote = True
+ else:
+ doublequote = False
+
+ return (quotechar, doublequote, delim, skipinitialspace)
+
+
+ def _guess_delimiter(self, data, delimiters):
+ """
+ The delimiter /should/ occur the same number of times on
+ each row. However, due to malformed data, it may not. We don't want
+ an all or nothing approach, so we allow for small variations in this
+ number.
+ 1) build a table of the frequency of each character on every line.
+ 2) build a table of frequencies of this frequency (meta-frequency?),
+ e.g. 'x occurred 5 times in 10 rows, 6 times in 1000 rows,
+ 7 times in 2 rows'
+ 3) use the mode of the meta-frequency to determine the /expected/
+ frequency for that character
+ 4) find out how often the character actually meets that goal
+ 5) the character that best meets its goal is the delimiter
+ For performance reasons, the data is evaluated in chunks, so it can
+ try and evaluate the smallest portion of the data possible, evaluating
+ additional chunks as necessary.
+ """
+
+ data = filter(None, data.split('\n'))
+
+ ascii = [chr(c) for c in range(127)] # 7-bit ASCII
+
+ # build frequency tables
+ chunkLength = min(10, len(data))
+ iteration = 0
+ charFrequency = {}
+ modes = {}
+ delims = {}
+ start, end = 0, min(chunkLength, len(data))
+ while start < len(data):
+ iteration += 1
+ for line in data[start:end]:
+ for char in ascii:
+ metaFrequency = charFrequency.get(char, {})
+ # must count even if frequency is 0
+ freq = line.count(char)
+ # value is the mode
+ metaFrequency[freq] = metaFrequency.get(freq, 0) + 1
+ charFrequency[char] = metaFrequency
+
+ for char in charFrequency.keys():
+ items = charFrequency[char].items()
+ if len(items) == 1 and items[0][0] == 0:
+ continue
+ # get the mode of the frequencies
+ if len(items) > 1:
+ modes[char] = reduce(lambda a, b: a[1] > b[1] and a or b,
+ items)
+ # adjust the mode - subtract the sum of all
+ # other frequencies
+ items.remove(modes[char])
+ modes[char] = (modes[char][0], modes[char][1]
+ - reduce(lambda a, b: (0, a[1] + b[1]),
+ items)[1])
+ else:
+ modes[char] = items[0]
+
+ # build a list of possible delimiters
+ modeList = modes.items()
+ total = float(chunkLength * iteration)
+ # (rows of consistent data) / (number of rows) = 100%
+ consistency = 1.0
+ # minimum consistency threshold
+ threshold = 0.9
+ while len(delims) == 0 and consistency >= threshold:
+ for k, v in modeList:
+ if v[0] > 0 and v[1] > 0:
+ if ((v[1]/total) >= consistency and
+ (delimiters is None or k in delimiters)):
+ delims[k] = v
+ consistency -= 0.01
+
+ if len(delims) == 1:
+ delim = delims.keys()[0]
+ skipinitialspace = (data[0].count(delim) ==
+ data[0].count("%c " % delim))
+ return (delim, skipinitialspace)
+
+ # analyze another chunkLength lines
+ start = end
+ end += chunkLength
+
+ if not delims:
+ return ('', 0)
+
+ # if there's more than one, fall back to a 'preferred' list
+ if len(delims) > 1:
+ for d in self.preferred:
+ if d in delims.keys():
+ skipinitialspace = (data[0].count(d) ==
+ data[0].count("%c " % d))
+ return (d, skipinitialspace)
+
+ # nothing else indicates a preference, pick the character that
+ # dominates(?)
+ items = [(v,k) for (k,v) in delims.items()]
+ items.sort()
+ delim = items[-1][1]
+
+ skipinitialspace = (data[0].count(delim) ==
+ data[0].count("%c " % delim))
+ return (delim, skipinitialspace)
+
+
+ def has_header(self, sample):
+ # Creates a dictionary of types of data in each column. If any
+ # column is of a single type (say, integers), *except* for the first
+ # row, then the first row is presumed to be labels. If the type
+ # can't be determined, it is assumed to be a string in which case
+ # the length of the string is the determining factor: if all of the
+ # rows except for the first are the same length, it's a header.
+ # Finally, a 'vote' is taken at the end for each column, adding or
+ # subtracting from the likelihood of the first row being a header.
+
+ rdr = reader(StringIO(sample), self.sniff(sample))
+
+ header = rdr.next() # assume first row is header
+
+ columns = len(header)
+ columnTypes = {}
+ for i in range(columns): columnTypes[i] = None
+
+ checked = 0
+ for row in rdr:
+ # arbitrary number of rows to check, to keep it sane
+ if checked > 20:
+ break
+ checked += 1
+
+ if len(row) != columns:
+ continue # skip rows that have irregular number of columns
+
+ for col in columnTypes.keys():
+
+ for thisType in [int, long, float, complex]:
+ try:
+ thisType(row[col])
+ break
+ except (ValueError, OverflowError):
+ pass
+ else:
+ # fallback to length of string
+ thisType = len(row[col])
+
+ # treat longs as ints
+ if thisType == long:
+ thisType = int
+
+ if thisType != columnTypes[col]:
+ if columnTypes[col] is None: # add new column type
+ columnTypes[col] = thisType
+ else:
+ # type is inconsistent, remove column from
+ # consideration
+ del columnTypes[col]
+
+ # finally, compare results against first row and "vote"
+ # on whether it's a header
+ hasHeader = 0
+ for col, colType in columnTypes.items():
+ if type(colType) == type(0): # it's a length
+ if len(header[col]) != colType:
+ hasHeader += 1
+ else:
+ hasHeader -= 1
+ else: # attempt typecast
+ try:
+ colType(header[col])
+ except (ValueError, TypeError):
+ hasHeader += 1
+ else:
+ hasHeader -= 1
+
+ return hasHeader > 0
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
index 0000000000..cdb9c59dab
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/dis.py
@@ -0,0 +1,224 @@
+"""Disassembler of Python byte code into mnemonics."""
+
+import sys
+import types
+
+from opcode import *
+from opcode import __all__ as _opcodes_all
+
+__all__ = ["dis", "disassemble", "distb", "disco",
+ "findlinestarts", "findlabels"] + _opcodes_all
+del _opcodes_all
+
+_have_code = (types.MethodType, types.FunctionType, types.CodeType,
+ types.ClassType, type)
+
+def dis(x=None):
+ """Disassemble classes, methods, functions, or code.
+
+ With no argument, disassemble the last traceback.
+
+ """
+ if x is None:
+ distb()
+ return
+ if isinstance(x, types.InstanceType):
+ x = x.__class__
+ if hasattr(x, 'im_func'):
+ x = x.im_func
+ if hasattr(x, 'func_code'):
+ x = x.func_code
+ if hasattr(x, '__dict__'):
+ items = x.__dict__.items()
+ items.sort()
+ for name, x1 in items:
+ if isinstance(x1, _have_code):
+ print "Disassembly of %s:" % name
+ try:
+ dis(x1)
+ except TypeError, msg:
+ print "Sorry:", msg
+ print
+ elif hasattr(x, 'co_code'):
+ disassemble(x)
+ elif isinstance(x, str):
+ disassemble_string(x)
+ else:
+ raise TypeError, \
+ "don't know how to disassemble %s objects" % \
+ type(x).__name__
+
+def distb(tb=None):
+ """Disassemble a traceback (default: last traceback)."""
+ if tb is None:
+ try:
+ tb = sys.last_traceback
+ except AttributeError:
+ raise RuntimeError, "no last traceback to disassemble"
+ while tb.tb_next: tb = tb.tb_next
+ disassemble(tb.tb_frame.f_code, tb.tb_lasti)
+
+def disassemble(co, lasti=-1):
+ """Disassemble a code object."""
+ code = co.co_code
+ labels = findlabels(code)
+ linestarts = dict(findlinestarts(co))
+ n = len(code)
+ i = 0
+ extended_arg = 0
+ free = None
+ while i < n:
+ c = code[i]
+ op = ord(c)
+ if i in linestarts:
+ if i > 0:
+ print
+ print "%3d" % linestarts[i],
+ else:
+ print ' ',
+
+ if i == lasti: print '-->',
+ else: print ' ',
+ if i in labels: print '>>',
+ else: print ' ',
+ print repr(i).rjust(4),
+ print opname[op].ljust(20),
+ i = i+1
+ if op >= HAVE_ARGUMENT:
+ oparg = ord(code[i]) + ord(code[i+1])*256 + extended_arg
+ extended_arg = 0
+ i = i+2
+ if op == EXTENDED_ARG:
+ extended_arg = oparg*65536L
+ print repr(oparg).rjust(5),
+ if op in hasconst:
+ print '(' + repr(co.co_consts[oparg]) + ')',
+ elif op in hasname:
+ print '(' + co.co_names[oparg] + ')',
+ elif op in hasjrel:
+ print '(to ' + repr(i + oparg) + ')',
+ elif op in haslocal:
+ print '(' + co.co_varnames[oparg] + ')',
+ elif op in hascompare:
+ print '(' + cmp_op[oparg] + ')',
+ elif op in hasfree:
+ if free is None:
+ free = co.co_cellvars + co.co_freevars
+ print '(' + free[oparg] + ')',
+ print
+
+def disassemble_string(code, lasti=-1, varnames=None, names=None,
+ constants=None):
+ labels = findlabels(code)
+ n = len(code)
+ i = 0
+ while i < n:
+ c = code[i]
+ op = ord(c)
+ if i == lasti: print '-->',
+ else: print ' ',
+ if i in labels: print '>>',
+ else: print ' ',
+ print repr(i).rjust(4),
+ print opname[op].ljust(15),
+ i = i+1
+ if op >= HAVE_ARGUMENT:
+ oparg = ord(code[i]) + ord(code[i+1])*256
+ i = i+2
+ print repr(oparg).rjust(5),
+ if op in hasconst:
+ if constants:
+ print '(' + repr(constants[oparg]) + ')',
+ else:
+ print '(%d)'%oparg,
+ elif op in hasname:
+ if names is not None:
+ print '(' + names[oparg] + ')',
+ else:
+ print '(%d)'%oparg,
+ elif op in hasjrel:
+ print '(to ' + repr(i + oparg) + ')',
+ elif op in haslocal:
+ if varnames:
+ print '(' + varnames[oparg] + ')',
+ else:
+ print '(%d)' % oparg,
+ elif op in hascompare:
+ print '(' + cmp_op[oparg] + ')',
+ print
+
+disco = disassemble # XXX For backwards compatibility
+
+def findlabels(code):
+ """Detect all offsets in a byte code which are jump targets.
+
+ Return the list of offsets.
+
+ """
+ labels = []
+ n = len(code)
+ i = 0
+ while i < n:
+ c = code[i]
+ op = ord(c)
+ i = i+1
+ if op >= HAVE_ARGUMENT:
+ oparg = ord(code[i]) + ord(code[i+1])*256
+ i = i+2
+ label = -1
+ if op in hasjrel:
+ label = i+oparg
+ elif op in hasjabs:
+ label = oparg
+ if label >= 0:
+ if label not in labels:
+ labels.append(label)
+ return labels
+
+def findlinestarts(code):
+ """Find the offsets in a byte code which are start of lines in the source.
+
+ Generate pairs (offset, lineno) as described in Python/compile.c.
+
+ """
+ byte_increments = [ord(c) for c in code.co_lnotab[0::2]]
+ line_increments = [ord(c) for c in code.co_lnotab[1::2]]
+
+ lastlineno = None
+ lineno = code.co_firstlineno
+ addr = 0
+ for byte_incr, line_incr in zip(byte_increments, line_increments):
+ if byte_incr:
+ if lineno != lastlineno:
+ yield (addr, lineno)
+ lastlineno = lineno
+ addr += byte_incr
+ lineno += line_incr
+ if lineno != lastlineno:
+ yield (addr, lineno)
+
+def _test():
+ """Simple test program to disassemble a file."""
+ if sys.argv[1:]:
+ if sys.argv[2:]:
+ sys.stderr.write("usage: python dis.py [-|file]\n")
+ sys.exit(2)
+ fn = sys.argv[1]
+ if not fn or fn == "-":
+ fn = None
+ else:
+ fn = None
+ if fn is None:
+ f = sys.stdin
+ else:
+ f = open(fn)
+ source = f.read()
+ if fn is not None:
+ f.close()
+ else:
+ fn = "<stdin>"
+ code = compile(source, fn, "exec")
+ dis(code)
+
+if __name__ == "__main__":
+ _test()
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
index 0000000000..4b2da7d594
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/dummy_thread.py
@@ -0,0 +1,145 @@
+"""Drop-in replacement for the thread module.
+
+Meant to be used as a brain-dead substitute so that threaded code does
+not need to be rewritten for when the thread module is not present.
+
+Suggested usage is::
+
+ try:
+ import thread
+ except ImportError:
+ import dummy_thread as thread
+
+"""
+# Exports only things specified by thread documentation;
+# skipping obsolete synonyms allocate(), start_new(), exit_thread().
+__all__ = ['error', 'start_new_thread', 'exit', 'get_ident', 'allocate_lock',
+ 'interrupt_main', 'LockType']
+
+import traceback as _traceback
+
+class error(Exception):
+ """Dummy implementation of thread.error."""
+
+ def __init__(self, *args):
+ self.args = args
+
+def start_new_thread(function, args, kwargs={}):
+ """Dummy implementation of thread.start_new_thread().
+
+ Compatibility is maintained by making sure that ``args`` is a
+ tuple and ``kwargs`` is a dictionary. If an exception is raised
+ and it is SystemExit (which can be done by thread.exit()) it is
+ caught and nothing is done; all other exceptions are printed out
+ by using traceback.print_exc().
+
+ If the executed function calls interrupt_main the KeyboardInterrupt will be
+ raised when the function returns.
+
+ """
+ if type(args) != type(tuple()):
+ raise TypeError("2nd arg must be a tuple")
+ if type(kwargs) != type(dict()):
+ raise TypeError("3rd arg must be a dict")
+ global _main
+ _main = False
+ try:
+ function(*args, **kwargs)
+ except SystemExit:
+ pass
+ except:
+ _traceback.print_exc()
+ _main = True
+ global _interrupt
+ if _interrupt:
+ _interrupt = False
+ raise KeyboardInterrupt
+
+def exit():
+ """Dummy implementation of thread.exit()."""
+ raise SystemExit
+
+def get_ident():
+ """Dummy implementation of thread.get_ident().
+
+ Since this module should only be used when threadmodule is not
+ available, it is safe to assume that the current process is the
+ only thread. Thus a constant can be safely returned.
+ """
+ return -1
+
+def allocate_lock():
+ """Dummy implementation of thread.allocate_lock()."""
+ return LockType()
+
+def stack_size(size=None):
+ """Dummy implementation of thread.stack_size()."""
+ if size is not None:
+ raise error("setting thread stack size not supported")
+ return 0
+
+class LockType(object):
+ """Class implementing dummy implementation of thread.LockType.
+
+ Compatibility is maintained by maintaining self.locked_status
+ which is a boolean that stores the state of the lock. Pickling of
+ the lock, though, should not be done since if the thread module is
+ then used with an unpickled ``lock()`` from here problems could
+ occur from this class not having atomic methods.
+
+ """
+
+ def __init__(self):
+ self.locked_status = False
+
+ def acquire(self, waitflag=None):
+ """Dummy implementation of acquire().
+
+ For blocking calls, self.locked_status is automatically set to
+ True and returned appropriately based on value of
+ ``waitflag``. If it is non-blocking, then the value is
+ actually checked and not set if it is already acquired. This
+ is all done so that threading.Condition's assert statements
+ aren't triggered and throw a little fit.
+
+ """
+ if waitflag is None or waitflag:
+ self.locked_status = True
+ return True
+ else:
+ if not self.locked_status:
+ self.locked_status = True
+ return True
+ else:
+ return False
+
+ __enter__ = acquire
+
+ def __exit__(self, typ, val, tb):
+ self.release()
+
+ def release(self):
+ """Release the dummy lock."""
+ # XXX Perhaps shouldn't actually bother to test? Could lead
+ # to problems for complex, threaded code.
+ if not self.locked_status:
+ raise error
+ self.locked_status = False
+ return True
+
+ def locked(self):
+ return self.locked_status
+
+# Used to signal that interrupt_main was called in a "thread"
+_interrupt = False
+# True when not executing in a "thread"
+_main = True
+
+def interrupt_main():
+ """Set _interrupt flag to True to have start_new_thread raise
+ KeyboardInterrupt upon exiting."""
+ if _main:
+ raise KeyboardInterrupt
+ else:
+ global _interrupt
+ _interrupt = True
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
index 0000000000..40e862fc35
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/__init__.py
@@ -0,0 +1,157 @@
+""" Standard "encodings" Package
+
+ Standard Python encoding modules are stored in this package
+ directory.
+
+ Codec modules must have names corresponding to normalized encoding
+ names as defined in the normalize_encoding() function below, e.g.
+ 'utf-8' must be implemented by the module 'utf_8.py'.
+
+ Each codec module must export the following interface:
+
+ * getregentry() -> codecs.CodecInfo object
+ The getregentry() API must a CodecInfo object with encoder, decoder,
+ incrementalencoder, incrementaldecoder, streamwriter and streamreader
+ atttributes which adhere to the Python Codec Interface Standard.
+
+ In addition, a module may optionally also define the following
+ APIs which are then used by the package's codec search function:
+
+ * getaliases() -> sequence of encoding name strings to use as aliases
+
+ Alias names returned by getaliases() must be normalized encoding
+ names as defined by normalize_encoding().
+
+Written by Marc-Andre Lemburg (mal@lemburg.com).
+
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
+
+"""#"
+
+import codecs
+from encodings import aliases
+import __builtin__
+
+_cache = {}
+_unknown = '--unknown--'
+_import_tail = ['*']
+_norm_encoding_map = (' . '
+ '0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ '
+ ' abcdefghijklmnopqrstuvwxyz '
+ ' '
+ ' '
+ ' ')
+_aliases = aliases.aliases
+
+class CodecRegistryError(LookupError, SystemError):
+ pass
+
+def normalize_encoding(encoding):
+
+ """ Normalize an encoding name.
+
+ Normalization works as follows: all non-alphanumeric
+ characters except the dot used for Python package names are
+ collapsed and replaced with a single underscore, e.g. ' -;#'
+ becomes '_'. Leading and trailing underscores are removed.
+
+ Note that encoding names should be ASCII only; if they do use
+ non-ASCII characters, these must be Latin-1 compatible.
+
+ """
+ # Make sure we have an 8-bit string, because .translate() works
+ # differently for Unicode strings.
+ if hasattr(__builtin__, "unicode") and isinstance(encoding, unicode):
+ # Note that .encode('latin-1') does *not* use the codec
+ # registry, so this call doesn't recurse. (See unicodeobject.c
+ # PyUnicode_AsEncodedString() for details)
+ encoding = encoding.encode('latin-1')
+ return '_'.join(encoding.translate(_norm_encoding_map).split())
+
+def search_function(encoding):
+
+ # Cache lookup
+ entry = _cache.get(encoding, _unknown)
+ if entry is not _unknown:
+ return entry
+
+ # Import the module:
+ #
+ # First try to find an alias for the normalized encoding
+ # name and lookup the module using the aliased name, then try to
+ # lookup the module using the standard import scheme, i.e. first
+ # try in the encodings package, then at top-level.
+ #
+ norm_encoding = normalize_encoding(encoding)
+ aliased_encoding = _aliases.get(norm_encoding) or \
+ _aliases.get(norm_encoding.replace('.', '_'))
+ if aliased_encoding is not None:
+ modnames = [aliased_encoding,
+ norm_encoding]
+ else:
+ modnames = [norm_encoding]
+ for modname in modnames:
+ if not modname or '.' in modname:
+ continue
+ try:
+ # Import is absolute to prevent the possibly malicious import of a
+ # module with side-effects that is not in the 'encodings' package.
+ mod = __import__('encodings.' + modname, fromlist=_import_tail,
+ level=0)
+ except ImportError:
+ pass
+ else:
+ break
+ else:
+ mod = None
+
+ try:
+ getregentry = mod.getregentry
+ except AttributeError:
+ # Not a codec module
+ mod = None
+
+ if mod is None:
+ # Cache misses
+ _cache[encoding] = None
+ return None
+
+ # Now ask the module for the registry entry
+ entry = getregentry()
+ if not isinstance(entry, codecs.CodecInfo):
+ if not 4 <= len(entry) <= 7:
+ raise CodecRegistryError,\
+ 'module "%s" (%s) failed to register' % \
+ (mod.__name__, mod.__file__)
+ if not hasattr(entry[0], '__call__') or \
+ not hasattr(entry[1], '__call__') or \
+ (entry[2] is not None and not hasattr(entry[2], '__call__')) or \
+ (entry[3] is not None and not hasattr(entry[3], '__call__')) or \
+ (len(entry) > 4 and entry[4] is not None and not hasattr(entry[4], '__call__')) or \
+ (len(entry) > 5 and entry[5] is not None and not hasattr(entry[5], '__call__')):
+ raise CodecRegistryError,\
+ 'incompatible codecs in module "%s" (%s)' % \
+ (mod.__name__, mod.__file__)
+ if len(entry)<7 or entry[6] is None:
+ entry += (None,)*(6-len(entry)) + (mod.__name__.split(".", 1)[1],)
+ entry = codecs.CodecInfo(*entry)
+
+ # Cache the codec registry entry
+ _cache[encoding] = entry
+
+ # Register its aliases (without overwriting previously registered
+ # aliases)
+ try:
+ codecaliases = mod.getaliases()
+ except AttributeError:
+ pass
+ else:
+ for alias in codecaliases:
+ if alias not in _aliases:
+ _aliases[alias] = modname
+
+ # Return the registry entry
+ return entry
+
+# Register the search_function in the Python codec registry
+codecs.register(search_function)
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
index 0000000000..ff8011bb5f
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/aliases.py
@@ -0,0 +1,527 @@
+""" Encoding Aliases Support
+
+ This module is used by the encodings package search function to
+ map encodings names to module names.
+
+ Note that the search function normalizes the encoding names before
+ doing the lookup, so the mapping will have to map normalized
+ encoding names to module names.
+
+ Contents:
+
+ The following aliases dictionary contains mappings of all IANA
+ character set names for which the Python core library provides
+ codecs. In addition to these, a few Python specific codec
+ aliases have also been added.
+
+"""
+aliases = {
+
+ # Please keep this list sorted alphabetically by value !
+
+ # ascii codec
+ '646' : 'ascii',
+ 'ansi_x3.4_1968' : 'ascii',
+ 'ansi_x3_4_1968' : 'ascii', # some email headers use this non-standard name
+ 'ansi_x3.4_1986' : 'ascii',
+ 'cp367' : 'ascii',
+ 'csascii' : 'ascii',
+ 'ibm367' : 'ascii',
+ 'iso646_us' : 'ascii',
+ 'iso_646.irv_1991' : 'ascii',
+ 'iso_ir_6' : 'ascii',
+ 'us' : 'ascii',
+ 'us_ascii' : 'ascii',
+
+ # base64_codec codec
+ 'base64' : 'base64_codec',
+ 'base_64' : 'base64_codec',
+
+ # big5 codec
+ 'big5_tw' : 'big5',
+ 'csbig5' : 'big5',
+
+ # big5hkscs codec
+ 'big5_hkscs' : 'big5hkscs',
+ 'hkscs' : 'big5hkscs',
+
+ # bz2_codec codec
+ 'bz2' : 'bz2_codec',
+
+ # cp037 codec
+ '037' : 'cp037',
+ 'csibm037' : 'cp037',
+ 'ebcdic_cp_ca' : 'cp037',
+ 'ebcdic_cp_nl' : 'cp037',
+ 'ebcdic_cp_us' : 'cp037',
+ 'ebcdic_cp_wt' : 'cp037',
+ 'ibm037' : 'cp037',
+ 'ibm039' : 'cp037',
+
+ # cp1026 codec
+ '1026' : 'cp1026',
+ 'csibm1026' : 'cp1026',
+ 'ibm1026' : 'cp1026',
+
+ # cp1140 codec
+ '1140' : 'cp1140',
+ 'ibm1140' : 'cp1140',
+
+ # cp1250 codec
+ '1250' : 'cp1250',
+ 'windows_1250' : 'cp1250',
+
+ # cp1251 codec
+ '1251' : 'cp1251',
+ 'windows_1251' : 'cp1251',
+
+ # cp1252 codec
+ '1252' : 'cp1252',
+ 'windows_1252' : 'cp1252',
+
+ # cp1253 codec
+ '1253' : 'cp1253',
+ 'windows_1253' : 'cp1253',
+
+ # cp1254 codec
+ '1254' : 'cp1254',
+ 'windows_1254' : 'cp1254',
+
+ # cp1255 codec
+ '1255' : 'cp1255',
+ 'windows_1255' : 'cp1255',
+
+ # cp1256 codec
+ '1256' : 'cp1256',
+ 'windows_1256' : 'cp1256',
+
+ # cp1257 codec
+ '1257' : 'cp1257',
+ 'windows_1257' : 'cp1257',
+
+ # cp1258 codec
+ '1258' : 'cp1258',
+ 'windows_1258' : 'cp1258',
+
+ # cp424 codec
+ '424' : 'cp424',
+ 'csibm424' : 'cp424',
+ 'ebcdic_cp_he' : 'cp424',
+ 'ibm424' : 'cp424',
+
+ # cp437 codec
+ '437' : 'cp437',
+ 'cspc8codepage437' : 'cp437',
+ 'ibm437' : 'cp437',
+
+ # cp500 codec
+ '500' : 'cp500',
+ 'csibm500' : 'cp500',
+ 'ebcdic_cp_be' : 'cp500',
+ 'ebcdic_cp_ch' : 'cp500',
+ 'ibm500' : 'cp500',
+
+ # cp775 codec
+ '775' : 'cp775',
+ 'cspc775baltic' : 'cp775',
+ 'ibm775' : 'cp775',
+
+ # cp850 codec
+ '850' : 'cp850',
+ 'cspc850multilingual' : 'cp850',
+ 'ibm850' : 'cp850',
+
+ # cp852 codec
+ '852' : 'cp852',
+ 'cspcp852' : 'cp852',
+ 'ibm852' : 'cp852',
+
+ # cp855 codec
+ '855' : 'cp855',
+ 'csibm855' : 'cp855',
+ 'ibm855' : 'cp855',
+
+ # cp857 codec
+ '857' : 'cp857',
+ 'csibm857' : 'cp857',
+ 'ibm857' : 'cp857',
+
+ # cp858 codec
+ '858' : 'cp858',
+ 'csibm858' : 'cp858',
+ 'ibm858' : 'cp858',
+
+ # cp860 codec
+ '860' : 'cp860',
+ 'csibm860' : 'cp860',
+ 'ibm860' : 'cp860',
+
+ # cp861 codec
+ '861' : 'cp861',
+ 'cp_is' : 'cp861',
+ 'csibm861' : 'cp861',
+ 'ibm861' : 'cp861',
+
+ # cp862 codec
+ '862' : 'cp862',
+ 'cspc862latinhebrew' : 'cp862',
+ 'ibm862' : 'cp862',
+
+ # cp863 codec
+ '863' : 'cp863',
+ 'csibm863' : 'cp863',
+ 'ibm863' : 'cp863',
+
+ # cp864 codec
+ '864' : 'cp864',
+ 'csibm864' : 'cp864',
+ 'ibm864' : 'cp864',
+
+ # cp865 codec
+ '865' : 'cp865',
+ 'csibm865' : 'cp865',
+ 'ibm865' : 'cp865',
+
+ # cp866 codec
+ '866' : 'cp866',
+ 'csibm866' : 'cp866',
+ 'ibm866' : 'cp866',
+
+ # cp869 codec
+ '869' : 'cp869',
+ 'cp_gr' : 'cp869',
+ 'csibm869' : 'cp869',
+ 'ibm869' : 'cp869',
+
+ # cp932 codec
+ '932' : 'cp932',
+ 'ms932' : 'cp932',
+ 'mskanji' : 'cp932',
+ 'ms_kanji' : 'cp932',
+
+ # cp949 codec
+ '949' : 'cp949',
+ 'ms949' : 'cp949',
+ 'uhc' : 'cp949',
+
+ # cp950 codec
+ '950' : 'cp950',
+ 'ms950' : 'cp950',
+
+ # euc_jis_2004 codec
+ 'jisx0213' : 'euc_jis_2004',
+ 'eucjis2004' : 'euc_jis_2004',
+ 'euc_jis2004' : 'euc_jis_2004',
+
+ # euc_jisx0213 codec
+ 'eucjisx0213' : 'euc_jisx0213',
+
+ # euc_jp codec
+ 'eucjp' : 'euc_jp',
+ 'ujis' : 'euc_jp',
+ 'u_jis' : 'euc_jp',
+
+ # euc_kr codec
+ 'euckr' : 'euc_kr',
+ 'korean' : 'euc_kr',
+ 'ksc5601' : 'euc_kr',
+ 'ks_c_5601' : 'euc_kr',
+ 'ks_c_5601_1987' : 'euc_kr',
+ 'ksx1001' : 'euc_kr',
+ 'ks_x_1001' : 'euc_kr',
+
+ # gb18030 codec
+ 'gb18030_2000' : 'gb18030',
+
+ # gb2312 codec
+ 'chinese' : 'gb2312',
+ 'csiso58gb231280' : 'gb2312',
+ 'euc_cn' : 'gb2312',
+ 'euccn' : 'gb2312',
+ 'eucgb2312_cn' : 'gb2312',
+ 'gb2312_1980' : 'gb2312',
+ 'gb2312_80' : 'gb2312',
+ 'iso_ir_58' : 'gb2312',
+
+ # gbk codec
+ '936' : 'gbk',
+ 'cp936' : 'gbk',
+ 'ms936' : 'gbk',
+
+ # hex_codec codec
+ 'hex' : 'hex_codec',
+
+ # hp_roman8 codec
+ 'roman8' : 'hp_roman8',
+ 'r8' : 'hp_roman8',
+ 'csHPRoman8' : 'hp_roman8',
+
+ # hz codec
+ 'hzgb' : 'hz',
+ 'hz_gb' : 'hz',
+ 'hz_gb_2312' : 'hz',
+
+ # iso2022_jp codec
+ 'csiso2022jp' : 'iso2022_jp',
+ 'iso2022jp' : 'iso2022_jp',
+ 'iso_2022_jp' : 'iso2022_jp',
+
+ # iso2022_jp_1 codec
+ 'iso2022jp_1' : 'iso2022_jp_1',
+ 'iso_2022_jp_1' : 'iso2022_jp_1',
+
+ # iso2022_jp_2 codec
+ 'iso2022jp_2' : 'iso2022_jp_2',
+ 'iso_2022_jp_2' : 'iso2022_jp_2',
+
+ # iso2022_jp_2004 codec
+ 'iso_2022_jp_2004' : 'iso2022_jp_2004',
+ 'iso2022jp_2004' : 'iso2022_jp_2004',
+
+ # iso2022_jp_3 codec
+ 'iso2022jp_3' : 'iso2022_jp_3',
+ 'iso_2022_jp_3' : 'iso2022_jp_3',
+
+ # iso2022_jp_ext codec
+ 'iso2022jp_ext' : 'iso2022_jp_ext',
+ 'iso_2022_jp_ext' : 'iso2022_jp_ext',
+
+ # iso2022_kr codec
+ 'csiso2022kr' : 'iso2022_kr',
+ 'iso2022kr' : 'iso2022_kr',
+ 'iso_2022_kr' : 'iso2022_kr',
+
+ # iso8859_10 codec
+ 'csisolatin6' : 'iso8859_10',
+ 'iso_8859_10' : 'iso8859_10',
+ 'iso_8859_10_1992' : 'iso8859_10',
+ 'iso_ir_157' : 'iso8859_10',
+ 'l6' : 'iso8859_10',
+ 'latin6' : 'iso8859_10',
+
+ # iso8859_11 codec
+ 'thai' : 'iso8859_11',
+ 'iso_8859_11' : 'iso8859_11',
+ 'iso_8859_11_2001' : 'iso8859_11',
+
+ # iso8859_13 codec
+ 'iso_8859_13' : 'iso8859_13',
+ 'l7' : 'iso8859_13',
+ 'latin7' : 'iso8859_13',
+
+ # iso8859_14 codec
+ 'iso_8859_14' : 'iso8859_14',
+ 'iso_8859_14_1998' : 'iso8859_14',
+ 'iso_celtic' : 'iso8859_14',
+ 'iso_ir_199' : 'iso8859_14',
+ 'l8' : 'iso8859_14',
+ 'latin8' : 'iso8859_14',
+
+ # iso8859_15 codec
+ 'iso_8859_15' : 'iso8859_15',
+ 'l9' : 'iso8859_15',
+ 'latin9' : 'iso8859_15',
+
+ # iso8859_16 codec
+ 'iso_8859_16' : 'iso8859_16',
+ 'iso_8859_16_2001' : 'iso8859_16',
+ 'iso_ir_226' : 'iso8859_16',
+ 'l10' : 'iso8859_16',
+ 'latin10' : 'iso8859_16',
+
+ # iso8859_2 codec
+ 'csisolatin2' : 'iso8859_2',
+ 'iso_8859_2' : 'iso8859_2',
+ 'iso_8859_2_1987' : 'iso8859_2',
+ 'iso_ir_101' : 'iso8859_2',
+ 'l2' : 'iso8859_2',
+ 'latin2' : 'iso8859_2',
+
+ # iso8859_3 codec
+ 'csisolatin3' : 'iso8859_3',
+ 'iso_8859_3' : 'iso8859_3',
+ 'iso_8859_3_1988' : 'iso8859_3',
+ 'iso_ir_109' : 'iso8859_3',
+ 'l3' : 'iso8859_3',
+ 'latin3' : 'iso8859_3',
+
+ # iso8859_4 codec
+ 'csisolatin4' : 'iso8859_4',
+ 'iso_8859_4' : 'iso8859_4',
+ 'iso_8859_4_1988' : 'iso8859_4',
+ 'iso_ir_110' : 'iso8859_4',
+ 'l4' : 'iso8859_4',
+ 'latin4' : 'iso8859_4',
+
+ # iso8859_5 codec
+ 'csisolatincyrillic' : 'iso8859_5',
+ 'cyrillic' : 'iso8859_5',
+ 'iso_8859_5' : 'iso8859_5',
+ 'iso_8859_5_1988' : 'iso8859_5',
+ 'iso_ir_144' : 'iso8859_5',
+
+ # iso8859_6 codec
+ 'arabic' : 'iso8859_6',
+ 'asmo_708' : 'iso8859_6',
+ 'csisolatinarabic' : 'iso8859_6',
+ 'ecma_114' : 'iso8859_6',
+ 'iso_8859_6' : 'iso8859_6',
+ 'iso_8859_6_1987' : 'iso8859_6',
+ 'iso_ir_127' : 'iso8859_6',
+
+ # iso8859_7 codec
+ 'csisolatingreek' : 'iso8859_7',
+ 'ecma_118' : 'iso8859_7',
+ 'elot_928' : 'iso8859_7',
+ 'greek' : 'iso8859_7',
+ 'greek8' : 'iso8859_7',
+ 'iso_8859_7' : 'iso8859_7',
+ 'iso_8859_7_1987' : 'iso8859_7',
+ 'iso_ir_126' : 'iso8859_7',
+
+ # iso8859_8 codec
+ 'csisolatinhebrew' : 'iso8859_8',
+ 'hebrew' : 'iso8859_8',
+ 'iso_8859_8' : 'iso8859_8',
+ 'iso_8859_8_1988' : 'iso8859_8',
+ 'iso_ir_138' : 'iso8859_8',
+
+ # iso8859_9 codec
+ 'csisolatin5' : 'iso8859_9',
+ 'iso_8859_9' : 'iso8859_9',
+ 'iso_8859_9_1989' : 'iso8859_9',
+ 'iso_ir_148' : 'iso8859_9',
+ 'l5' : 'iso8859_9',
+ 'latin5' : 'iso8859_9',
+
+ # johab codec
+ 'cp1361' : 'johab',
+ 'ms1361' : 'johab',
+
+ # koi8_r codec
+ 'cskoi8r' : 'koi8_r',
+
+ # latin_1 codec
+ #
+ # Note that the latin_1 codec is implemented internally in C and a
+ # lot faster than the charmap codec iso8859_1 which uses the same
+ # encoding. This is why we discourage the use of the iso8859_1
+ # codec and alias it to latin_1 instead.
+ #
+ '8859' : 'latin_1',
+ 'cp819' : 'latin_1',
+ 'csisolatin1' : 'latin_1',
+ 'ibm819' : 'latin_1',
+ 'iso8859' : 'latin_1',
+ 'iso8859_1' : 'latin_1',
+ 'iso_8859_1' : 'latin_1',
+ 'iso_8859_1_1987' : 'latin_1',
+ 'iso_ir_100' : 'latin_1',
+ 'l1' : 'latin_1',
+ 'latin' : 'latin_1',
+ 'latin1' : 'latin_1',
+
+ # mac_cyrillic codec
+ 'maccyrillic' : 'mac_cyrillic',
+
+ # mac_greek codec
+ 'macgreek' : 'mac_greek',
+
+ # mac_iceland codec
+ 'maciceland' : 'mac_iceland',
+
+ # mac_latin2 codec
+ 'maccentraleurope' : 'mac_latin2',
+ 'maclatin2' : 'mac_latin2',
+
+ # mac_roman codec
+ 'macroman' : 'mac_roman',
+
+ # mac_turkish codec
+ 'macturkish' : 'mac_turkish',
+
+ # mbcs codec
+ 'dbcs' : 'mbcs',
+
+ # ptcp154 codec
+ 'csptcp154' : 'ptcp154',
+ 'pt154' : 'ptcp154',
+ 'cp154' : 'ptcp154',
+ 'cyrillic_asian' : 'ptcp154',
+
+ # quopri_codec codec
+ 'quopri' : 'quopri_codec',
+ 'quoted_printable' : 'quopri_codec',
+ 'quotedprintable' : 'quopri_codec',
+
+ # rot_13 codec
+ 'rot13' : 'rot_13',
+
+ # shift_jis codec
+ 'csshiftjis' : 'shift_jis',
+ 'shiftjis' : 'shift_jis',
+ 'sjis' : 'shift_jis',
+ 's_jis' : 'shift_jis',
+
+ # shift_jis_2004 codec
+ 'shiftjis2004' : 'shift_jis_2004',
+ 'sjis_2004' : 'shift_jis_2004',
+ 's_jis_2004' : 'shift_jis_2004',
+
+ # shift_jisx0213 codec
+ 'shiftjisx0213' : 'shift_jisx0213',
+ 'sjisx0213' : 'shift_jisx0213',
+ 's_jisx0213' : 'shift_jisx0213',
+
+ # tactis codec
+ 'tis260' : 'tactis',
+
+ # tis_620 codec
+ 'tis620' : 'tis_620',
+ 'tis_620_0' : 'tis_620',
+ 'tis_620_2529_0' : 'tis_620',
+ 'tis_620_2529_1' : 'tis_620',
+ 'iso_ir_166' : 'tis_620',
+
+ # utf_16 codec
+ 'u16' : 'utf_16',
+ 'utf16' : 'utf_16',
+
+ # utf_16_be codec
+ 'unicodebigunmarked' : 'utf_16_be',
+ 'utf_16be' : 'utf_16_be',
+
+ # utf_16_le codec
+ 'unicodelittleunmarked' : 'utf_16_le',
+ 'utf_16le' : 'utf_16_le',
+
+ # utf_32 codec
+ 'u32' : 'utf_32',
+ 'utf32' : 'utf_32',
+
+ # utf_32_be codec
+ 'utf_32be' : 'utf_32_be',
+
+ # utf_32_le codec
+ 'utf_32le' : 'utf_32_le',
+
+ # utf_7 codec
+ 'u7' : 'utf_7',
+ 'utf7' : 'utf_7',
+ 'unicode_1_1_utf_7' : 'utf_7',
+
+ # utf_8 codec
+ 'u8' : 'utf_8',
+ 'utf' : 'utf_8',
+ 'utf8' : 'utf_8',
+ 'utf8_ucs2' : 'utf_8',
+ 'utf8_ucs4' : 'utf_8',
+
+ # uu_codec codec
+ 'uu' : 'uu_codec',
+
+ # zlib_codec codec
+ 'zip' : 'zlib_codec',
+ 'zlib' : 'zlib_codec',
+
+}
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
index 0000000000..df0d66d4a7
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/ascii.py
@@ -0,0 +1,50 @@
+""" Python 'ascii' Codec
+
+
+Written by Marc-Andre Lemburg (mal@lemburg.com).
+
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
+
+"""
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ # Note: Binding these as C functions will result in the class not
+ # converting them to methods. This is intended.
+ encode = codecs.ascii_encode
+ decode = codecs.ascii_decode
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.ascii_encode(input, self.errors)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.ascii_decode(input, self.errors)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+class StreamConverter(StreamWriter,StreamReader):
+
+ encode = codecs.ascii_decode
+ decode = codecs.ascii_encode
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='ascii',
+ encode=Codec.encode,
+ decode=Codec.decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamwriter=StreamWriter,
+ streamreader=StreamReader,
+ )
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
index 0000000000..209263796a
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/base64_codec.py
@@ -0,0 +1,79 @@
+""" Python 'base64_codec' Codec - base64 content transfer encoding
+
+ Unlike most of the other codecs which target Unicode, this codec
+ will return Python string objects for both encode and decode.
+
+ Written by Marc-Andre Lemburg (mal@lemburg.com).
+
+"""
+import codecs, base64
+
+### Codec APIs
+
+def base64_encode(input,errors='strict'):
+
+ """ Encodes the object input and returns a tuple (output
+ object, length consumed).
+
+ errors defines the error handling to apply. It defaults to
+ 'strict' handling which is the only currently supported
+ error handling for this codec.
+
+ """
+ assert errors == 'strict'
+ output = base64.encodestring(input)
+ return (output, len(input))
+
+def base64_decode(input,errors='strict'):
+
+ """ Decodes the object input and returns a tuple (output
+ object, length consumed).
+
+ input must be an object which provides the bf_getreadbuf
+ buffer slot. Python strings, buffer objects and memory
+ mapped files are examples of objects providing this slot.
+
+ errors defines the error handling to apply. It defaults to
+ 'strict' handling which is the only currently supported
+ error handling for this codec.
+
+ """
+ assert errors == 'strict'
+ output = base64.decodestring(input)
+ return (output, len(input))
+
+class Codec(codecs.Codec):
+
+ def encode(self, input,errors='strict'):
+ return base64_encode(input,errors)
+ def decode(self, input,errors='strict'):
+ return base64_decode(input,errors)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ assert self.errors == 'strict'
+ return base64.encodestring(input)
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ assert self.errors == 'strict'
+ return base64.decodestring(input)
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='base64',
+ encode=base64_encode,
+ decode=base64_decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamwriter=StreamWriter,
+ streamreader=StreamReader,
+ )
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
index 0000000000..1be2c297dd
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/big5.py
@@ -0,0 +1,39 @@
+#
+# big5.py: Python Unicode Codec for BIG5
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_tw, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_tw.getcodec('big5')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='big5',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..ddfcaa6b3d
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/big5hkscs.py
@@ -0,0 +1,39 @@
+#
+# big5hkscs.py: Python Unicode Codec for BIG5HKSCS
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_hk, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_hk.getcodec('big5hkscs')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='big5hkscs',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..04020db7eb
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/bz2_codec.py
@@ -0,0 +1,102 @@
+""" Python 'bz2_codec' Codec - bz2 compression encoding
+
+ Unlike most of the other codecs which target Unicode, this codec
+ will return Python string objects for both encode and decode.
+
+ Adapted by Raymond Hettinger from zlib_codec.py which was written
+ by Marc-Andre Lemburg (mal@lemburg.com).
+
+"""
+import codecs
+import bz2 # this codec needs the optional bz2 module !
+
+### Codec APIs
+
+def bz2_encode(input,errors='strict'):
+
+ """ Encodes the object input and returns a tuple (output
+ object, length consumed).
+
+ errors defines the error handling to apply. It defaults to
+ 'strict' handling which is the only currently supported
+ error handling for this codec.
+
+ """
+ assert errors == 'strict'
+ output = bz2.compress(input)
+ return (output, len(input))
+
+def bz2_decode(input,errors='strict'):
+
+ """ Decodes the object input and returns a tuple (output
+ object, length consumed).
+
+ input must be an object which provides the bf_getreadbuf
+ buffer slot. Python strings, buffer objects and memory
+ mapped files are examples of objects providing this slot.
+
+ errors defines the error handling to apply. It defaults to
+ 'strict' handling which is the only currently supported
+ error handling for this codec.
+
+ """
+ assert errors == 'strict'
+ output = bz2.decompress(input)
+ return (output, len(input))
+
+class Codec(codecs.Codec):
+
+ def encode(self, input, errors='strict'):
+ return bz2_encode(input, errors)
+ def decode(self, input, errors='strict'):
+ return bz2_decode(input, errors)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def __init__(self, errors='strict'):
+ assert errors == 'strict'
+ self.errors = errors
+ self.compressobj = bz2.BZ2Compressor()
+
+ def encode(self, input, final=False):
+ if final:
+ c = self.compressobj.compress(input)
+ return c + self.compressobj.flush()
+ else:
+ return self.compressobj.compress(input)
+
+ def reset(self):
+ self.compressobj = bz2.BZ2Compressor()
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def __init__(self, errors='strict'):
+ assert errors == 'strict'
+ self.errors = errors
+ self.decompressobj = bz2.BZ2Decompressor()
+
+ def decode(self, input, final=False):
+ try:
+ return self.decompressobj.decompress(input)
+ except EOFError:
+ return ''
+
+ def reset(self):
+ self.decompressobj = bz2.BZ2Decompressor()
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name="bz2",
+ encode=bz2_encode,
+ decode=bz2_decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamwriter=StreamWriter,
+ streamreader=StreamReader,
+ )
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
index 0000000000..96974938b0
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/charmap.py
@@ -0,0 +1,69 @@
+""" Generic Python Character Mapping Codec.
+
+ Use this codec directly rather than through the automatic
+ conversion mechanisms supplied by unicode() and .encode().
+
+
+Written by Marc-Andre Lemburg (mal@lemburg.com).
+
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ # Note: Binding these as C functions will result in the class not
+ # converting them to methods. This is intended.
+ encode = codecs.charmap_encode
+ decode = codecs.charmap_decode
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def __init__(self, errors='strict', mapping=None):
+ codecs.IncrementalEncoder.__init__(self, errors)
+ self.mapping = mapping
+
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input, self.errors, self.mapping)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def __init__(self, errors='strict', mapping=None):
+ codecs.IncrementalDecoder.__init__(self, errors)
+ self.mapping = mapping
+
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input, self.errors, self.mapping)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+
+ def __init__(self,stream,errors='strict',mapping=None):
+ codecs.StreamWriter.__init__(self,stream,errors)
+ self.mapping = mapping
+
+ def encode(self,input,errors='strict'):
+ return Codec.encode(input,errors,self.mapping)
+
+class StreamReader(Codec,codecs.StreamReader):
+
+ def __init__(self,stream,errors='strict',mapping=None):
+ codecs.StreamReader.__init__(self,stream,errors)
+ self.mapping = mapping
+
+ def decode(self,input,errors='strict'):
+ return Codec.decode(input,errors,self.mapping)
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='charmap',
+ encode=Codec.encode,
+ decode=Codec.decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamwriter=StreamWriter,
+ streamreader=StreamReader,
+ )
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
index 0000000000..c617a60ef4
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp037.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp037 generated from 'MAPPINGS/VENDORS/MICSFT/EBCDIC/CP037.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp037',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x9c' # 0x04 -> CONTROL
+ u'\t' # 0x05 -> HORIZONTAL TABULATION
+ u'\x86' # 0x06 -> CONTROL
+ u'\x7f' # 0x07 -> DELETE
+ u'\x97' # 0x08 -> CONTROL
+ u'\x8d' # 0x09 -> CONTROL
+ u'\x8e' # 0x0A -> CONTROL
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x9d' # 0x14 -> CONTROL
+ u'\x85' # 0x15 -> CONTROL
+ u'\x08' # 0x16 -> BACKSPACE
+ u'\x87' # 0x17 -> CONTROL
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x92' # 0x1A -> CONTROL
+ u'\x8f' # 0x1B -> CONTROL
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u'\x80' # 0x20 -> CONTROL
+ u'\x81' # 0x21 -> CONTROL
+ u'\x82' # 0x22 -> CONTROL
+ u'\x83' # 0x23 -> CONTROL
+ u'\x84' # 0x24 -> CONTROL
+ u'\n' # 0x25 -> LINE FEED
+ u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK
+ u'\x1b' # 0x27 -> ESCAPE
+ u'\x88' # 0x28 -> CONTROL
+ u'\x89' # 0x29 -> CONTROL
+ u'\x8a' # 0x2A -> CONTROL
+ u'\x8b' # 0x2B -> CONTROL
+ u'\x8c' # 0x2C -> CONTROL
+ u'\x05' # 0x2D -> ENQUIRY
+ u'\x06' # 0x2E -> ACKNOWLEDGE
+ u'\x07' # 0x2F -> BELL
+ u'\x90' # 0x30 -> CONTROL
+ u'\x91' # 0x31 -> CONTROL
+ u'\x16' # 0x32 -> SYNCHRONOUS IDLE
+ u'\x93' # 0x33 -> CONTROL
+ u'\x94' # 0x34 -> CONTROL
+ u'\x95' # 0x35 -> CONTROL
+ u'\x96' # 0x36 -> CONTROL
+ u'\x04' # 0x37 -> END OF TRANSMISSION
+ u'\x98' # 0x38 -> CONTROL
+ u'\x99' # 0x39 -> CONTROL
+ u'\x9a' # 0x3A -> CONTROL
+ u'\x9b' # 0x3B -> CONTROL
+ u'\x14' # 0x3C -> DEVICE CONTROL FOUR
+ u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE
+ u'\x9e' # 0x3E -> CONTROL
+ u'\x1a' # 0x3F -> SUBSTITUTE
+ u' ' # 0x40 -> SPACE
+ u'\xa0' # 0x41 -> NO-BREAK SPACE
+ u'\xe2' # 0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe4' # 0x43 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe0' # 0x44 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe1' # 0x45 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe3' # 0x46 -> LATIN SMALL LETTER A WITH TILDE
+ u'\xe5' # 0x47 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe7' # 0x48 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xf1' # 0x49 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xa2' # 0x4A -> CENT SIGN
+ u'.' # 0x4B -> FULL STOP
+ u'<' # 0x4C -> LESS-THAN SIGN
+ u'(' # 0x4D -> LEFT PARENTHESIS
+ u'+' # 0x4E -> PLUS SIGN
+ u'|' # 0x4F -> VERTICAL LINE
+ u'&' # 0x50 -> AMPERSAND
+ u'\xe9' # 0x51 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xea' # 0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x53 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xe8' # 0x54 -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xed' # 0x55 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xee' # 0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0x57 -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xec' # 0x58 -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xdf' # 0x59 -> LATIN SMALL LETTER SHARP S (GERMAN)
+ u'!' # 0x5A -> EXCLAMATION MARK
+ u'$' # 0x5B -> DOLLAR SIGN
+ u'*' # 0x5C -> ASTERISK
+ u')' # 0x5D -> RIGHT PARENTHESIS
+ u';' # 0x5E -> SEMICOLON
+ u'\xac' # 0x5F -> NOT SIGN
+ u'-' # 0x60 -> HYPHEN-MINUS
+ u'/' # 0x61 -> SOLIDUS
+ u'\xc2' # 0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xc4' # 0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc0' # 0x64 -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xc1' # 0x65 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc3' # 0x66 -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\xc5' # 0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc7' # 0x68 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xd1' # 0x69 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xa6' # 0x6A -> BROKEN BAR
+ u',' # 0x6B -> COMMA
+ u'%' # 0x6C -> PERCENT SIGN
+ u'_' # 0x6D -> LOW LINE
+ u'>' # 0x6E -> GREATER-THAN SIGN
+ u'?' # 0x6F -> QUESTION MARK
+ u'\xf8' # 0x70 -> LATIN SMALL LETTER O WITH STROKE
+ u'\xc9' # 0x71 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xca' # 0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xcb' # 0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xc8' # 0x74 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xcd' # 0x75 -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\xcc' # 0x78 -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'`' # 0x79 -> GRAVE ACCENT
+ u':' # 0x7A -> COLON
+ u'#' # 0x7B -> NUMBER SIGN
+ u'@' # 0x7C -> COMMERCIAL AT
+ u"'" # 0x7D -> APOSTROPHE
+ u'=' # 0x7E -> EQUALS SIGN
+ u'"' # 0x7F -> QUOTATION MARK
+ u'\xd8' # 0x80 -> LATIN CAPITAL LETTER O WITH STROKE
+ u'a' # 0x81 -> LATIN SMALL LETTER A
+ u'b' # 0x82 -> LATIN SMALL LETTER B
+ u'c' # 0x83 -> LATIN SMALL LETTER C
+ u'd' # 0x84 -> LATIN SMALL LETTER D
+ u'e' # 0x85 -> LATIN SMALL LETTER E
+ u'f' # 0x86 -> LATIN SMALL LETTER F
+ u'g' # 0x87 -> LATIN SMALL LETTER G
+ u'h' # 0x88 -> LATIN SMALL LETTER H
+ u'i' # 0x89 -> LATIN SMALL LETTER I
+ u'\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xf0' # 0x8C -> LATIN SMALL LETTER ETH (ICELANDIC)
+ u'\xfd' # 0x8D -> LATIN SMALL LETTER Y WITH ACUTE
+ u'\xfe' # 0x8E -> LATIN SMALL LETTER THORN (ICELANDIC)
+ u'\xb1' # 0x8F -> PLUS-MINUS SIGN
+ u'\xb0' # 0x90 -> DEGREE SIGN
+ u'j' # 0x91 -> LATIN SMALL LETTER J
+ u'k' # 0x92 -> LATIN SMALL LETTER K
+ u'l' # 0x93 -> LATIN SMALL LETTER L
+ u'm' # 0x94 -> LATIN SMALL LETTER M
+ u'n' # 0x95 -> LATIN SMALL LETTER N
+ u'o' # 0x96 -> LATIN SMALL LETTER O
+ u'p' # 0x97 -> LATIN SMALL LETTER P
+ u'q' # 0x98 -> LATIN SMALL LETTER Q
+ u'r' # 0x99 -> LATIN SMALL LETTER R
+ u'\xaa' # 0x9A -> FEMININE ORDINAL INDICATOR
+ u'\xba' # 0x9B -> MASCULINE ORDINAL INDICATOR
+ u'\xe6' # 0x9C -> LATIN SMALL LIGATURE AE
+ u'\xb8' # 0x9D -> CEDILLA
+ u'\xc6' # 0x9E -> LATIN CAPITAL LIGATURE AE
+ u'\xa4' # 0x9F -> CURRENCY SIGN
+ u'\xb5' # 0xA0 -> MICRO SIGN
+ u'~' # 0xA1 -> TILDE
+ u's' # 0xA2 -> LATIN SMALL LETTER S
+ u't' # 0xA3 -> LATIN SMALL LETTER T
+ u'u' # 0xA4 -> LATIN SMALL LETTER U
+ u'v' # 0xA5 -> LATIN SMALL LETTER V
+ u'w' # 0xA6 -> LATIN SMALL LETTER W
+ u'x' # 0xA7 -> LATIN SMALL LETTER X
+ u'y' # 0xA8 -> LATIN SMALL LETTER Y
+ u'z' # 0xA9 -> LATIN SMALL LETTER Z
+ u'\xa1' # 0xAA -> INVERTED EXCLAMATION MARK
+ u'\xbf' # 0xAB -> INVERTED QUESTION MARK
+ u'\xd0' # 0xAC -> LATIN CAPITAL LETTER ETH (ICELANDIC)
+ u'\xdd' # 0xAD -> LATIN CAPITAL LETTER Y WITH ACUTE
+ u'\xde' # 0xAE -> LATIN CAPITAL LETTER THORN (ICELANDIC)
+ u'\xae' # 0xAF -> REGISTERED SIGN
+ u'^' # 0xB0 -> CIRCUMFLEX ACCENT
+ u'\xa3' # 0xB1 -> POUND SIGN
+ u'\xa5' # 0xB2 -> YEN SIGN
+ u'\xb7' # 0xB3 -> MIDDLE DOT
+ u'\xa9' # 0xB4 -> COPYRIGHT SIGN
+ u'\xa7' # 0xB5 -> SECTION SIGN
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER
+ u'\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF
+ u'\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS
+ u'[' # 0xBA -> LEFT SQUARE BRACKET
+ u']' # 0xBB -> RIGHT SQUARE BRACKET
+ u'\xaf' # 0xBC -> MACRON
+ u'\xa8' # 0xBD -> DIAERESIS
+ u'\xb4' # 0xBE -> ACUTE ACCENT
+ u'\xd7' # 0xBF -> MULTIPLICATION SIGN
+ u'{' # 0xC0 -> LEFT CURLY BRACKET
+ u'A' # 0xC1 -> LATIN CAPITAL LETTER A
+ u'B' # 0xC2 -> LATIN CAPITAL LETTER B
+ u'C' # 0xC3 -> LATIN CAPITAL LETTER C
+ u'D' # 0xC4 -> LATIN CAPITAL LETTER D
+ u'E' # 0xC5 -> LATIN CAPITAL LETTER E
+ u'F' # 0xC6 -> LATIN CAPITAL LETTER F
+ u'G' # 0xC7 -> LATIN CAPITAL LETTER G
+ u'H' # 0xC8 -> LATIN CAPITAL LETTER H
+ u'I' # 0xC9 -> LATIN CAPITAL LETTER I
+ u'\xad' # 0xCA -> SOFT HYPHEN
+ u'\xf4' # 0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf6' # 0xCC -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf2' # 0xCD -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xf3' # 0xCE -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf5' # 0xCF -> LATIN SMALL LETTER O WITH TILDE
+ u'}' # 0xD0 -> RIGHT CURLY BRACKET
+ u'J' # 0xD1 -> LATIN CAPITAL LETTER J
+ u'K' # 0xD2 -> LATIN CAPITAL LETTER K
+ u'L' # 0xD3 -> LATIN CAPITAL LETTER L
+ u'M' # 0xD4 -> LATIN CAPITAL LETTER M
+ u'N' # 0xD5 -> LATIN CAPITAL LETTER N
+ u'O' # 0xD6 -> LATIN CAPITAL LETTER O
+ u'P' # 0xD7 -> LATIN CAPITAL LETTER P
+ u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q
+ u'R' # 0xD9 -> LATIN CAPITAL LETTER R
+ u'\xb9' # 0xDA -> SUPERSCRIPT ONE
+ u'\xfb' # 0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0xDC -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xf9' # 0xDD -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfa' # 0xDE -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xff' # 0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS
+ u'\\' # 0xE0 -> REVERSE SOLIDUS
+ u'\xf7' # 0xE1 -> DIVISION SIGN
+ u'S' # 0xE2 -> LATIN CAPITAL LETTER S
+ u'T' # 0xE3 -> LATIN CAPITAL LETTER T
+ u'U' # 0xE4 -> LATIN CAPITAL LETTER U
+ u'V' # 0xE5 -> LATIN CAPITAL LETTER V
+ u'W' # 0xE6 -> LATIN CAPITAL LETTER W
+ u'X' # 0xE7 -> LATIN CAPITAL LETTER X
+ u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z
+ u'\xb2' # 0xEA -> SUPERSCRIPT TWO
+ u'\xd4' # 0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\xd6' # 0xEC -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xd2' # 0xED -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd5' # 0xEF -> LATIN CAPITAL LETTER O WITH TILDE
+ u'0' # 0xF0 -> DIGIT ZERO
+ u'1' # 0xF1 -> DIGIT ONE
+ u'2' # 0xF2 -> DIGIT TWO
+ u'3' # 0xF3 -> DIGIT THREE
+ u'4' # 0xF4 -> DIGIT FOUR
+ u'5' # 0xF5 -> DIGIT FIVE
+ u'6' # 0xF6 -> DIGIT SIX
+ u'7' # 0xF7 -> DIGIT SEVEN
+ u'8' # 0xF8 -> DIGIT EIGHT
+ u'9' # 0xF9 -> DIGIT NINE
+ u'\xb3' # 0xFA -> SUPERSCRIPT THREE
+ u'\xdb' # 0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xdc' # 0xFC -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xd9' # 0xFD -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\xda' # 0xFE -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\x9f' # 0xFF -> CONTROL
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..c649b76198
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1006.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1006 generated from 'MAPPINGS/VENDORS/MISC/CP1006.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp1006',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\x80' # 0x80 -> <control>
+ u'\x81' # 0x81 -> <control>
+ u'\x82' # 0x82 -> <control>
+ u'\x83' # 0x83 -> <control>
+ u'\x84' # 0x84 -> <control>
+ u'\x85' # 0x85 -> <control>
+ u'\x86' # 0x86 -> <control>
+ u'\x87' # 0x87 -> <control>
+ u'\x88' # 0x88 -> <control>
+ u'\x89' # 0x89 -> <control>
+ u'\x8a' # 0x8A -> <control>
+ u'\x8b' # 0x8B -> <control>
+ u'\x8c' # 0x8C -> <control>
+ u'\x8d' # 0x8D -> <control>
+ u'\x8e' # 0x8E -> <control>
+ u'\x8f' # 0x8F -> <control>
+ u'\x90' # 0x90 -> <control>
+ u'\x91' # 0x91 -> <control>
+ u'\x92' # 0x92 -> <control>
+ u'\x93' # 0x93 -> <control>
+ u'\x94' # 0x94 -> <control>
+ u'\x95' # 0x95 -> <control>
+ u'\x96' # 0x96 -> <control>
+ u'\x97' # 0x97 -> <control>
+ u'\x98' # 0x98 -> <control>
+ u'\x99' # 0x99 -> <control>
+ u'\x9a' # 0x9A -> <control>
+ u'\x9b' # 0x9B -> <control>
+ u'\x9c' # 0x9C -> <control>
+ u'\x9d' # 0x9D -> <control>
+ u'\x9e' # 0x9E -> <control>
+ u'\x9f' # 0x9F -> <control>
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\u06f0' # 0xA1 -> EXTENDED ARABIC-INDIC DIGIT ZERO
+ u'\u06f1' # 0xA2 -> EXTENDED ARABIC-INDIC DIGIT ONE
+ u'\u06f2' # 0xA3 -> EXTENDED ARABIC-INDIC DIGIT TWO
+ u'\u06f3' # 0xA4 -> EXTENDED ARABIC-INDIC DIGIT THREE
+ u'\u06f4' # 0xA5 -> EXTENDED ARABIC-INDIC DIGIT FOUR
+ u'\u06f5' # 0xA6 -> EXTENDED ARABIC-INDIC DIGIT FIVE
+ u'\u06f6' # 0xA7 -> EXTENDED ARABIC-INDIC DIGIT SIX
+ u'\u06f7' # 0xA8 -> EXTENDED ARABIC-INDIC DIGIT SEVEN
+ u'\u06f8' # 0xA9 -> EXTENDED ARABIC-INDIC DIGIT EIGHT
+ u'\u06f9' # 0xAA -> EXTENDED ARABIC-INDIC DIGIT NINE
+ u'\u060c' # 0xAB -> ARABIC COMMA
+ u'\u061b' # 0xAC -> ARABIC SEMICOLON
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\u061f' # 0xAE -> ARABIC QUESTION MARK
+ u'\ufe81' # 0xAF -> ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM
+ u'\ufe8d' # 0xB0 -> ARABIC LETTER ALEF ISOLATED FORM
+ u'\ufe8e' # 0xB1 -> ARABIC LETTER ALEF FINAL FORM
+ u'\ufe8e' # 0xB2 -> ARABIC LETTER ALEF FINAL FORM
+ u'\ufe8f' # 0xB3 -> ARABIC LETTER BEH ISOLATED FORM
+ u'\ufe91' # 0xB4 -> ARABIC LETTER BEH INITIAL FORM
+ u'\ufb56' # 0xB5 -> ARABIC LETTER PEH ISOLATED FORM
+ u'\ufb58' # 0xB6 -> ARABIC LETTER PEH INITIAL FORM
+ u'\ufe93' # 0xB7 -> ARABIC LETTER TEH MARBUTA ISOLATED FORM
+ u'\ufe95' # 0xB8 -> ARABIC LETTER TEH ISOLATED FORM
+ u'\ufe97' # 0xB9 -> ARABIC LETTER TEH INITIAL FORM
+ u'\ufb66' # 0xBA -> ARABIC LETTER TTEH ISOLATED FORM
+ u'\ufb68' # 0xBB -> ARABIC LETTER TTEH INITIAL FORM
+ u'\ufe99' # 0xBC -> ARABIC LETTER THEH ISOLATED FORM
+ u'\ufe9b' # 0xBD -> ARABIC LETTER THEH INITIAL FORM
+ u'\ufe9d' # 0xBE -> ARABIC LETTER JEEM ISOLATED FORM
+ u'\ufe9f' # 0xBF -> ARABIC LETTER JEEM INITIAL FORM
+ u'\ufb7a' # 0xC0 -> ARABIC LETTER TCHEH ISOLATED FORM
+ u'\ufb7c' # 0xC1 -> ARABIC LETTER TCHEH INITIAL FORM
+ u'\ufea1' # 0xC2 -> ARABIC LETTER HAH ISOLATED FORM
+ u'\ufea3' # 0xC3 -> ARABIC LETTER HAH INITIAL FORM
+ u'\ufea5' # 0xC4 -> ARABIC LETTER KHAH ISOLATED FORM
+ u'\ufea7' # 0xC5 -> ARABIC LETTER KHAH INITIAL FORM
+ u'\ufea9' # 0xC6 -> ARABIC LETTER DAL ISOLATED FORM
+ u'\ufb84' # 0xC7 -> ARABIC LETTER DAHAL ISOLATED FORMN
+ u'\ufeab' # 0xC8 -> ARABIC LETTER THAL ISOLATED FORM
+ u'\ufead' # 0xC9 -> ARABIC LETTER REH ISOLATED FORM
+ u'\ufb8c' # 0xCA -> ARABIC LETTER RREH ISOLATED FORM
+ u'\ufeaf' # 0xCB -> ARABIC LETTER ZAIN ISOLATED FORM
+ u'\ufb8a' # 0xCC -> ARABIC LETTER JEH ISOLATED FORM
+ u'\ufeb1' # 0xCD -> ARABIC LETTER SEEN ISOLATED FORM
+ u'\ufeb3' # 0xCE -> ARABIC LETTER SEEN INITIAL FORM
+ u'\ufeb5' # 0xCF -> ARABIC LETTER SHEEN ISOLATED FORM
+ u'\ufeb7' # 0xD0 -> ARABIC LETTER SHEEN INITIAL FORM
+ u'\ufeb9' # 0xD1 -> ARABIC LETTER SAD ISOLATED FORM
+ u'\ufebb' # 0xD2 -> ARABIC LETTER SAD INITIAL FORM
+ u'\ufebd' # 0xD3 -> ARABIC LETTER DAD ISOLATED FORM
+ u'\ufebf' # 0xD4 -> ARABIC LETTER DAD INITIAL FORM
+ u'\ufec1' # 0xD5 -> ARABIC LETTER TAH ISOLATED FORM
+ u'\ufec5' # 0xD6 -> ARABIC LETTER ZAH ISOLATED FORM
+ u'\ufec9' # 0xD7 -> ARABIC LETTER AIN ISOLATED FORM
+ u'\ufeca' # 0xD8 -> ARABIC LETTER AIN FINAL FORM
+ u'\ufecb' # 0xD9 -> ARABIC LETTER AIN INITIAL FORM
+ u'\ufecc' # 0xDA -> ARABIC LETTER AIN MEDIAL FORM
+ u'\ufecd' # 0xDB -> ARABIC LETTER GHAIN ISOLATED FORM
+ u'\ufece' # 0xDC -> ARABIC LETTER GHAIN FINAL FORM
+ u'\ufecf' # 0xDD -> ARABIC LETTER GHAIN INITIAL FORM
+ u'\ufed0' # 0xDE -> ARABIC LETTER GHAIN MEDIAL FORM
+ u'\ufed1' # 0xDF -> ARABIC LETTER FEH ISOLATED FORM
+ u'\ufed3' # 0xE0 -> ARABIC LETTER FEH INITIAL FORM
+ u'\ufed5' # 0xE1 -> ARABIC LETTER QAF ISOLATED FORM
+ u'\ufed7' # 0xE2 -> ARABIC LETTER QAF INITIAL FORM
+ u'\ufed9' # 0xE3 -> ARABIC LETTER KAF ISOLATED FORM
+ u'\ufedb' # 0xE4 -> ARABIC LETTER KAF INITIAL FORM
+ u'\ufb92' # 0xE5 -> ARABIC LETTER GAF ISOLATED FORM
+ u'\ufb94' # 0xE6 -> ARABIC LETTER GAF INITIAL FORM
+ u'\ufedd' # 0xE7 -> ARABIC LETTER LAM ISOLATED FORM
+ u'\ufedf' # 0xE8 -> ARABIC LETTER LAM INITIAL FORM
+ u'\ufee0' # 0xE9 -> ARABIC LETTER LAM MEDIAL FORM
+ u'\ufee1' # 0xEA -> ARABIC LETTER MEEM ISOLATED FORM
+ u'\ufee3' # 0xEB -> ARABIC LETTER MEEM INITIAL FORM
+ u'\ufb9e' # 0xEC -> ARABIC LETTER NOON GHUNNA ISOLATED FORM
+ u'\ufee5' # 0xED -> ARABIC LETTER NOON ISOLATED FORM
+ u'\ufee7' # 0xEE -> ARABIC LETTER NOON INITIAL FORM
+ u'\ufe85' # 0xEF -> ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM
+ u'\ufeed' # 0xF0 -> ARABIC LETTER WAW ISOLATED FORM
+ u'\ufba6' # 0xF1 -> ARABIC LETTER HEH GOAL ISOLATED FORM
+ u'\ufba8' # 0xF2 -> ARABIC LETTER HEH GOAL INITIAL FORM
+ u'\ufba9' # 0xF3 -> ARABIC LETTER HEH GOAL MEDIAL FORM
+ u'\ufbaa' # 0xF4 -> ARABIC LETTER HEH DOACHASHMEE ISOLATED FORM
+ u'\ufe80' # 0xF5 -> ARABIC LETTER HAMZA ISOLATED FORM
+ u'\ufe89' # 0xF6 -> ARABIC LETTER YEH WITH HAMZA ABOVE ISOLATED FORM
+ u'\ufe8a' # 0xF7 -> ARABIC LETTER YEH WITH HAMZA ABOVE FINAL FORM
+ u'\ufe8b' # 0xF8 -> ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM
+ u'\ufef1' # 0xF9 -> ARABIC LETTER YEH ISOLATED FORM
+ u'\ufef2' # 0xFA -> ARABIC LETTER YEH FINAL FORM
+ u'\ufef3' # 0xFB -> ARABIC LETTER YEH INITIAL FORM
+ u'\ufbb0' # 0xFC -> ARABIC LETTER YEH BARREE WITH HAMZA ABOVE ISOLATED FORM
+ u'\ufbae' # 0xFD -> ARABIC LETTER YEH BARREE ISOLATED FORM
+ u'\ufe7c' # 0xFE -> ARABIC SHADDA ISOLATED FORM
+ u'\ufe7d' # 0xFF -> ARABIC SHADDA MEDIAL FORM
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..bc2a890972
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1026.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1026 generated from 'MAPPINGS/VENDORS/MICSFT/EBCDIC/CP1026.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp1026',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x9c' # 0x04 -> CONTROL
+ u'\t' # 0x05 -> HORIZONTAL TABULATION
+ u'\x86' # 0x06 -> CONTROL
+ u'\x7f' # 0x07 -> DELETE
+ u'\x97' # 0x08 -> CONTROL
+ u'\x8d' # 0x09 -> CONTROL
+ u'\x8e' # 0x0A -> CONTROL
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x9d' # 0x14 -> CONTROL
+ u'\x85' # 0x15 -> CONTROL
+ u'\x08' # 0x16 -> BACKSPACE
+ u'\x87' # 0x17 -> CONTROL
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x92' # 0x1A -> CONTROL
+ u'\x8f' # 0x1B -> CONTROL
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u'\x80' # 0x20 -> CONTROL
+ u'\x81' # 0x21 -> CONTROL
+ u'\x82' # 0x22 -> CONTROL
+ u'\x83' # 0x23 -> CONTROL
+ u'\x84' # 0x24 -> CONTROL
+ u'\n' # 0x25 -> LINE FEED
+ u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK
+ u'\x1b' # 0x27 -> ESCAPE
+ u'\x88' # 0x28 -> CONTROL
+ u'\x89' # 0x29 -> CONTROL
+ u'\x8a' # 0x2A -> CONTROL
+ u'\x8b' # 0x2B -> CONTROL
+ u'\x8c' # 0x2C -> CONTROL
+ u'\x05' # 0x2D -> ENQUIRY
+ u'\x06' # 0x2E -> ACKNOWLEDGE
+ u'\x07' # 0x2F -> BELL
+ u'\x90' # 0x30 -> CONTROL
+ u'\x91' # 0x31 -> CONTROL
+ u'\x16' # 0x32 -> SYNCHRONOUS IDLE
+ u'\x93' # 0x33 -> CONTROL
+ u'\x94' # 0x34 -> CONTROL
+ u'\x95' # 0x35 -> CONTROL
+ u'\x96' # 0x36 -> CONTROL
+ u'\x04' # 0x37 -> END OF TRANSMISSION
+ u'\x98' # 0x38 -> CONTROL
+ u'\x99' # 0x39 -> CONTROL
+ u'\x9a' # 0x3A -> CONTROL
+ u'\x9b' # 0x3B -> CONTROL
+ u'\x14' # 0x3C -> DEVICE CONTROL FOUR
+ u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE
+ u'\x9e' # 0x3E -> CONTROL
+ u'\x1a' # 0x3F -> SUBSTITUTE
+ u' ' # 0x40 -> SPACE
+ u'\xa0' # 0x41 -> NO-BREAK SPACE
+ u'\xe2' # 0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe4' # 0x43 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe0' # 0x44 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe1' # 0x45 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe3' # 0x46 -> LATIN SMALL LETTER A WITH TILDE
+ u'\xe5' # 0x47 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'{' # 0x48 -> LEFT CURLY BRACKET
+ u'\xf1' # 0x49 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xc7' # 0x4A -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'.' # 0x4B -> FULL STOP
+ u'<' # 0x4C -> LESS-THAN SIGN
+ u'(' # 0x4D -> LEFT PARENTHESIS
+ u'+' # 0x4E -> PLUS SIGN
+ u'!' # 0x4F -> EXCLAMATION MARK
+ u'&' # 0x50 -> AMPERSAND
+ u'\xe9' # 0x51 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xea' # 0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x53 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xe8' # 0x54 -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xed' # 0x55 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xee' # 0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0x57 -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xec' # 0x58 -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xdf' # 0x59 -> LATIN SMALL LETTER SHARP S (GERMAN)
+ u'\u011e' # 0x5A -> LATIN CAPITAL LETTER G WITH BREVE
+ u'\u0130' # 0x5B -> LATIN CAPITAL LETTER I WITH DOT ABOVE
+ u'*' # 0x5C -> ASTERISK
+ u')' # 0x5D -> RIGHT PARENTHESIS
+ u';' # 0x5E -> SEMICOLON
+ u'^' # 0x5F -> CIRCUMFLEX ACCENT
+ u'-' # 0x60 -> HYPHEN-MINUS
+ u'/' # 0x61 -> SOLIDUS
+ u'\xc2' # 0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xc4' # 0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc0' # 0x64 -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xc1' # 0x65 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc3' # 0x66 -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\xc5' # 0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'[' # 0x68 -> LEFT SQUARE BRACKET
+ u'\xd1' # 0x69 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\u015f' # 0x6A -> LATIN SMALL LETTER S WITH CEDILLA
+ u',' # 0x6B -> COMMA
+ u'%' # 0x6C -> PERCENT SIGN
+ u'_' # 0x6D -> LOW LINE
+ u'>' # 0x6E -> GREATER-THAN SIGN
+ u'?' # 0x6F -> QUESTION MARK
+ u'\xf8' # 0x70 -> LATIN SMALL LETTER O WITH STROKE
+ u'\xc9' # 0x71 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xca' # 0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xcb' # 0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xc8' # 0x74 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xcd' # 0x75 -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\xcc' # 0x78 -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'\u0131' # 0x79 -> LATIN SMALL LETTER DOTLESS I
+ u':' # 0x7A -> COLON
+ u'\xd6' # 0x7B -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\u015e' # 0x7C -> LATIN CAPITAL LETTER S WITH CEDILLA
+ u"'" # 0x7D -> APOSTROPHE
+ u'=' # 0x7E -> EQUALS SIGN
+ u'\xdc' # 0x7F -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xd8' # 0x80 -> LATIN CAPITAL LETTER O WITH STROKE
+ u'a' # 0x81 -> LATIN SMALL LETTER A
+ u'b' # 0x82 -> LATIN SMALL LETTER B
+ u'c' # 0x83 -> LATIN SMALL LETTER C
+ u'd' # 0x84 -> LATIN SMALL LETTER D
+ u'e' # 0x85 -> LATIN SMALL LETTER E
+ u'f' # 0x86 -> LATIN SMALL LETTER F
+ u'g' # 0x87 -> LATIN SMALL LETTER G
+ u'h' # 0x88 -> LATIN SMALL LETTER H
+ u'i' # 0x89 -> LATIN SMALL LETTER I
+ u'\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'}' # 0x8C -> RIGHT CURLY BRACKET
+ u'`' # 0x8D -> GRAVE ACCENT
+ u'\xa6' # 0x8E -> BROKEN BAR
+ u'\xb1' # 0x8F -> PLUS-MINUS SIGN
+ u'\xb0' # 0x90 -> DEGREE SIGN
+ u'j' # 0x91 -> LATIN SMALL LETTER J
+ u'k' # 0x92 -> LATIN SMALL LETTER K
+ u'l' # 0x93 -> LATIN SMALL LETTER L
+ u'm' # 0x94 -> LATIN SMALL LETTER M
+ u'n' # 0x95 -> LATIN SMALL LETTER N
+ u'o' # 0x96 -> LATIN SMALL LETTER O
+ u'p' # 0x97 -> LATIN SMALL LETTER P
+ u'q' # 0x98 -> LATIN SMALL LETTER Q
+ u'r' # 0x99 -> LATIN SMALL LETTER R
+ u'\xaa' # 0x9A -> FEMININE ORDINAL INDICATOR
+ u'\xba' # 0x9B -> MASCULINE ORDINAL INDICATOR
+ u'\xe6' # 0x9C -> LATIN SMALL LIGATURE AE
+ u'\xb8' # 0x9D -> CEDILLA
+ u'\xc6' # 0x9E -> LATIN CAPITAL LIGATURE AE
+ u'\xa4' # 0x9F -> CURRENCY SIGN
+ u'\xb5' # 0xA0 -> MICRO SIGN
+ u'\xf6' # 0xA1 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u's' # 0xA2 -> LATIN SMALL LETTER S
+ u't' # 0xA3 -> LATIN SMALL LETTER T
+ u'u' # 0xA4 -> LATIN SMALL LETTER U
+ u'v' # 0xA5 -> LATIN SMALL LETTER V
+ u'w' # 0xA6 -> LATIN SMALL LETTER W
+ u'x' # 0xA7 -> LATIN SMALL LETTER X
+ u'y' # 0xA8 -> LATIN SMALL LETTER Y
+ u'z' # 0xA9 -> LATIN SMALL LETTER Z
+ u'\xa1' # 0xAA -> INVERTED EXCLAMATION MARK
+ u'\xbf' # 0xAB -> INVERTED QUESTION MARK
+ u']' # 0xAC -> RIGHT SQUARE BRACKET
+ u'$' # 0xAD -> DOLLAR SIGN
+ u'@' # 0xAE -> COMMERCIAL AT
+ u'\xae' # 0xAF -> REGISTERED SIGN
+ u'\xa2' # 0xB0 -> CENT SIGN
+ u'\xa3' # 0xB1 -> POUND SIGN
+ u'\xa5' # 0xB2 -> YEN SIGN
+ u'\xb7' # 0xB3 -> MIDDLE DOT
+ u'\xa9' # 0xB4 -> COPYRIGHT SIGN
+ u'\xa7' # 0xB5 -> SECTION SIGN
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER
+ u'\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF
+ u'\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS
+ u'\xac' # 0xBA -> NOT SIGN
+ u'|' # 0xBB -> VERTICAL LINE
+ u'\xaf' # 0xBC -> MACRON
+ u'\xa8' # 0xBD -> DIAERESIS
+ u'\xb4' # 0xBE -> ACUTE ACCENT
+ u'\xd7' # 0xBF -> MULTIPLICATION SIGN
+ u'\xe7' # 0xC0 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'A' # 0xC1 -> LATIN CAPITAL LETTER A
+ u'B' # 0xC2 -> LATIN CAPITAL LETTER B
+ u'C' # 0xC3 -> LATIN CAPITAL LETTER C
+ u'D' # 0xC4 -> LATIN CAPITAL LETTER D
+ u'E' # 0xC5 -> LATIN CAPITAL LETTER E
+ u'F' # 0xC6 -> LATIN CAPITAL LETTER F
+ u'G' # 0xC7 -> LATIN CAPITAL LETTER G
+ u'H' # 0xC8 -> LATIN CAPITAL LETTER H
+ u'I' # 0xC9 -> LATIN CAPITAL LETTER I
+ u'\xad' # 0xCA -> SOFT HYPHEN
+ u'\xf4' # 0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'~' # 0xCC -> TILDE
+ u'\xf2' # 0xCD -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xf3' # 0xCE -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf5' # 0xCF -> LATIN SMALL LETTER O WITH TILDE
+ u'\u011f' # 0xD0 -> LATIN SMALL LETTER G WITH BREVE
+ u'J' # 0xD1 -> LATIN CAPITAL LETTER J
+ u'K' # 0xD2 -> LATIN CAPITAL LETTER K
+ u'L' # 0xD3 -> LATIN CAPITAL LETTER L
+ u'M' # 0xD4 -> LATIN CAPITAL LETTER M
+ u'N' # 0xD5 -> LATIN CAPITAL LETTER N
+ u'O' # 0xD6 -> LATIN CAPITAL LETTER O
+ u'P' # 0xD7 -> LATIN CAPITAL LETTER P
+ u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q
+ u'R' # 0xD9 -> LATIN CAPITAL LETTER R
+ u'\xb9' # 0xDA -> SUPERSCRIPT ONE
+ u'\xfb' # 0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\\' # 0xDC -> REVERSE SOLIDUS
+ u'\xf9' # 0xDD -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfa' # 0xDE -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xff' # 0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS
+ u'\xfc' # 0xE0 -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xf7' # 0xE1 -> DIVISION SIGN
+ u'S' # 0xE2 -> LATIN CAPITAL LETTER S
+ u'T' # 0xE3 -> LATIN CAPITAL LETTER T
+ u'U' # 0xE4 -> LATIN CAPITAL LETTER U
+ u'V' # 0xE5 -> LATIN CAPITAL LETTER V
+ u'W' # 0xE6 -> LATIN CAPITAL LETTER W
+ u'X' # 0xE7 -> LATIN CAPITAL LETTER X
+ u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z
+ u'\xb2' # 0xEA -> SUPERSCRIPT TWO
+ u'\xd4' # 0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'#' # 0xEC -> NUMBER SIGN
+ u'\xd2' # 0xED -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd5' # 0xEF -> LATIN CAPITAL LETTER O WITH TILDE
+ u'0' # 0xF0 -> DIGIT ZERO
+ u'1' # 0xF1 -> DIGIT ONE
+ u'2' # 0xF2 -> DIGIT TWO
+ u'3' # 0xF3 -> DIGIT THREE
+ u'4' # 0xF4 -> DIGIT FOUR
+ u'5' # 0xF5 -> DIGIT FIVE
+ u'6' # 0xF6 -> DIGIT SIX
+ u'7' # 0xF7 -> DIGIT SEVEN
+ u'8' # 0xF8 -> DIGIT EIGHT
+ u'9' # 0xF9 -> DIGIT NINE
+ u'\xb3' # 0xFA -> SUPERSCRIPT THREE
+ u'\xdb' # 0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'"' # 0xFC -> QUOTATION MARK
+ u'\xd9' # 0xFD -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\xda' # 0xFE -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\x9f' # 0xFF -> CONTROL
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..0b918c675c
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1140.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1140 generated from 'python-mappings/CP1140.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp1140',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x9c' # 0x04 -> CONTROL
+ u'\t' # 0x05 -> HORIZONTAL TABULATION
+ u'\x86' # 0x06 -> CONTROL
+ u'\x7f' # 0x07 -> DELETE
+ u'\x97' # 0x08 -> CONTROL
+ u'\x8d' # 0x09 -> CONTROL
+ u'\x8e' # 0x0A -> CONTROL
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x9d' # 0x14 -> CONTROL
+ u'\x85' # 0x15 -> CONTROL
+ u'\x08' # 0x16 -> BACKSPACE
+ u'\x87' # 0x17 -> CONTROL
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x92' # 0x1A -> CONTROL
+ u'\x8f' # 0x1B -> CONTROL
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u'\x80' # 0x20 -> CONTROL
+ u'\x81' # 0x21 -> CONTROL
+ u'\x82' # 0x22 -> CONTROL
+ u'\x83' # 0x23 -> CONTROL
+ u'\x84' # 0x24 -> CONTROL
+ u'\n' # 0x25 -> LINE FEED
+ u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK
+ u'\x1b' # 0x27 -> ESCAPE
+ u'\x88' # 0x28 -> CONTROL
+ u'\x89' # 0x29 -> CONTROL
+ u'\x8a' # 0x2A -> CONTROL
+ u'\x8b' # 0x2B -> CONTROL
+ u'\x8c' # 0x2C -> CONTROL
+ u'\x05' # 0x2D -> ENQUIRY
+ u'\x06' # 0x2E -> ACKNOWLEDGE
+ u'\x07' # 0x2F -> BELL
+ u'\x90' # 0x30 -> CONTROL
+ u'\x91' # 0x31 -> CONTROL
+ u'\x16' # 0x32 -> SYNCHRONOUS IDLE
+ u'\x93' # 0x33 -> CONTROL
+ u'\x94' # 0x34 -> CONTROL
+ u'\x95' # 0x35 -> CONTROL
+ u'\x96' # 0x36 -> CONTROL
+ u'\x04' # 0x37 -> END OF TRANSMISSION
+ u'\x98' # 0x38 -> CONTROL
+ u'\x99' # 0x39 -> CONTROL
+ u'\x9a' # 0x3A -> CONTROL
+ u'\x9b' # 0x3B -> CONTROL
+ u'\x14' # 0x3C -> DEVICE CONTROL FOUR
+ u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE
+ u'\x9e' # 0x3E -> CONTROL
+ u'\x1a' # 0x3F -> SUBSTITUTE
+ u' ' # 0x40 -> SPACE
+ u'\xa0' # 0x41 -> NO-BREAK SPACE
+ u'\xe2' # 0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe4' # 0x43 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe0' # 0x44 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe1' # 0x45 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe3' # 0x46 -> LATIN SMALL LETTER A WITH TILDE
+ u'\xe5' # 0x47 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe7' # 0x48 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xf1' # 0x49 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xa2' # 0x4A -> CENT SIGN
+ u'.' # 0x4B -> FULL STOP
+ u'<' # 0x4C -> LESS-THAN SIGN
+ u'(' # 0x4D -> LEFT PARENTHESIS
+ u'+' # 0x4E -> PLUS SIGN
+ u'|' # 0x4F -> VERTICAL LINE
+ u'&' # 0x50 -> AMPERSAND
+ u'\xe9' # 0x51 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xea' # 0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x53 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xe8' # 0x54 -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xed' # 0x55 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xee' # 0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0x57 -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xec' # 0x58 -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xdf' # 0x59 -> LATIN SMALL LETTER SHARP S (GERMAN)
+ u'!' # 0x5A -> EXCLAMATION MARK
+ u'$' # 0x5B -> DOLLAR SIGN
+ u'*' # 0x5C -> ASTERISK
+ u')' # 0x5D -> RIGHT PARENTHESIS
+ u';' # 0x5E -> SEMICOLON
+ u'\xac' # 0x5F -> NOT SIGN
+ u'-' # 0x60 -> HYPHEN-MINUS
+ u'/' # 0x61 -> SOLIDUS
+ u'\xc2' # 0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xc4' # 0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc0' # 0x64 -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xc1' # 0x65 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc3' # 0x66 -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\xc5' # 0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc7' # 0x68 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xd1' # 0x69 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xa6' # 0x6A -> BROKEN BAR
+ u',' # 0x6B -> COMMA
+ u'%' # 0x6C -> PERCENT SIGN
+ u'_' # 0x6D -> LOW LINE
+ u'>' # 0x6E -> GREATER-THAN SIGN
+ u'?' # 0x6F -> QUESTION MARK
+ u'\xf8' # 0x70 -> LATIN SMALL LETTER O WITH STROKE
+ u'\xc9' # 0x71 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xca' # 0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xcb' # 0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xc8' # 0x74 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xcd' # 0x75 -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\xcc' # 0x78 -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'`' # 0x79 -> GRAVE ACCENT
+ u':' # 0x7A -> COLON
+ u'#' # 0x7B -> NUMBER SIGN
+ u'@' # 0x7C -> COMMERCIAL AT
+ u"'" # 0x7D -> APOSTROPHE
+ u'=' # 0x7E -> EQUALS SIGN
+ u'"' # 0x7F -> QUOTATION MARK
+ u'\xd8' # 0x80 -> LATIN CAPITAL LETTER O WITH STROKE
+ u'a' # 0x81 -> LATIN SMALL LETTER A
+ u'b' # 0x82 -> LATIN SMALL LETTER B
+ u'c' # 0x83 -> LATIN SMALL LETTER C
+ u'd' # 0x84 -> LATIN SMALL LETTER D
+ u'e' # 0x85 -> LATIN SMALL LETTER E
+ u'f' # 0x86 -> LATIN SMALL LETTER F
+ u'g' # 0x87 -> LATIN SMALL LETTER G
+ u'h' # 0x88 -> LATIN SMALL LETTER H
+ u'i' # 0x89 -> LATIN SMALL LETTER I
+ u'\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xf0' # 0x8C -> LATIN SMALL LETTER ETH (ICELANDIC)
+ u'\xfd' # 0x8D -> LATIN SMALL LETTER Y WITH ACUTE
+ u'\xfe' # 0x8E -> LATIN SMALL LETTER THORN (ICELANDIC)
+ u'\xb1' # 0x8F -> PLUS-MINUS SIGN
+ u'\xb0' # 0x90 -> DEGREE SIGN
+ u'j' # 0x91 -> LATIN SMALL LETTER J
+ u'k' # 0x92 -> LATIN SMALL LETTER K
+ u'l' # 0x93 -> LATIN SMALL LETTER L
+ u'm' # 0x94 -> LATIN SMALL LETTER M
+ u'n' # 0x95 -> LATIN SMALL LETTER N
+ u'o' # 0x96 -> LATIN SMALL LETTER O
+ u'p' # 0x97 -> LATIN SMALL LETTER P
+ u'q' # 0x98 -> LATIN SMALL LETTER Q
+ u'r' # 0x99 -> LATIN SMALL LETTER R
+ u'\xaa' # 0x9A -> FEMININE ORDINAL INDICATOR
+ u'\xba' # 0x9B -> MASCULINE ORDINAL INDICATOR
+ u'\xe6' # 0x9C -> LATIN SMALL LIGATURE AE
+ u'\xb8' # 0x9D -> CEDILLA
+ u'\xc6' # 0x9E -> LATIN CAPITAL LIGATURE AE
+ u'\u20ac' # 0x9F -> EURO SIGN
+ u'\xb5' # 0xA0 -> MICRO SIGN
+ u'~' # 0xA1 -> TILDE
+ u's' # 0xA2 -> LATIN SMALL LETTER S
+ u't' # 0xA3 -> LATIN SMALL LETTER T
+ u'u' # 0xA4 -> LATIN SMALL LETTER U
+ u'v' # 0xA5 -> LATIN SMALL LETTER V
+ u'w' # 0xA6 -> LATIN SMALL LETTER W
+ u'x' # 0xA7 -> LATIN SMALL LETTER X
+ u'y' # 0xA8 -> LATIN SMALL LETTER Y
+ u'z' # 0xA9 -> LATIN SMALL LETTER Z
+ u'\xa1' # 0xAA -> INVERTED EXCLAMATION MARK
+ u'\xbf' # 0xAB -> INVERTED QUESTION MARK
+ u'\xd0' # 0xAC -> LATIN CAPITAL LETTER ETH (ICELANDIC)
+ u'\xdd' # 0xAD -> LATIN CAPITAL LETTER Y WITH ACUTE
+ u'\xde' # 0xAE -> LATIN CAPITAL LETTER THORN (ICELANDIC)
+ u'\xae' # 0xAF -> REGISTERED SIGN
+ u'^' # 0xB0 -> CIRCUMFLEX ACCENT
+ u'\xa3' # 0xB1 -> POUND SIGN
+ u'\xa5' # 0xB2 -> YEN SIGN
+ u'\xb7' # 0xB3 -> MIDDLE DOT
+ u'\xa9' # 0xB4 -> COPYRIGHT SIGN
+ u'\xa7' # 0xB5 -> SECTION SIGN
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER
+ u'\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF
+ u'\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS
+ u'[' # 0xBA -> LEFT SQUARE BRACKET
+ u']' # 0xBB -> RIGHT SQUARE BRACKET
+ u'\xaf' # 0xBC -> MACRON
+ u'\xa8' # 0xBD -> DIAERESIS
+ u'\xb4' # 0xBE -> ACUTE ACCENT
+ u'\xd7' # 0xBF -> MULTIPLICATION SIGN
+ u'{' # 0xC0 -> LEFT CURLY BRACKET
+ u'A' # 0xC1 -> LATIN CAPITAL LETTER A
+ u'B' # 0xC2 -> LATIN CAPITAL LETTER B
+ u'C' # 0xC3 -> LATIN CAPITAL LETTER C
+ u'D' # 0xC4 -> LATIN CAPITAL LETTER D
+ u'E' # 0xC5 -> LATIN CAPITAL LETTER E
+ u'F' # 0xC6 -> LATIN CAPITAL LETTER F
+ u'G' # 0xC7 -> LATIN CAPITAL LETTER G
+ u'H' # 0xC8 -> LATIN CAPITAL LETTER H
+ u'I' # 0xC9 -> LATIN CAPITAL LETTER I
+ u'\xad' # 0xCA -> SOFT HYPHEN
+ u'\xf4' # 0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf6' # 0xCC -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf2' # 0xCD -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xf3' # 0xCE -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf5' # 0xCF -> LATIN SMALL LETTER O WITH TILDE
+ u'}' # 0xD0 -> RIGHT CURLY BRACKET
+ u'J' # 0xD1 -> LATIN CAPITAL LETTER J
+ u'K' # 0xD2 -> LATIN CAPITAL LETTER K
+ u'L' # 0xD3 -> LATIN CAPITAL LETTER L
+ u'M' # 0xD4 -> LATIN CAPITAL LETTER M
+ u'N' # 0xD5 -> LATIN CAPITAL LETTER N
+ u'O' # 0xD6 -> LATIN CAPITAL LETTER O
+ u'P' # 0xD7 -> LATIN CAPITAL LETTER P
+ u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q
+ u'R' # 0xD9 -> LATIN CAPITAL LETTER R
+ u'\xb9' # 0xDA -> SUPERSCRIPT ONE
+ u'\xfb' # 0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0xDC -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xf9' # 0xDD -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfa' # 0xDE -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xff' # 0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS
+ u'\\' # 0xE0 -> REVERSE SOLIDUS
+ u'\xf7' # 0xE1 -> DIVISION SIGN
+ u'S' # 0xE2 -> LATIN CAPITAL LETTER S
+ u'T' # 0xE3 -> LATIN CAPITAL LETTER T
+ u'U' # 0xE4 -> LATIN CAPITAL LETTER U
+ u'V' # 0xE5 -> LATIN CAPITAL LETTER V
+ u'W' # 0xE6 -> LATIN CAPITAL LETTER W
+ u'X' # 0xE7 -> LATIN CAPITAL LETTER X
+ u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z
+ u'\xb2' # 0xEA -> SUPERSCRIPT TWO
+ u'\xd4' # 0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\xd6' # 0xEC -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xd2' # 0xED -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd5' # 0xEF -> LATIN CAPITAL LETTER O WITH TILDE
+ u'0' # 0xF0 -> DIGIT ZERO
+ u'1' # 0xF1 -> DIGIT ONE
+ u'2' # 0xF2 -> DIGIT TWO
+ u'3' # 0xF3 -> DIGIT THREE
+ u'4' # 0xF4 -> DIGIT FOUR
+ u'5' # 0xF5 -> DIGIT FIVE
+ u'6' # 0xF6 -> DIGIT SIX
+ u'7' # 0xF7 -> DIGIT SEVEN
+ u'8' # 0xF8 -> DIGIT EIGHT
+ u'9' # 0xF9 -> DIGIT NINE
+ u'\xb3' # 0xFA -> SUPERSCRIPT THREE
+ u'\xdb' # 0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xdc' # 0xFC -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xd9' # 0xFD -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\xda' # 0xFE -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\x9f' # 0xFF -> CONTROL
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..c6041e015b
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1250.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1250 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1250.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp1250',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\u20ac' # 0x80 -> EURO SIGN
+ u'\ufffe' # 0x81 -> UNDEFINED
+ u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK
+ u'\ufffe' # 0x83 -> UNDEFINED
+ u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK
+ u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS
+ u'\u2020' # 0x86 -> DAGGER
+ u'\u2021' # 0x87 -> DOUBLE DAGGER
+ u'\ufffe' # 0x88 -> UNDEFINED
+ u'\u2030' # 0x89 -> PER MILLE SIGN
+ u'\u0160' # 0x8A -> LATIN CAPITAL LETTER S WITH CARON
+ u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ u'\u015a' # 0x8C -> LATIN CAPITAL LETTER S WITH ACUTE
+ u'\u0164' # 0x8D -> LATIN CAPITAL LETTER T WITH CARON
+ u'\u017d' # 0x8E -> LATIN CAPITAL LETTER Z WITH CARON
+ u'\u0179' # 0x8F -> LATIN CAPITAL LETTER Z WITH ACUTE
+ u'\ufffe' # 0x90 -> UNDEFINED
+ u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK
+ u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK
+ u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK
+ u'\u2022' # 0x95 -> BULLET
+ u'\u2013' # 0x96 -> EN DASH
+ u'\u2014' # 0x97 -> EM DASH
+ u'\ufffe' # 0x98 -> UNDEFINED
+ u'\u2122' # 0x99 -> TRADE MARK SIGN
+ u'\u0161' # 0x9A -> LATIN SMALL LETTER S WITH CARON
+ u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+ u'\u015b' # 0x9C -> LATIN SMALL LETTER S WITH ACUTE
+ u'\u0165' # 0x9D -> LATIN SMALL LETTER T WITH CARON
+ u'\u017e' # 0x9E -> LATIN SMALL LETTER Z WITH CARON
+ u'\u017a' # 0x9F -> LATIN SMALL LETTER Z WITH ACUTE
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\u02c7' # 0xA1 -> CARON
+ u'\u02d8' # 0xA2 -> BREVE
+ u'\u0141' # 0xA3 -> LATIN CAPITAL LETTER L WITH STROKE
+ u'\xa4' # 0xA4 -> CURRENCY SIGN
+ u'\u0104' # 0xA5 -> LATIN CAPITAL LETTER A WITH OGONEK
+ u'\xa6' # 0xA6 -> BROKEN BAR
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\xa8' # 0xA8 -> DIAERESIS
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\u015e' # 0xAA -> LATIN CAPITAL LETTER S WITH CEDILLA
+ u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xac' # 0xAC -> NOT SIGN
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\xae' # 0xAE -> REGISTERED SIGN
+ u'\u017b' # 0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\u02db' # 0xB2 -> OGONEK
+ u'\u0142' # 0xB3 -> LATIN SMALL LETTER L WITH STROKE
+ u'\xb4' # 0xB4 -> ACUTE ACCENT
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xb7' # 0xB7 -> MIDDLE DOT
+ u'\xb8' # 0xB8 -> CEDILLA
+ u'\u0105' # 0xB9 -> LATIN SMALL LETTER A WITH OGONEK
+ u'\u015f' # 0xBA -> LATIN SMALL LETTER S WITH CEDILLA
+ u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u013d' # 0xBC -> LATIN CAPITAL LETTER L WITH CARON
+ u'\u02dd' # 0xBD -> DOUBLE ACUTE ACCENT
+ u'\u013e' # 0xBE -> LATIN SMALL LETTER L WITH CARON
+ u'\u017c' # 0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE
+ u'\u0154' # 0xC0 -> LATIN CAPITAL LETTER R WITH ACUTE
+ u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\u0102' # 0xC3 -> LATIN CAPITAL LETTER A WITH BREVE
+ u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\u0139' # 0xC5 -> LATIN CAPITAL LETTER L WITH ACUTE
+ u'\u0106' # 0xC6 -> LATIN CAPITAL LETTER C WITH ACUTE
+ u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON
+ u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\u0118' # 0xCA -> LATIN CAPITAL LETTER E WITH OGONEK
+ u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\u011a' # 0xCC -> LATIN CAPITAL LETTER E WITH CARON
+ u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\u010e' # 0xCF -> LATIN CAPITAL LETTER D WITH CARON
+ u'\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE
+ u'\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE
+ u'\u0147' # 0xD2 -> LATIN CAPITAL LETTER N WITH CARON
+ u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\u0150' # 0xD5 -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
+ u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xd7' # 0xD7 -> MULTIPLICATION SIGN
+ u'\u0158' # 0xD8 -> LATIN CAPITAL LETTER R WITH CARON
+ u'\u016e' # 0xD9 -> LATIN CAPITAL LETTER U WITH RING ABOVE
+ u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\u0170' # 0xDB -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
+ u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE
+ u'\u0162' # 0xDE -> LATIN CAPITAL LETTER T WITH CEDILLA
+ u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S
+ u'\u0155' # 0xE0 -> LATIN SMALL LETTER R WITH ACUTE
+ u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\u0103' # 0xE3 -> LATIN SMALL LETTER A WITH BREVE
+ u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\u013a' # 0xE5 -> LATIN SMALL LETTER L WITH ACUTE
+ u'\u0107' # 0xE6 -> LATIN SMALL LETTER C WITH ACUTE
+ u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON
+ u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\u0119' # 0xEA -> LATIN SMALL LETTER E WITH OGONEK
+ u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\u011b' # 0xEC -> LATIN SMALL LETTER E WITH CARON
+ u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\u010f' # 0xEF -> LATIN SMALL LETTER D WITH CARON
+ u'\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE
+ u'\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE
+ u'\u0148' # 0xF2 -> LATIN SMALL LETTER N WITH CARON
+ u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\u0151' # 0xF5 -> LATIN SMALL LETTER O WITH DOUBLE ACUTE
+ u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf7' # 0xF7 -> DIVISION SIGN
+ u'\u0159' # 0xF8 -> LATIN SMALL LETTER R WITH CARON
+ u'\u016f' # 0xF9 -> LATIN SMALL LETTER U WITH RING ABOVE
+ u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE
+ u'\u0171' # 0xFB -> LATIN SMALL LETTER U WITH DOUBLE ACUTE
+ u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE
+ u'\u0163' # 0xFE -> LATIN SMALL LETTER T WITH CEDILLA
+ u'\u02d9' # 0xFF -> DOT ABOVE
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..be9fec59d3
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1251.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1251 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1251.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp1251',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\u0402' # 0x80 -> CYRILLIC CAPITAL LETTER DJE
+ u'\u0403' # 0x81 -> CYRILLIC CAPITAL LETTER GJE
+ u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK
+ u'\u0453' # 0x83 -> CYRILLIC SMALL LETTER GJE
+ u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK
+ u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS
+ u'\u2020' # 0x86 -> DAGGER
+ u'\u2021' # 0x87 -> DOUBLE DAGGER
+ u'\u20ac' # 0x88 -> EURO SIGN
+ u'\u2030' # 0x89 -> PER MILLE SIGN
+ u'\u0409' # 0x8A -> CYRILLIC CAPITAL LETTER LJE
+ u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ u'\u040a' # 0x8C -> CYRILLIC CAPITAL LETTER NJE
+ u'\u040c' # 0x8D -> CYRILLIC CAPITAL LETTER KJE
+ u'\u040b' # 0x8E -> CYRILLIC CAPITAL LETTER TSHE
+ u'\u040f' # 0x8F -> CYRILLIC CAPITAL LETTER DZHE
+ u'\u0452' # 0x90 -> CYRILLIC SMALL LETTER DJE
+ u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK
+ u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK
+ u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK
+ u'\u2022' # 0x95 -> BULLET
+ u'\u2013' # 0x96 -> EN DASH
+ u'\u2014' # 0x97 -> EM DASH
+ u'\ufffe' # 0x98 -> UNDEFINED
+ u'\u2122' # 0x99 -> TRADE MARK SIGN
+ u'\u0459' # 0x9A -> CYRILLIC SMALL LETTER LJE
+ u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+ u'\u045a' # 0x9C -> CYRILLIC SMALL LETTER NJE
+ u'\u045c' # 0x9D -> CYRILLIC SMALL LETTER KJE
+ u'\u045b' # 0x9E -> CYRILLIC SMALL LETTER TSHE
+ u'\u045f' # 0x9F -> CYRILLIC SMALL LETTER DZHE
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\u040e' # 0xA1 -> CYRILLIC CAPITAL LETTER SHORT U
+ u'\u045e' # 0xA2 -> CYRILLIC SMALL LETTER SHORT U
+ u'\u0408' # 0xA3 -> CYRILLIC CAPITAL LETTER JE
+ u'\xa4' # 0xA4 -> CURRENCY SIGN
+ u'\u0490' # 0xA5 -> CYRILLIC CAPITAL LETTER GHE WITH UPTURN
+ u'\xa6' # 0xA6 -> BROKEN BAR
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\u0401' # 0xA8 -> CYRILLIC CAPITAL LETTER IO
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\u0404' # 0xAA -> CYRILLIC CAPITAL LETTER UKRAINIAN IE
+ u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xac' # 0xAC -> NOT SIGN
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\xae' # 0xAE -> REGISTERED SIGN
+ u'\u0407' # 0xAF -> CYRILLIC CAPITAL LETTER YI
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\u0406' # 0xB2 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
+ u'\u0456' # 0xB3 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
+ u'\u0491' # 0xB4 -> CYRILLIC SMALL LETTER GHE WITH UPTURN
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xb7' # 0xB7 -> MIDDLE DOT
+ u'\u0451' # 0xB8 -> CYRILLIC SMALL LETTER IO
+ u'\u2116' # 0xB9 -> NUMERO SIGN
+ u'\u0454' # 0xBA -> CYRILLIC SMALL LETTER UKRAINIAN IE
+ u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u0458' # 0xBC -> CYRILLIC SMALL LETTER JE
+ u'\u0405' # 0xBD -> CYRILLIC CAPITAL LETTER DZE
+ u'\u0455' # 0xBE -> CYRILLIC SMALL LETTER DZE
+ u'\u0457' # 0xBF -> CYRILLIC SMALL LETTER YI
+ u'\u0410' # 0xC0 -> CYRILLIC CAPITAL LETTER A
+ u'\u0411' # 0xC1 -> CYRILLIC CAPITAL LETTER BE
+ u'\u0412' # 0xC2 -> CYRILLIC CAPITAL LETTER VE
+ u'\u0413' # 0xC3 -> CYRILLIC CAPITAL LETTER GHE
+ u'\u0414' # 0xC4 -> CYRILLIC CAPITAL LETTER DE
+ u'\u0415' # 0xC5 -> CYRILLIC CAPITAL LETTER IE
+ u'\u0416' # 0xC6 -> CYRILLIC CAPITAL LETTER ZHE
+ u'\u0417' # 0xC7 -> CYRILLIC CAPITAL LETTER ZE
+ u'\u0418' # 0xC8 -> CYRILLIC CAPITAL LETTER I
+ u'\u0419' # 0xC9 -> CYRILLIC CAPITAL LETTER SHORT I
+ u'\u041a' # 0xCA -> CYRILLIC CAPITAL LETTER KA
+ u'\u041b' # 0xCB -> CYRILLIC CAPITAL LETTER EL
+ u'\u041c' # 0xCC -> CYRILLIC CAPITAL LETTER EM
+ u'\u041d' # 0xCD -> CYRILLIC CAPITAL LETTER EN
+ u'\u041e' # 0xCE -> CYRILLIC CAPITAL LETTER O
+ u'\u041f' # 0xCF -> CYRILLIC CAPITAL LETTER PE
+ u'\u0420' # 0xD0 -> CYRILLIC CAPITAL LETTER ER
+ u'\u0421' # 0xD1 -> CYRILLIC CAPITAL LETTER ES
+ u'\u0422' # 0xD2 -> CYRILLIC CAPITAL LETTER TE
+ u'\u0423' # 0xD3 -> CYRILLIC CAPITAL LETTER U
+ u'\u0424' # 0xD4 -> CYRILLIC CAPITAL LETTER EF
+ u'\u0425' # 0xD5 -> CYRILLIC CAPITAL LETTER HA
+ u'\u0426' # 0xD6 -> CYRILLIC CAPITAL LETTER TSE
+ u'\u0427' # 0xD7 -> CYRILLIC CAPITAL LETTER CHE
+ u'\u0428' # 0xD8 -> CYRILLIC CAPITAL LETTER SHA
+ u'\u0429' # 0xD9 -> CYRILLIC CAPITAL LETTER SHCHA
+ u'\u042a' # 0xDA -> CYRILLIC CAPITAL LETTER HARD SIGN
+ u'\u042b' # 0xDB -> CYRILLIC CAPITAL LETTER YERU
+ u'\u042c' # 0xDC -> CYRILLIC CAPITAL LETTER SOFT SIGN
+ u'\u042d' # 0xDD -> CYRILLIC CAPITAL LETTER E
+ u'\u042e' # 0xDE -> CYRILLIC CAPITAL LETTER YU
+ u'\u042f' # 0xDF -> CYRILLIC CAPITAL LETTER YA
+ u'\u0430' # 0xE0 -> CYRILLIC SMALL LETTER A
+ u'\u0431' # 0xE1 -> CYRILLIC SMALL LETTER BE
+ u'\u0432' # 0xE2 -> CYRILLIC SMALL LETTER VE
+ u'\u0433' # 0xE3 -> CYRILLIC SMALL LETTER GHE
+ u'\u0434' # 0xE4 -> CYRILLIC SMALL LETTER DE
+ u'\u0435' # 0xE5 -> CYRILLIC SMALL LETTER IE
+ u'\u0436' # 0xE6 -> CYRILLIC SMALL LETTER ZHE
+ u'\u0437' # 0xE7 -> CYRILLIC SMALL LETTER ZE
+ u'\u0438' # 0xE8 -> CYRILLIC SMALL LETTER I
+ u'\u0439' # 0xE9 -> CYRILLIC SMALL LETTER SHORT I
+ u'\u043a' # 0xEA -> CYRILLIC SMALL LETTER KA
+ u'\u043b' # 0xEB -> CYRILLIC SMALL LETTER EL
+ u'\u043c' # 0xEC -> CYRILLIC SMALL LETTER EM
+ u'\u043d' # 0xED -> CYRILLIC SMALL LETTER EN
+ u'\u043e' # 0xEE -> CYRILLIC SMALL LETTER O
+ u'\u043f' # 0xEF -> CYRILLIC SMALL LETTER PE
+ u'\u0440' # 0xF0 -> CYRILLIC SMALL LETTER ER
+ u'\u0441' # 0xF1 -> CYRILLIC SMALL LETTER ES
+ u'\u0442' # 0xF2 -> CYRILLIC SMALL LETTER TE
+ u'\u0443' # 0xF3 -> CYRILLIC SMALL LETTER U
+ u'\u0444' # 0xF4 -> CYRILLIC SMALL LETTER EF
+ u'\u0445' # 0xF5 -> CYRILLIC SMALL LETTER HA
+ u'\u0446' # 0xF6 -> CYRILLIC SMALL LETTER TSE
+ u'\u0447' # 0xF7 -> CYRILLIC SMALL LETTER CHE
+ u'\u0448' # 0xF8 -> CYRILLIC SMALL LETTER SHA
+ u'\u0449' # 0xF9 -> CYRILLIC SMALL LETTER SHCHA
+ u'\u044a' # 0xFA -> CYRILLIC SMALL LETTER HARD SIGN
+ u'\u044b' # 0xFB -> CYRILLIC SMALL LETTER YERU
+ u'\u044c' # 0xFC -> CYRILLIC SMALL LETTER SOFT SIGN
+ u'\u044d' # 0xFD -> CYRILLIC SMALL LETTER E
+ u'\u044e' # 0xFE -> CYRILLIC SMALL LETTER YU
+ u'\u044f' # 0xFF -> CYRILLIC SMALL LETTER YA
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..005a122c5a
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1252.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1252 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp1252',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\u20ac' # 0x80 -> EURO SIGN
+ u'\ufffe' # 0x81 -> UNDEFINED
+ u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK
+ u'\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK
+ u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK
+ u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS
+ u'\u2020' # 0x86 -> DAGGER
+ u'\u2021' # 0x87 -> DOUBLE DAGGER
+ u'\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT
+ u'\u2030' # 0x89 -> PER MILLE SIGN
+ u'\u0160' # 0x8A -> LATIN CAPITAL LETTER S WITH CARON
+ u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ u'\u0152' # 0x8C -> LATIN CAPITAL LIGATURE OE
+ u'\ufffe' # 0x8D -> UNDEFINED
+ u'\u017d' # 0x8E -> LATIN CAPITAL LETTER Z WITH CARON
+ u'\ufffe' # 0x8F -> UNDEFINED
+ u'\ufffe' # 0x90 -> UNDEFINED
+ u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK
+ u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK
+ u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK
+ u'\u2022' # 0x95 -> BULLET
+ u'\u2013' # 0x96 -> EN DASH
+ u'\u2014' # 0x97 -> EM DASH
+ u'\u02dc' # 0x98 -> SMALL TILDE
+ u'\u2122' # 0x99 -> TRADE MARK SIGN
+ u'\u0161' # 0x9A -> LATIN SMALL LETTER S WITH CARON
+ u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+ u'\u0153' # 0x9C -> LATIN SMALL LIGATURE OE
+ u'\ufffe' # 0x9D -> UNDEFINED
+ u'\u017e' # 0x9E -> LATIN SMALL LETTER Z WITH CARON
+ u'\u0178' # 0x9F -> LATIN CAPITAL LETTER Y WITH DIAERESIS
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK
+ u'\xa2' # 0xA2 -> CENT SIGN
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\xa4' # 0xA4 -> CURRENCY SIGN
+ u'\xa5' # 0xA5 -> YEN SIGN
+ u'\xa6' # 0xA6 -> BROKEN BAR
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\xa8' # 0xA8 -> DIAERESIS
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR
+ u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xac' # 0xAC -> NOT SIGN
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\xae' # 0xAE -> REGISTERED SIGN
+ u'\xaf' # 0xAF -> MACRON
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\xb2' # 0xB2 -> SUPERSCRIPT TWO
+ u'\xb3' # 0xB3 -> SUPERSCRIPT THREE
+ u'\xb4' # 0xB4 -> ACUTE ACCENT
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xb7' # 0xB7 -> MIDDLE DOT
+ u'\xb8' # 0xB8 -> CEDILLA
+ u'\xb9' # 0xB9 -> SUPERSCRIPT ONE
+ u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR
+ u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER
+ u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF
+ u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS
+ u'\xbf' # 0xBF -> INVERTED QUESTION MARK
+ u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE
+ u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\xd0' # 0xD0 -> LATIN CAPITAL LETTER ETH
+ u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xd7' # 0xD7 -> MULTIPLICATION SIGN
+ u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE
+ u'\xde' # 0xDE -> LATIN CAPITAL LETTER THORN
+ u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S
+ u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE
+ u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE
+ u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xf0' # 0xF0 -> LATIN SMALL LETTER ETH
+ u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE
+ u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf7' # 0xF7 -> DIVISION SIGN
+ u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE
+ u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE
+ u'\xfe' # 0xFE -> LATIN SMALL LETTER THORN
+ u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..ab3abdc8a5
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1253.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1253 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1253.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp1253',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\u20ac' # 0x80 -> EURO SIGN
+ u'\ufffe' # 0x81 -> UNDEFINED
+ u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK
+ u'\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK
+ u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK
+ u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS
+ u'\u2020' # 0x86 -> DAGGER
+ u'\u2021' # 0x87 -> DOUBLE DAGGER
+ u'\ufffe' # 0x88 -> UNDEFINED
+ u'\u2030' # 0x89 -> PER MILLE SIGN
+ u'\ufffe' # 0x8A -> UNDEFINED
+ u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ u'\ufffe' # 0x8C -> UNDEFINED
+ u'\ufffe' # 0x8D -> UNDEFINED
+ u'\ufffe' # 0x8E -> UNDEFINED
+ u'\ufffe' # 0x8F -> UNDEFINED
+ u'\ufffe' # 0x90 -> UNDEFINED
+ u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK
+ u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK
+ u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK
+ u'\u2022' # 0x95 -> BULLET
+ u'\u2013' # 0x96 -> EN DASH
+ u'\u2014' # 0x97 -> EM DASH
+ u'\ufffe' # 0x98 -> UNDEFINED
+ u'\u2122' # 0x99 -> TRADE MARK SIGN
+ u'\ufffe' # 0x9A -> UNDEFINED
+ u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+ u'\ufffe' # 0x9C -> UNDEFINED
+ u'\ufffe' # 0x9D -> UNDEFINED
+ u'\ufffe' # 0x9E -> UNDEFINED
+ u'\ufffe' # 0x9F -> UNDEFINED
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\u0385' # 0xA1 -> GREEK DIALYTIKA TONOS
+ u'\u0386' # 0xA2 -> GREEK CAPITAL LETTER ALPHA WITH TONOS
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\xa4' # 0xA4 -> CURRENCY SIGN
+ u'\xa5' # 0xA5 -> YEN SIGN
+ u'\xa6' # 0xA6 -> BROKEN BAR
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\xa8' # 0xA8 -> DIAERESIS
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\ufffe' # 0xAA -> UNDEFINED
+ u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xac' # 0xAC -> NOT SIGN
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\xae' # 0xAE -> REGISTERED SIGN
+ u'\u2015' # 0xAF -> HORIZONTAL BAR
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\xb2' # 0xB2 -> SUPERSCRIPT TWO
+ u'\xb3' # 0xB3 -> SUPERSCRIPT THREE
+ u'\u0384' # 0xB4 -> GREEK TONOS
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xb7' # 0xB7 -> MIDDLE DOT
+ u'\u0388' # 0xB8 -> GREEK CAPITAL LETTER EPSILON WITH TONOS
+ u'\u0389' # 0xB9 -> GREEK CAPITAL LETTER ETA WITH TONOS
+ u'\u038a' # 0xBA -> GREEK CAPITAL LETTER IOTA WITH TONOS
+ u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u038c' # 0xBC -> GREEK CAPITAL LETTER OMICRON WITH TONOS
+ u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF
+ u'\u038e' # 0xBE -> GREEK CAPITAL LETTER UPSILON WITH TONOS
+ u'\u038f' # 0xBF -> GREEK CAPITAL LETTER OMEGA WITH TONOS
+ u'\u0390' # 0xC0 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS
+ u'\u0391' # 0xC1 -> GREEK CAPITAL LETTER ALPHA
+ u'\u0392' # 0xC2 -> GREEK CAPITAL LETTER BETA
+ u'\u0393' # 0xC3 -> GREEK CAPITAL LETTER GAMMA
+ u'\u0394' # 0xC4 -> GREEK CAPITAL LETTER DELTA
+ u'\u0395' # 0xC5 -> GREEK CAPITAL LETTER EPSILON
+ u'\u0396' # 0xC6 -> GREEK CAPITAL LETTER ZETA
+ u'\u0397' # 0xC7 -> GREEK CAPITAL LETTER ETA
+ u'\u0398' # 0xC8 -> GREEK CAPITAL LETTER THETA
+ u'\u0399' # 0xC9 -> GREEK CAPITAL LETTER IOTA
+ u'\u039a' # 0xCA -> GREEK CAPITAL LETTER KAPPA
+ u'\u039b' # 0xCB -> GREEK CAPITAL LETTER LAMDA
+ u'\u039c' # 0xCC -> GREEK CAPITAL LETTER MU
+ u'\u039d' # 0xCD -> GREEK CAPITAL LETTER NU
+ u'\u039e' # 0xCE -> GREEK CAPITAL LETTER XI
+ u'\u039f' # 0xCF -> GREEK CAPITAL LETTER OMICRON
+ u'\u03a0' # 0xD0 -> GREEK CAPITAL LETTER PI
+ u'\u03a1' # 0xD1 -> GREEK CAPITAL LETTER RHO
+ u'\ufffe' # 0xD2 -> UNDEFINED
+ u'\u03a3' # 0xD3 -> GREEK CAPITAL LETTER SIGMA
+ u'\u03a4' # 0xD4 -> GREEK CAPITAL LETTER TAU
+ u'\u03a5' # 0xD5 -> GREEK CAPITAL LETTER UPSILON
+ u'\u03a6' # 0xD6 -> GREEK CAPITAL LETTER PHI
+ u'\u03a7' # 0xD7 -> GREEK CAPITAL LETTER CHI
+ u'\u03a8' # 0xD8 -> GREEK CAPITAL LETTER PSI
+ u'\u03a9' # 0xD9 -> GREEK CAPITAL LETTER OMEGA
+ u'\u03aa' # 0xDA -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA
+ u'\u03ab' # 0xDB -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
+ u'\u03ac' # 0xDC -> GREEK SMALL LETTER ALPHA WITH TONOS
+ u'\u03ad' # 0xDD -> GREEK SMALL LETTER EPSILON WITH TONOS
+ u'\u03ae' # 0xDE -> GREEK SMALL LETTER ETA WITH TONOS
+ u'\u03af' # 0xDF -> GREEK SMALL LETTER IOTA WITH TONOS
+ u'\u03b0' # 0xE0 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS
+ u'\u03b1' # 0xE1 -> GREEK SMALL LETTER ALPHA
+ u'\u03b2' # 0xE2 -> GREEK SMALL LETTER BETA
+ u'\u03b3' # 0xE3 -> GREEK SMALL LETTER GAMMA
+ u'\u03b4' # 0xE4 -> GREEK SMALL LETTER DELTA
+ u'\u03b5' # 0xE5 -> GREEK SMALL LETTER EPSILON
+ u'\u03b6' # 0xE6 -> GREEK SMALL LETTER ZETA
+ u'\u03b7' # 0xE7 -> GREEK SMALL LETTER ETA
+ u'\u03b8' # 0xE8 -> GREEK SMALL LETTER THETA
+ u'\u03b9' # 0xE9 -> GREEK SMALL LETTER IOTA
+ u'\u03ba' # 0xEA -> GREEK SMALL LETTER KAPPA
+ u'\u03bb' # 0xEB -> GREEK SMALL LETTER LAMDA
+ u'\u03bc' # 0xEC -> GREEK SMALL LETTER MU
+ u'\u03bd' # 0xED -> GREEK SMALL LETTER NU
+ u'\u03be' # 0xEE -> GREEK SMALL LETTER XI
+ u'\u03bf' # 0xEF -> GREEK SMALL LETTER OMICRON
+ u'\u03c0' # 0xF0 -> GREEK SMALL LETTER PI
+ u'\u03c1' # 0xF1 -> GREEK SMALL LETTER RHO
+ u'\u03c2' # 0xF2 -> GREEK SMALL LETTER FINAL SIGMA
+ u'\u03c3' # 0xF3 -> GREEK SMALL LETTER SIGMA
+ u'\u03c4' # 0xF4 -> GREEK SMALL LETTER TAU
+ u'\u03c5' # 0xF5 -> GREEK SMALL LETTER UPSILON
+ u'\u03c6' # 0xF6 -> GREEK SMALL LETTER PHI
+ u'\u03c7' # 0xF7 -> GREEK SMALL LETTER CHI
+ u'\u03c8' # 0xF8 -> GREEK SMALL LETTER PSI
+ u'\u03c9' # 0xF9 -> GREEK SMALL LETTER OMEGA
+ u'\u03ca' # 0xFA -> GREEK SMALL LETTER IOTA WITH DIALYTIKA
+ u'\u03cb' # 0xFB -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA
+ u'\u03cc' # 0xFC -> GREEK SMALL LETTER OMICRON WITH TONOS
+ u'\u03cd' # 0xFD -> GREEK SMALL LETTER UPSILON WITH TONOS
+ u'\u03ce' # 0xFE -> GREEK SMALL LETTER OMEGA WITH TONOS
+ u'\ufffe' # 0xFF -> UNDEFINED
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..ac691e6ab8
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1254.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1254 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1254.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp1254',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\u20ac' # 0x80 -> EURO SIGN
+ u'\ufffe' # 0x81 -> UNDEFINED
+ u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK
+ u'\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK
+ u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK
+ u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS
+ u'\u2020' # 0x86 -> DAGGER
+ u'\u2021' # 0x87 -> DOUBLE DAGGER
+ u'\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT
+ u'\u2030' # 0x89 -> PER MILLE SIGN
+ u'\u0160' # 0x8A -> LATIN CAPITAL LETTER S WITH CARON
+ u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ u'\u0152' # 0x8C -> LATIN CAPITAL LIGATURE OE
+ u'\ufffe' # 0x8D -> UNDEFINED
+ u'\ufffe' # 0x8E -> UNDEFINED
+ u'\ufffe' # 0x8F -> UNDEFINED
+ u'\ufffe' # 0x90 -> UNDEFINED
+ u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK
+ u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK
+ u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK
+ u'\u2022' # 0x95 -> BULLET
+ u'\u2013' # 0x96 -> EN DASH
+ u'\u2014' # 0x97 -> EM DASH
+ u'\u02dc' # 0x98 -> SMALL TILDE
+ u'\u2122' # 0x99 -> TRADE MARK SIGN
+ u'\u0161' # 0x9A -> LATIN SMALL LETTER S WITH CARON
+ u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+ u'\u0153' # 0x9C -> LATIN SMALL LIGATURE OE
+ u'\ufffe' # 0x9D -> UNDEFINED
+ u'\ufffe' # 0x9E -> UNDEFINED
+ u'\u0178' # 0x9F -> LATIN CAPITAL LETTER Y WITH DIAERESIS
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK
+ u'\xa2' # 0xA2 -> CENT SIGN
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\xa4' # 0xA4 -> CURRENCY SIGN
+ u'\xa5' # 0xA5 -> YEN SIGN
+ u'\xa6' # 0xA6 -> BROKEN BAR
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\xa8' # 0xA8 -> DIAERESIS
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR
+ u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xac' # 0xAC -> NOT SIGN
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\xae' # 0xAE -> REGISTERED SIGN
+ u'\xaf' # 0xAF -> MACRON
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\xb2' # 0xB2 -> SUPERSCRIPT TWO
+ u'\xb3' # 0xB3 -> SUPERSCRIPT THREE
+ u'\xb4' # 0xB4 -> ACUTE ACCENT
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xb7' # 0xB7 -> MIDDLE DOT
+ u'\xb8' # 0xB8 -> CEDILLA
+ u'\xb9' # 0xB9 -> SUPERSCRIPT ONE
+ u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR
+ u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER
+ u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF
+ u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS
+ u'\xbf' # 0xBF -> INVERTED QUESTION MARK
+ u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE
+ u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\u011e' # 0xD0 -> LATIN CAPITAL LETTER G WITH BREVE
+ u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xd7' # 0xD7 -> MULTIPLICATION SIGN
+ u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\u0130' # 0xDD -> LATIN CAPITAL LETTER I WITH DOT ABOVE
+ u'\u015e' # 0xDE -> LATIN CAPITAL LETTER S WITH CEDILLA
+ u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S
+ u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE
+ u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE
+ u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\u011f' # 0xF0 -> LATIN SMALL LETTER G WITH BREVE
+ u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE
+ u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf7' # 0xF7 -> DIVISION SIGN
+ u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE
+ u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\u0131' # 0xFD -> LATIN SMALL LETTER DOTLESS I
+ u'\u015f' # 0xFE -> LATIN SMALL LETTER S WITH CEDILLA
+ u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..800234718b
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1255.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1255 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1255.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp1255',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\u20ac' # 0x80 -> EURO SIGN
+ u'\ufffe' # 0x81 -> UNDEFINED
+ u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK
+ u'\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK
+ u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK
+ u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS
+ u'\u2020' # 0x86 -> DAGGER
+ u'\u2021' # 0x87 -> DOUBLE DAGGER
+ u'\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT
+ u'\u2030' # 0x89 -> PER MILLE SIGN
+ u'\ufffe' # 0x8A -> UNDEFINED
+ u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ u'\ufffe' # 0x8C -> UNDEFINED
+ u'\ufffe' # 0x8D -> UNDEFINED
+ u'\ufffe' # 0x8E -> UNDEFINED
+ u'\ufffe' # 0x8F -> UNDEFINED
+ u'\ufffe' # 0x90 -> UNDEFINED
+ u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK
+ u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK
+ u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK
+ u'\u2022' # 0x95 -> BULLET
+ u'\u2013' # 0x96 -> EN DASH
+ u'\u2014' # 0x97 -> EM DASH
+ u'\u02dc' # 0x98 -> SMALL TILDE
+ u'\u2122' # 0x99 -> TRADE MARK SIGN
+ u'\ufffe' # 0x9A -> UNDEFINED
+ u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+ u'\ufffe' # 0x9C -> UNDEFINED
+ u'\ufffe' # 0x9D -> UNDEFINED
+ u'\ufffe' # 0x9E -> UNDEFINED
+ u'\ufffe' # 0x9F -> UNDEFINED
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK
+ u'\xa2' # 0xA2 -> CENT SIGN
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\u20aa' # 0xA4 -> NEW SHEQEL SIGN
+ u'\xa5' # 0xA5 -> YEN SIGN
+ u'\xa6' # 0xA6 -> BROKEN BAR
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\xa8' # 0xA8 -> DIAERESIS
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\xd7' # 0xAA -> MULTIPLICATION SIGN
+ u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xac' # 0xAC -> NOT SIGN
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\xae' # 0xAE -> REGISTERED SIGN
+ u'\xaf' # 0xAF -> MACRON
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\xb2' # 0xB2 -> SUPERSCRIPT TWO
+ u'\xb3' # 0xB3 -> SUPERSCRIPT THREE
+ u'\xb4' # 0xB4 -> ACUTE ACCENT
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xb7' # 0xB7 -> MIDDLE DOT
+ u'\xb8' # 0xB8 -> CEDILLA
+ u'\xb9' # 0xB9 -> SUPERSCRIPT ONE
+ u'\xf7' # 0xBA -> DIVISION SIGN
+ u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER
+ u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF
+ u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS
+ u'\xbf' # 0xBF -> INVERTED QUESTION MARK
+ u'\u05b0' # 0xC0 -> HEBREW POINT SHEVA
+ u'\u05b1' # 0xC1 -> HEBREW POINT HATAF SEGOL
+ u'\u05b2' # 0xC2 -> HEBREW POINT HATAF PATAH
+ u'\u05b3' # 0xC3 -> HEBREW POINT HATAF QAMATS
+ u'\u05b4' # 0xC4 -> HEBREW POINT HIRIQ
+ u'\u05b5' # 0xC5 -> HEBREW POINT TSERE
+ u'\u05b6' # 0xC6 -> HEBREW POINT SEGOL
+ u'\u05b7' # 0xC7 -> HEBREW POINT PATAH
+ u'\u05b8' # 0xC8 -> HEBREW POINT QAMATS
+ u'\u05b9' # 0xC9 -> HEBREW POINT HOLAM
+ u'\ufffe' # 0xCA -> UNDEFINED
+ u'\u05bb' # 0xCB -> HEBREW POINT QUBUTS
+ u'\u05bc' # 0xCC -> HEBREW POINT DAGESH OR MAPIQ
+ u'\u05bd' # 0xCD -> HEBREW POINT METEG
+ u'\u05be' # 0xCE -> HEBREW PUNCTUATION MAQAF
+ u'\u05bf' # 0xCF -> HEBREW POINT RAFE
+ u'\u05c0' # 0xD0 -> HEBREW PUNCTUATION PASEQ
+ u'\u05c1' # 0xD1 -> HEBREW POINT SHIN DOT
+ u'\u05c2' # 0xD2 -> HEBREW POINT SIN DOT
+ u'\u05c3' # 0xD3 -> HEBREW PUNCTUATION SOF PASUQ
+ u'\u05f0' # 0xD4 -> HEBREW LIGATURE YIDDISH DOUBLE VAV
+ u'\u05f1' # 0xD5 -> HEBREW LIGATURE YIDDISH VAV YOD
+ u'\u05f2' # 0xD6 -> HEBREW LIGATURE YIDDISH DOUBLE YOD
+ u'\u05f3' # 0xD7 -> HEBREW PUNCTUATION GERESH
+ u'\u05f4' # 0xD8 -> HEBREW PUNCTUATION GERSHAYIM
+ u'\ufffe' # 0xD9 -> UNDEFINED
+ u'\ufffe' # 0xDA -> UNDEFINED
+ u'\ufffe' # 0xDB -> UNDEFINED
+ u'\ufffe' # 0xDC -> UNDEFINED
+ u'\ufffe' # 0xDD -> UNDEFINED
+ u'\ufffe' # 0xDE -> UNDEFINED
+ u'\ufffe' # 0xDF -> UNDEFINED
+ u'\u05d0' # 0xE0 -> HEBREW LETTER ALEF
+ u'\u05d1' # 0xE1 -> HEBREW LETTER BET
+ u'\u05d2' # 0xE2 -> HEBREW LETTER GIMEL
+ u'\u05d3' # 0xE3 -> HEBREW LETTER DALET
+ u'\u05d4' # 0xE4 -> HEBREW LETTER HE
+ u'\u05d5' # 0xE5 -> HEBREW LETTER VAV
+ u'\u05d6' # 0xE6 -> HEBREW LETTER ZAYIN
+ u'\u05d7' # 0xE7 -> HEBREW LETTER HET
+ u'\u05d8' # 0xE8 -> HEBREW LETTER TET
+ u'\u05d9' # 0xE9 -> HEBREW LETTER YOD
+ u'\u05da' # 0xEA -> HEBREW LETTER FINAL KAF
+ u'\u05db' # 0xEB -> HEBREW LETTER KAF
+ u'\u05dc' # 0xEC -> HEBREW LETTER LAMED
+ u'\u05dd' # 0xED -> HEBREW LETTER FINAL MEM
+ u'\u05de' # 0xEE -> HEBREW LETTER MEM
+ u'\u05df' # 0xEF -> HEBREW LETTER FINAL NUN
+ u'\u05e0' # 0xF0 -> HEBREW LETTER NUN
+ u'\u05e1' # 0xF1 -> HEBREW LETTER SAMEKH
+ u'\u05e2' # 0xF2 -> HEBREW LETTER AYIN
+ u'\u05e3' # 0xF3 -> HEBREW LETTER FINAL PE
+ u'\u05e4' # 0xF4 -> HEBREW LETTER PE
+ u'\u05e5' # 0xF5 -> HEBREW LETTER FINAL TSADI
+ u'\u05e6' # 0xF6 -> HEBREW LETTER TSADI
+ u'\u05e7' # 0xF7 -> HEBREW LETTER QOF
+ u'\u05e8' # 0xF8 -> HEBREW LETTER RESH
+ u'\u05e9' # 0xF9 -> HEBREW LETTER SHIN
+ u'\u05ea' # 0xFA -> HEBREW LETTER TAV
+ u'\ufffe' # 0xFB -> UNDEFINED
+ u'\ufffe' # 0xFC -> UNDEFINED
+ u'\u200e' # 0xFD -> LEFT-TO-RIGHT MARK
+ u'\u200f' # 0xFE -> RIGHT-TO-LEFT MARK
+ u'\ufffe' # 0xFF -> UNDEFINED
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..d8a67a403d
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1256.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1256 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1256.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp1256',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\u20ac' # 0x80 -> EURO SIGN
+ u'\u067e' # 0x81 -> ARABIC LETTER PEH
+ u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK
+ u'\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK
+ u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK
+ u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS
+ u'\u2020' # 0x86 -> DAGGER
+ u'\u2021' # 0x87 -> DOUBLE DAGGER
+ u'\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT
+ u'\u2030' # 0x89 -> PER MILLE SIGN
+ u'\u0679' # 0x8A -> ARABIC LETTER TTEH
+ u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ u'\u0152' # 0x8C -> LATIN CAPITAL LIGATURE OE
+ u'\u0686' # 0x8D -> ARABIC LETTER TCHEH
+ u'\u0698' # 0x8E -> ARABIC LETTER JEH
+ u'\u0688' # 0x8F -> ARABIC LETTER DDAL
+ u'\u06af' # 0x90 -> ARABIC LETTER GAF
+ u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK
+ u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK
+ u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK
+ u'\u2022' # 0x95 -> BULLET
+ u'\u2013' # 0x96 -> EN DASH
+ u'\u2014' # 0x97 -> EM DASH
+ u'\u06a9' # 0x98 -> ARABIC LETTER KEHEH
+ u'\u2122' # 0x99 -> TRADE MARK SIGN
+ u'\u0691' # 0x9A -> ARABIC LETTER RREH
+ u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+ u'\u0153' # 0x9C -> LATIN SMALL LIGATURE OE
+ u'\u200c' # 0x9D -> ZERO WIDTH NON-JOINER
+ u'\u200d' # 0x9E -> ZERO WIDTH JOINER
+ u'\u06ba' # 0x9F -> ARABIC LETTER NOON GHUNNA
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\u060c' # 0xA1 -> ARABIC COMMA
+ u'\xa2' # 0xA2 -> CENT SIGN
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\xa4' # 0xA4 -> CURRENCY SIGN
+ u'\xa5' # 0xA5 -> YEN SIGN
+ u'\xa6' # 0xA6 -> BROKEN BAR
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\xa8' # 0xA8 -> DIAERESIS
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\u06be' # 0xAA -> ARABIC LETTER HEH DOACHASHMEE
+ u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xac' # 0xAC -> NOT SIGN
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\xae' # 0xAE -> REGISTERED SIGN
+ u'\xaf' # 0xAF -> MACRON
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\xb2' # 0xB2 -> SUPERSCRIPT TWO
+ u'\xb3' # 0xB3 -> SUPERSCRIPT THREE
+ u'\xb4' # 0xB4 -> ACUTE ACCENT
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xb7' # 0xB7 -> MIDDLE DOT
+ u'\xb8' # 0xB8 -> CEDILLA
+ u'\xb9' # 0xB9 -> SUPERSCRIPT ONE
+ u'\u061b' # 0xBA -> ARABIC SEMICOLON
+ u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER
+ u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF
+ u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS
+ u'\u061f' # 0xBF -> ARABIC QUESTION MARK
+ u'\u06c1' # 0xC0 -> ARABIC LETTER HEH GOAL
+ u'\u0621' # 0xC1 -> ARABIC LETTER HAMZA
+ u'\u0622' # 0xC2 -> ARABIC LETTER ALEF WITH MADDA ABOVE
+ u'\u0623' # 0xC3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE
+ u'\u0624' # 0xC4 -> ARABIC LETTER WAW WITH HAMZA ABOVE
+ u'\u0625' # 0xC5 -> ARABIC LETTER ALEF WITH HAMZA BELOW
+ u'\u0626' # 0xC6 -> ARABIC LETTER YEH WITH HAMZA ABOVE
+ u'\u0627' # 0xC7 -> ARABIC LETTER ALEF
+ u'\u0628' # 0xC8 -> ARABIC LETTER BEH
+ u'\u0629' # 0xC9 -> ARABIC LETTER TEH MARBUTA
+ u'\u062a' # 0xCA -> ARABIC LETTER TEH
+ u'\u062b' # 0xCB -> ARABIC LETTER THEH
+ u'\u062c' # 0xCC -> ARABIC LETTER JEEM
+ u'\u062d' # 0xCD -> ARABIC LETTER HAH
+ u'\u062e' # 0xCE -> ARABIC LETTER KHAH
+ u'\u062f' # 0xCF -> ARABIC LETTER DAL
+ u'\u0630' # 0xD0 -> ARABIC LETTER THAL
+ u'\u0631' # 0xD1 -> ARABIC LETTER REH
+ u'\u0632' # 0xD2 -> ARABIC LETTER ZAIN
+ u'\u0633' # 0xD3 -> ARABIC LETTER SEEN
+ u'\u0634' # 0xD4 -> ARABIC LETTER SHEEN
+ u'\u0635' # 0xD5 -> ARABIC LETTER SAD
+ u'\u0636' # 0xD6 -> ARABIC LETTER DAD
+ u'\xd7' # 0xD7 -> MULTIPLICATION SIGN
+ u'\u0637' # 0xD8 -> ARABIC LETTER TAH
+ u'\u0638' # 0xD9 -> ARABIC LETTER ZAH
+ u'\u0639' # 0xDA -> ARABIC LETTER AIN
+ u'\u063a' # 0xDB -> ARABIC LETTER GHAIN
+ u'\u0640' # 0xDC -> ARABIC TATWEEL
+ u'\u0641' # 0xDD -> ARABIC LETTER FEH
+ u'\u0642' # 0xDE -> ARABIC LETTER QAF
+ u'\u0643' # 0xDF -> ARABIC LETTER KAF
+ u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\u0644' # 0xE1 -> ARABIC LETTER LAM
+ u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\u0645' # 0xE3 -> ARABIC LETTER MEEM
+ u'\u0646' # 0xE4 -> ARABIC LETTER NOON
+ u'\u0647' # 0xE5 -> ARABIC LETTER HEH
+ u'\u0648' # 0xE6 -> ARABIC LETTER WAW
+ u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\u0649' # 0xEC -> ARABIC LETTER ALEF MAKSURA
+ u'\u064a' # 0xED -> ARABIC LETTER YEH
+ u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\u064b' # 0xF0 -> ARABIC FATHATAN
+ u'\u064c' # 0xF1 -> ARABIC DAMMATAN
+ u'\u064d' # 0xF2 -> ARABIC KASRATAN
+ u'\u064e' # 0xF3 -> ARABIC FATHA
+ u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\u064f' # 0xF5 -> ARABIC DAMMA
+ u'\u0650' # 0xF6 -> ARABIC KASRA
+ u'\xf7' # 0xF7 -> DIVISION SIGN
+ u'\u0651' # 0xF8 -> ARABIC SHADDA
+ u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE
+ u'\u0652' # 0xFA -> ARABIC SUKUN
+ u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\u200e' # 0xFD -> LEFT-TO-RIGHT MARK
+ u'\u200f' # 0xFE -> RIGHT-TO-LEFT MARK
+ u'\u06d2' # 0xFF -> ARABIC LETTER YEH BARREE
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..05917c7396
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1257.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1257 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1257.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp1257',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\u20ac' # 0x80 -> EURO SIGN
+ u'\ufffe' # 0x81 -> UNDEFINED
+ u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK
+ u'\ufffe' # 0x83 -> UNDEFINED
+ u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK
+ u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS
+ u'\u2020' # 0x86 -> DAGGER
+ u'\u2021' # 0x87 -> DOUBLE DAGGER
+ u'\ufffe' # 0x88 -> UNDEFINED
+ u'\u2030' # 0x89 -> PER MILLE SIGN
+ u'\ufffe' # 0x8A -> UNDEFINED
+ u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ u'\ufffe' # 0x8C -> UNDEFINED
+ u'\xa8' # 0x8D -> DIAERESIS
+ u'\u02c7' # 0x8E -> CARON
+ u'\xb8' # 0x8F -> CEDILLA
+ u'\ufffe' # 0x90 -> UNDEFINED
+ u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK
+ u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK
+ u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK
+ u'\u2022' # 0x95 -> BULLET
+ u'\u2013' # 0x96 -> EN DASH
+ u'\u2014' # 0x97 -> EM DASH
+ u'\ufffe' # 0x98 -> UNDEFINED
+ u'\u2122' # 0x99 -> TRADE MARK SIGN
+ u'\ufffe' # 0x9A -> UNDEFINED
+ u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+ u'\ufffe' # 0x9C -> UNDEFINED
+ u'\xaf' # 0x9D -> MACRON
+ u'\u02db' # 0x9E -> OGONEK
+ u'\ufffe' # 0x9F -> UNDEFINED
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\ufffe' # 0xA1 -> UNDEFINED
+ u'\xa2' # 0xA2 -> CENT SIGN
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\xa4' # 0xA4 -> CURRENCY SIGN
+ u'\ufffe' # 0xA5 -> UNDEFINED
+ u'\xa6' # 0xA6 -> BROKEN BAR
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\xd8' # 0xA8 -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\u0156' # 0xAA -> LATIN CAPITAL LETTER R WITH CEDILLA
+ u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xac' # 0xAC -> NOT SIGN
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\xae' # 0xAE -> REGISTERED SIGN
+ u'\xc6' # 0xAF -> LATIN CAPITAL LETTER AE
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\xb2' # 0xB2 -> SUPERSCRIPT TWO
+ u'\xb3' # 0xB3 -> SUPERSCRIPT THREE
+ u'\xb4' # 0xB4 -> ACUTE ACCENT
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xb7' # 0xB7 -> MIDDLE DOT
+ u'\xf8' # 0xB8 -> LATIN SMALL LETTER O WITH STROKE
+ u'\xb9' # 0xB9 -> SUPERSCRIPT ONE
+ u'\u0157' # 0xBA -> LATIN SMALL LETTER R WITH CEDILLA
+ u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER
+ u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF
+ u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS
+ u'\xe6' # 0xBF -> LATIN SMALL LETTER AE
+ u'\u0104' # 0xC0 -> LATIN CAPITAL LETTER A WITH OGONEK
+ u'\u012e' # 0xC1 -> LATIN CAPITAL LETTER I WITH OGONEK
+ u'\u0100' # 0xC2 -> LATIN CAPITAL LETTER A WITH MACRON
+ u'\u0106' # 0xC3 -> LATIN CAPITAL LETTER C WITH ACUTE
+ u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\u0118' # 0xC6 -> LATIN CAPITAL LETTER E WITH OGONEK
+ u'\u0112' # 0xC7 -> LATIN CAPITAL LETTER E WITH MACRON
+ u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON
+ u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\u0179' # 0xCA -> LATIN CAPITAL LETTER Z WITH ACUTE
+ u'\u0116' # 0xCB -> LATIN CAPITAL LETTER E WITH DOT ABOVE
+ u'\u0122' # 0xCC -> LATIN CAPITAL LETTER G WITH CEDILLA
+ u'\u0136' # 0xCD -> LATIN CAPITAL LETTER K WITH CEDILLA
+ u'\u012a' # 0xCE -> LATIN CAPITAL LETTER I WITH MACRON
+ u'\u013b' # 0xCF -> LATIN CAPITAL LETTER L WITH CEDILLA
+ u'\u0160' # 0xD0 -> LATIN CAPITAL LETTER S WITH CARON
+ u'\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE
+ u'\u0145' # 0xD2 -> LATIN CAPITAL LETTER N WITH CEDILLA
+ u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\u014c' # 0xD4 -> LATIN CAPITAL LETTER O WITH MACRON
+ u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xd7' # 0xD7 -> MULTIPLICATION SIGN
+ u'\u0172' # 0xD8 -> LATIN CAPITAL LETTER U WITH OGONEK
+ u'\u0141' # 0xD9 -> LATIN CAPITAL LETTER L WITH STROKE
+ u'\u015a' # 0xDA -> LATIN CAPITAL LETTER S WITH ACUTE
+ u'\u016a' # 0xDB -> LATIN CAPITAL LETTER U WITH MACRON
+ u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\u017b' # 0xDD -> LATIN CAPITAL LETTER Z WITH DOT ABOVE
+ u'\u017d' # 0xDE -> LATIN CAPITAL LETTER Z WITH CARON
+ u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S
+ u'\u0105' # 0xE0 -> LATIN SMALL LETTER A WITH OGONEK
+ u'\u012f' # 0xE1 -> LATIN SMALL LETTER I WITH OGONEK
+ u'\u0101' # 0xE2 -> LATIN SMALL LETTER A WITH MACRON
+ u'\u0107' # 0xE3 -> LATIN SMALL LETTER C WITH ACUTE
+ u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\u0119' # 0xE6 -> LATIN SMALL LETTER E WITH OGONEK
+ u'\u0113' # 0xE7 -> LATIN SMALL LETTER E WITH MACRON
+ u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON
+ u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\u017a' # 0xEA -> LATIN SMALL LETTER Z WITH ACUTE
+ u'\u0117' # 0xEB -> LATIN SMALL LETTER E WITH DOT ABOVE
+ u'\u0123' # 0xEC -> LATIN SMALL LETTER G WITH CEDILLA
+ u'\u0137' # 0xED -> LATIN SMALL LETTER K WITH CEDILLA
+ u'\u012b' # 0xEE -> LATIN SMALL LETTER I WITH MACRON
+ u'\u013c' # 0xEF -> LATIN SMALL LETTER L WITH CEDILLA
+ u'\u0161' # 0xF0 -> LATIN SMALL LETTER S WITH CARON
+ u'\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE
+ u'\u0146' # 0xF2 -> LATIN SMALL LETTER N WITH CEDILLA
+ u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\u014d' # 0xF4 -> LATIN SMALL LETTER O WITH MACRON
+ u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE
+ u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf7' # 0xF7 -> DIVISION SIGN
+ u'\u0173' # 0xF8 -> LATIN SMALL LETTER U WITH OGONEK
+ u'\u0142' # 0xF9 -> LATIN SMALL LETTER L WITH STROKE
+ u'\u015b' # 0xFA -> LATIN SMALL LETTER S WITH ACUTE
+ u'\u016b' # 0xFB -> LATIN SMALL LETTER U WITH MACRON
+ u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\u017c' # 0xFD -> LATIN SMALL LETTER Z WITH DOT ABOVE
+ u'\u017e' # 0xFE -> LATIN SMALL LETTER Z WITH CARON
+ u'\u02d9' # 0xFF -> DOT ABOVE
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..a6e8408d0a
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1258.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp1258 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1258.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp1258',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\u20ac' # 0x80 -> EURO SIGN
+ u'\ufffe' # 0x81 -> UNDEFINED
+ u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK
+ u'\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK
+ u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK
+ u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS
+ u'\u2020' # 0x86 -> DAGGER
+ u'\u2021' # 0x87 -> DOUBLE DAGGER
+ u'\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT
+ u'\u2030' # 0x89 -> PER MILLE SIGN
+ u'\ufffe' # 0x8A -> UNDEFINED
+ u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ u'\u0152' # 0x8C -> LATIN CAPITAL LIGATURE OE
+ u'\ufffe' # 0x8D -> UNDEFINED
+ u'\ufffe' # 0x8E -> UNDEFINED
+ u'\ufffe' # 0x8F -> UNDEFINED
+ u'\ufffe' # 0x90 -> UNDEFINED
+ u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK
+ u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK
+ u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK
+ u'\u2022' # 0x95 -> BULLET
+ u'\u2013' # 0x96 -> EN DASH
+ u'\u2014' # 0x97 -> EM DASH
+ u'\u02dc' # 0x98 -> SMALL TILDE
+ u'\u2122' # 0x99 -> TRADE MARK SIGN
+ u'\ufffe' # 0x9A -> UNDEFINED
+ u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+ u'\u0153' # 0x9C -> LATIN SMALL LIGATURE OE
+ u'\ufffe' # 0x9D -> UNDEFINED
+ u'\ufffe' # 0x9E -> UNDEFINED
+ u'\u0178' # 0x9F -> LATIN CAPITAL LETTER Y WITH DIAERESIS
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK
+ u'\xa2' # 0xA2 -> CENT SIGN
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\xa4' # 0xA4 -> CURRENCY SIGN
+ u'\xa5' # 0xA5 -> YEN SIGN
+ u'\xa6' # 0xA6 -> BROKEN BAR
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\xa8' # 0xA8 -> DIAERESIS
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR
+ u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xac' # 0xAC -> NOT SIGN
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\xae' # 0xAE -> REGISTERED SIGN
+ u'\xaf' # 0xAF -> MACRON
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\xb2' # 0xB2 -> SUPERSCRIPT TWO
+ u'\xb3' # 0xB3 -> SUPERSCRIPT THREE
+ u'\xb4' # 0xB4 -> ACUTE ACCENT
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xb7' # 0xB7 -> MIDDLE DOT
+ u'\xb8' # 0xB8 -> CEDILLA
+ u'\xb9' # 0xB9 -> SUPERSCRIPT ONE
+ u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR
+ u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER
+ u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF
+ u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS
+ u'\xbf' # 0xBF -> INVERTED QUESTION MARK
+ u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\u0102' # 0xC3 -> LATIN CAPITAL LETTER A WITH BREVE
+ u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE
+ u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\u0300' # 0xCC -> COMBINING GRAVE ACCENT
+ u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE
+ u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\u0309' # 0xD2 -> COMBINING HOOK ABOVE
+ u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\u01a0' # 0xD5 -> LATIN CAPITAL LETTER O WITH HORN
+ u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xd7' # 0xD7 -> MULTIPLICATION SIGN
+ u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\u01af' # 0xDD -> LATIN CAPITAL LETTER U WITH HORN
+ u'\u0303' # 0xDE -> COMBINING TILDE
+ u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S
+ u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\u0103' # 0xE3 -> LATIN SMALL LETTER A WITH BREVE
+ u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE
+ u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\u0301' # 0xEC -> COMBINING ACUTE ACCENT
+ u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE
+ u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE
+ u'\u0323' # 0xF2 -> COMBINING DOT BELOW
+ u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\u01a1' # 0xF5 -> LATIN SMALL LETTER O WITH HORN
+ u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf7' # 0xF7 -> DIVISION SIGN
+ u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE
+ u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\u01b0' # 0xFD -> LATIN SMALL LETTER U WITH HORN
+ u'\u20ab' # 0xFE -> DONG SIGN
+ u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..343d7d7496
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp424.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp424 generated from 'MAPPINGS/VENDORS/MISC/CP424.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp424',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x9c' # 0x04 -> SELECT
+ u'\t' # 0x05 -> HORIZONTAL TABULATION
+ u'\x86' # 0x06 -> REQUIRED NEW LINE
+ u'\x7f' # 0x07 -> DELETE
+ u'\x97' # 0x08 -> GRAPHIC ESCAPE
+ u'\x8d' # 0x09 -> SUPERSCRIPT
+ u'\x8e' # 0x0A -> REPEAT
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x9d' # 0x14 -> RESTORE/ENABLE PRESENTATION
+ u'\x85' # 0x15 -> NEW LINE
+ u'\x08' # 0x16 -> BACKSPACE
+ u'\x87' # 0x17 -> PROGRAM OPERATOR COMMUNICATION
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x92' # 0x1A -> UNIT BACK SPACE
+ u'\x8f' # 0x1B -> CUSTOMER USE ONE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u'\x80' # 0x20 -> DIGIT SELECT
+ u'\x81' # 0x21 -> START OF SIGNIFICANCE
+ u'\x82' # 0x22 -> FIELD SEPARATOR
+ u'\x83' # 0x23 -> WORD UNDERSCORE
+ u'\x84' # 0x24 -> BYPASS OR INHIBIT PRESENTATION
+ u'\n' # 0x25 -> LINE FEED
+ u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK
+ u'\x1b' # 0x27 -> ESCAPE
+ u'\x88' # 0x28 -> SET ATTRIBUTE
+ u'\x89' # 0x29 -> START FIELD EXTENDED
+ u'\x8a' # 0x2A -> SET MODE OR SWITCH
+ u'\x8b' # 0x2B -> CONTROL SEQUENCE PREFIX
+ u'\x8c' # 0x2C -> MODIFY FIELD ATTRIBUTE
+ u'\x05' # 0x2D -> ENQUIRY
+ u'\x06' # 0x2E -> ACKNOWLEDGE
+ u'\x07' # 0x2F -> BELL
+ u'\x90' # 0x30 -> <reserved>
+ u'\x91' # 0x31 -> <reserved>
+ u'\x16' # 0x32 -> SYNCHRONOUS IDLE
+ u'\x93' # 0x33 -> INDEX RETURN
+ u'\x94' # 0x34 -> PRESENTATION POSITION
+ u'\x95' # 0x35 -> TRANSPARENT
+ u'\x96' # 0x36 -> NUMERIC BACKSPACE
+ u'\x04' # 0x37 -> END OF TRANSMISSION
+ u'\x98' # 0x38 -> SUBSCRIPT
+ u'\x99' # 0x39 -> INDENT TABULATION
+ u'\x9a' # 0x3A -> REVERSE FORM FEED
+ u'\x9b' # 0x3B -> CUSTOMER USE THREE
+ u'\x14' # 0x3C -> DEVICE CONTROL FOUR
+ u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE
+ u'\x9e' # 0x3E -> <reserved>
+ u'\x1a' # 0x3F -> SUBSTITUTE
+ u' ' # 0x40 -> SPACE
+ u'\u05d0' # 0x41 -> HEBREW LETTER ALEF
+ u'\u05d1' # 0x42 -> HEBREW LETTER BET
+ u'\u05d2' # 0x43 -> HEBREW LETTER GIMEL
+ u'\u05d3' # 0x44 -> HEBREW LETTER DALET
+ u'\u05d4' # 0x45 -> HEBREW LETTER HE
+ u'\u05d5' # 0x46 -> HEBREW LETTER VAV
+ u'\u05d6' # 0x47 -> HEBREW LETTER ZAYIN
+ u'\u05d7' # 0x48 -> HEBREW LETTER HET
+ u'\u05d8' # 0x49 -> HEBREW LETTER TET
+ u'\xa2' # 0x4A -> CENT SIGN
+ u'.' # 0x4B -> FULL STOP
+ u'<' # 0x4C -> LESS-THAN SIGN
+ u'(' # 0x4D -> LEFT PARENTHESIS
+ u'+' # 0x4E -> PLUS SIGN
+ u'|' # 0x4F -> VERTICAL LINE
+ u'&' # 0x50 -> AMPERSAND
+ u'\u05d9' # 0x51 -> HEBREW LETTER YOD
+ u'\u05da' # 0x52 -> HEBREW LETTER FINAL KAF
+ u'\u05db' # 0x53 -> HEBREW LETTER KAF
+ u'\u05dc' # 0x54 -> HEBREW LETTER LAMED
+ u'\u05dd' # 0x55 -> HEBREW LETTER FINAL MEM
+ u'\u05de' # 0x56 -> HEBREW LETTER MEM
+ u'\u05df' # 0x57 -> HEBREW LETTER FINAL NUN
+ u'\u05e0' # 0x58 -> HEBREW LETTER NUN
+ u'\u05e1' # 0x59 -> HEBREW LETTER SAMEKH
+ u'!' # 0x5A -> EXCLAMATION MARK
+ u'$' # 0x5B -> DOLLAR SIGN
+ u'*' # 0x5C -> ASTERISK
+ u')' # 0x5D -> RIGHT PARENTHESIS
+ u';' # 0x5E -> SEMICOLON
+ u'\xac' # 0x5F -> NOT SIGN
+ u'-' # 0x60 -> HYPHEN-MINUS
+ u'/' # 0x61 -> SOLIDUS
+ u'\u05e2' # 0x62 -> HEBREW LETTER AYIN
+ u'\u05e3' # 0x63 -> HEBREW LETTER FINAL PE
+ u'\u05e4' # 0x64 -> HEBREW LETTER PE
+ u'\u05e5' # 0x65 -> HEBREW LETTER FINAL TSADI
+ u'\u05e6' # 0x66 -> HEBREW LETTER TSADI
+ u'\u05e7' # 0x67 -> HEBREW LETTER QOF
+ u'\u05e8' # 0x68 -> HEBREW LETTER RESH
+ u'\u05e9' # 0x69 -> HEBREW LETTER SHIN
+ u'\xa6' # 0x6A -> BROKEN BAR
+ u',' # 0x6B -> COMMA
+ u'%' # 0x6C -> PERCENT SIGN
+ u'_' # 0x6D -> LOW LINE
+ u'>' # 0x6E -> GREATER-THAN SIGN
+ u'?' # 0x6F -> QUESTION MARK
+ u'\ufffe' # 0x70 -> UNDEFINED
+ u'\u05ea' # 0x71 -> HEBREW LETTER TAV
+ u'\ufffe' # 0x72 -> UNDEFINED
+ u'\ufffe' # 0x73 -> UNDEFINED
+ u'\xa0' # 0x74 -> NO-BREAK SPACE
+ u'\ufffe' # 0x75 -> UNDEFINED
+ u'\ufffe' # 0x76 -> UNDEFINED
+ u'\ufffe' # 0x77 -> UNDEFINED
+ u'\u2017' # 0x78 -> DOUBLE LOW LINE
+ u'`' # 0x79 -> GRAVE ACCENT
+ u':' # 0x7A -> COLON
+ u'#' # 0x7B -> NUMBER SIGN
+ u'@' # 0x7C -> COMMERCIAL AT
+ u"'" # 0x7D -> APOSTROPHE
+ u'=' # 0x7E -> EQUALS SIGN
+ u'"' # 0x7F -> QUOTATION MARK
+ u'\ufffe' # 0x80 -> UNDEFINED
+ u'a' # 0x81 -> LATIN SMALL LETTER A
+ u'b' # 0x82 -> LATIN SMALL LETTER B
+ u'c' # 0x83 -> LATIN SMALL LETTER C
+ u'd' # 0x84 -> LATIN SMALL LETTER D
+ u'e' # 0x85 -> LATIN SMALL LETTER E
+ u'f' # 0x86 -> LATIN SMALL LETTER F
+ u'g' # 0x87 -> LATIN SMALL LETTER G
+ u'h' # 0x88 -> LATIN SMALL LETTER H
+ u'i' # 0x89 -> LATIN SMALL LETTER I
+ u'\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\ufffe' # 0x8C -> UNDEFINED
+ u'\ufffe' # 0x8D -> UNDEFINED
+ u'\ufffe' # 0x8E -> UNDEFINED
+ u'\xb1' # 0x8F -> PLUS-MINUS SIGN
+ u'\xb0' # 0x90 -> DEGREE SIGN
+ u'j' # 0x91 -> LATIN SMALL LETTER J
+ u'k' # 0x92 -> LATIN SMALL LETTER K
+ u'l' # 0x93 -> LATIN SMALL LETTER L
+ u'm' # 0x94 -> LATIN SMALL LETTER M
+ u'n' # 0x95 -> LATIN SMALL LETTER N
+ u'o' # 0x96 -> LATIN SMALL LETTER O
+ u'p' # 0x97 -> LATIN SMALL LETTER P
+ u'q' # 0x98 -> LATIN SMALL LETTER Q
+ u'r' # 0x99 -> LATIN SMALL LETTER R
+ u'\ufffe' # 0x9A -> UNDEFINED
+ u'\ufffe' # 0x9B -> UNDEFINED
+ u'\ufffe' # 0x9C -> UNDEFINED
+ u'\xb8' # 0x9D -> CEDILLA
+ u'\ufffe' # 0x9E -> UNDEFINED
+ u'\xa4' # 0x9F -> CURRENCY SIGN
+ u'\xb5' # 0xA0 -> MICRO SIGN
+ u'~' # 0xA1 -> TILDE
+ u's' # 0xA2 -> LATIN SMALL LETTER S
+ u't' # 0xA3 -> LATIN SMALL LETTER T
+ u'u' # 0xA4 -> LATIN SMALL LETTER U
+ u'v' # 0xA5 -> LATIN SMALL LETTER V
+ u'w' # 0xA6 -> LATIN SMALL LETTER W
+ u'x' # 0xA7 -> LATIN SMALL LETTER X
+ u'y' # 0xA8 -> LATIN SMALL LETTER Y
+ u'z' # 0xA9 -> LATIN SMALL LETTER Z
+ u'\ufffe' # 0xAA -> UNDEFINED
+ u'\ufffe' # 0xAB -> UNDEFINED
+ u'\ufffe' # 0xAC -> UNDEFINED
+ u'\ufffe' # 0xAD -> UNDEFINED
+ u'\ufffe' # 0xAE -> UNDEFINED
+ u'\xae' # 0xAF -> REGISTERED SIGN
+ u'^' # 0xB0 -> CIRCUMFLEX ACCENT
+ u'\xa3' # 0xB1 -> POUND SIGN
+ u'\xa5' # 0xB2 -> YEN SIGN
+ u'\xb7' # 0xB3 -> MIDDLE DOT
+ u'\xa9' # 0xB4 -> COPYRIGHT SIGN
+ u'\xa7' # 0xB5 -> SECTION SIGN
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER
+ u'\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF
+ u'\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS
+ u'[' # 0xBA -> LEFT SQUARE BRACKET
+ u']' # 0xBB -> RIGHT SQUARE BRACKET
+ u'\xaf' # 0xBC -> MACRON
+ u'\xa8' # 0xBD -> DIAERESIS
+ u'\xb4' # 0xBE -> ACUTE ACCENT
+ u'\xd7' # 0xBF -> MULTIPLICATION SIGN
+ u'{' # 0xC0 -> LEFT CURLY BRACKET
+ u'A' # 0xC1 -> LATIN CAPITAL LETTER A
+ u'B' # 0xC2 -> LATIN CAPITAL LETTER B
+ u'C' # 0xC3 -> LATIN CAPITAL LETTER C
+ u'D' # 0xC4 -> LATIN CAPITAL LETTER D
+ u'E' # 0xC5 -> LATIN CAPITAL LETTER E
+ u'F' # 0xC6 -> LATIN CAPITAL LETTER F
+ u'G' # 0xC7 -> LATIN CAPITAL LETTER G
+ u'H' # 0xC8 -> LATIN CAPITAL LETTER H
+ u'I' # 0xC9 -> LATIN CAPITAL LETTER I
+ u'\xad' # 0xCA -> SOFT HYPHEN
+ u'\ufffe' # 0xCB -> UNDEFINED
+ u'\ufffe' # 0xCC -> UNDEFINED
+ u'\ufffe' # 0xCD -> UNDEFINED
+ u'\ufffe' # 0xCE -> UNDEFINED
+ u'\ufffe' # 0xCF -> UNDEFINED
+ u'}' # 0xD0 -> RIGHT CURLY BRACKET
+ u'J' # 0xD1 -> LATIN CAPITAL LETTER J
+ u'K' # 0xD2 -> LATIN CAPITAL LETTER K
+ u'L' # 0xD3 -> LATIN CAPITAL LETTER L
+ u'M' # 0xD4 -> LATIN CAPITAL LETTER M
+ u'N' # 0xD5 -> LATIN CAPITAL LETTER N
+ u'O' # 0xD6 -> LATIN CAPITAL LETTER O
+ u'P' # 0xD7 -> LATIN CAPITAL LETTER P
+ u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q
+ u'R' # 0xD9 -> LATIN CAPITAL LETTER R
+ u'\xb9' # 0xDA -> SUPERSCRIPT ONE
+ u'\ufffe' # 0xDB -> UNDEFINED
+ u'\ufffe' # 0xDC -> UNDEFINED
+ u'\ufffe' # 0xDD -> UNDEFINED
+ u'\ufffe' # 0xDE -> UNDEFINED
+ u'\ufffe' # 0xDF -> UNDEFINED
+ u'\\' # 0xE0 -> REVERSE SOLIDUS
+ u'\xf7' # 0xE1 -> DIVISION SIGN
+ u'S' # 0xE2 -> LATIN CAPITAL LETTER S
+ u'T' # 0xE3 -> LATIN CAPITAL LETTER T
+ u'U' # 0xE4 -> LATIN CAPITAL LETTER U
+ u'V' # 0xE5 -> LATIN CAPITAL LETTER V
+ u'W' # 0xE6 -> LATIN CAPITAL LETTER W
+ u'X' # 0xE7 -> LATIN CAPITAL LETTER X
+ u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z
+ u'\xb2' # 0xEA -> SUPERSCRIPT TWO
+ u'\ufffe' # 0xEB -> UNDEFINED
+ u'\ufffe' # 0xEC -> UNDEFINED
+ u'\ufffe' # 0xED -> UNDEFINED
+ u'\ufffe' # 0xEE -> UNDEFINED
+ u'\ufffe' # 0xEF -> UNDEFINED
+ u'0' # 0xF0 -> DIGIT ZERO
+ u'1' # 0xF1 -> DIGIT ONE
+ u'2' # 0xF2 -> DIGIT TWO
+ u'3' # 0xF3 -> DIGIT THREE
+ u'4' # 0xF4 -> DIGIT FOUR
+ u'5' # 0xF5 -> DIGIT FIVE
+ u'6' # 0xF6 -> DIGIT SIX
+ u'7' # 0xF7 -> DIGIT SEVEN
+ u'8' # 0xF8 -> DIGIT EIGHT
+ u'9' # 0xF9 -> DIGIT NINE
+ u'\xb3' # 0xFA -> SUPERSCRIPT THREE
+ u'\ufffe' # 0xFB -> UNDEFINED
+ u'\ufffe' # 0xFC -> UNDEFINED
+ u'\ufffe' # 0xFD -> UNDEFINED
+ u'\ufffe' # 0xFE -> UNDEFINED
+ u'\x9f' # 0xFF -> EIGHT ONES
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..800ae5021e
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp437.py
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec cp437 generated from 'VENDORS/MICSFT/PC/CP437.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp437',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE
+ 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE
+ 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE
+ 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX
+ 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS
+ 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE
+ 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS
+ 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX
+ 0x008d: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE
+ 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE
+ 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE
+ 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE
+ 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE
+ 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX
+ 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE
+ 0x0098: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS
+ 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x009b: 0x00a2, # CENT SIGN
+ 0x009c: 0x00a3, # POUND SIGN
+ 0x009d: 0x00a5, # YEN SIGN
+ 0x009e: 0x20a7, # PESETA SIGN
+ 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK
+ 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE
+ 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE
+ 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR
+ 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR
+ 0x00a8: 0x00bf, # INVERTED QUESTION MARK
+ 0x00a9: 0x2310, # REVERSED NOT SIGN
+ 0x00aa: 0x00ac, # NOT SIGN
+ 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF
+ 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER
+ 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK
+ 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00b0: 0x2591, # LIGHT SHADE
+ 0x00b1: 0x2592, # MEDIUM SHADE
+ 0x00b2: 0x2593, # DARK SHADE
+ 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL
+ 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x00db: 0x2588, # FULL BLOCK
+ 0x00dc: 0x2584, # LOWER HALF BLOCK
+ 0x00dd: 0x258c, # LEFT HALF BLOCK
+ 0x00de: 0x2590, # RIGHT HALF BLOCK
+ 0x00df: 0x2580, # UPPER HALF BLOCK
+ 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA
+ 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S
+ 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA
+ 0x00e3: 0x03c0, # GREEK SMALL LETTER PI
+ 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA
+ 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA
+ 0x00e6: 0x00b5, # MICRO SIGN
+ 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU
+ 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI
+ 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA
+ 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA
+ 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA
+ 0x00ec: 0x221e, # INFINITY
+ 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI
+ 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON
+ 0x00ef: 0x2229, # INTERSECTION
+ 0x00f0: 0x2261, # IDENTICAL TO
+ 0x00f1: 0x00b1, # PLUS-MINUS SIGN
+ 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO
+ 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO
+ 0x00f4: 0x2320, # TOP HALF INTEGRAL
+ 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL
+ 0x00f6: 0x00f7, # DIVISION SIGN
+ 0x00f7: 0x2248, # ALMOST EQUAL TO
+ 0x00f8: 0x00b0, # DEGREE SIGN
+ 0x00f9: 0x2219, # BULLET OPERATOR
+ 0x00fa: 0x00b7, # MIDDLE DOT
+ 0x00fb: 0x221a, # SQUARE ROOT
+ 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N
+ 0x00fd: 0x00b2, # SUPERSCRIPT TWO
+ 0x00fe: 0x25a0, # BLACK SQUARE
+ 0x00ff: 0x00a0, # NO-BREAK SPACE
+})
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x0000 -> NULL
+ u'\x01' # 0x0001 -> START OF HEADING
+ u'\x02' # 0x0002 -> START OF TEXT
+ u'\x03' # 0x0003 -> END OF TEXT
+ u'\x04' # 0x0004 -> END OF TRANSMISSION
+ u'\x05' # 0x0005 -> ENQUIRY
+ u'\x06' # 0x0006 -> ACKNOWLEDGE
+ u'\x07' # 0x0007 -> BELL
+ u'\x08' # 0x0008 -> BACKSPACE
+ u'\t' # 0x0009 -> HORIZONTAL TABULATION
+ u'\n' # 0x000a -> LINE FEED
+ u'\x0b' # 0x000b -> VERTICAL TABULATION
+ u'\x0c' # 0x000c -> FORM FEED
+ u'\r' # 0x000d -> CARRIAGE RETURN
+ u'\x0e' # 0x000e -> SHIFT OUT
+ u'\x0f' # 0x000f -> SHIFT IN
+ u'\x10' # 0x0010 -> DATA LINK ESCAPE
+ u'\x11' # 0x0011 -> DEVICE CONTROL ONE
+ u'\x12' # 0x0012 -> DEVICE CONTROL TWO
+ u'\x13' # 0x0013 -> DEVICE CONTROL THREE
+ u'\x14' # 0x0014 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x0016 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x0018 -> CANCEL
+ u'\x19' # 0x0019 -> END OF MEDIUM
+ u'\x1a' # 0x001a -> SUBSTITUTE
+ u'\x1b' # 0x001b -> ESCAPE
+ u'\x1c' # 0x001c -> FILE SEPARATOR
+ u'\x1d' # 0x001d -> GROUP SEPARATOR
+ u'\x1e' # 0x001e -> RECORD SEPARATOR
+ u'\x1f' # 0x001f -> UNIT SEPARATOR
+ u' ' # 0x0020 -> SPACE
+ u'!' # 0x0021 -> EXCLAMATION MARK
+ u'"' # 0x0022 -> QUOTATION MARK
+ u'#' # 0x0023 -> NUMBER SIGN
+ u'$' # 0x0024 -> DOLLAR SIGN
+ u'%' # 0x0025 -> PERCENT SIGN
+ u'&' # 0x0026 -> AMPERSAND
+ u"'" # 0x0027 -> APOSTROPHE
+ u'(' # 0x0028 -> LEFT PARENTHESIS
+ u')' # 0x0029 -> RIGHT PARENTHESIS
+ u'*' # 0x002a -> ASTERISK
+ u'+' # 0x002b -> PLUS SIGN
+ u',' # 0x002c -> COMMA
+ u'-' # 0x002d -> HYPHEN-MINUS
+ u'.' # 0x002e -> FULL STOP
+ u'/' # 0x002f -> SOLIDUS
+ u'0' # 0x0030 -> DIGIT ZERO
+ u'1' # 0x0031 -> DIGIT ONE
+ u'2' # 0x0032 -> DIGIT TWO
+ u'3' # 0x0033 -> DIGIT THREE
+ u'4' # 0x0034 -> DIGIT FOUR
+ u'5' # 0x0035 -> DIGIT FIVE
+ u'6' # 0x0036 -> DIGIT SIX
+ u'7' # 0x0037 -> DIGIT SEVEN
+ u'8' # 0x0038 -> DIGIT EIGHT
+ u'9' # 0x0039 -> DIGIT NINE
+ u':' # 0x003a -> COLON
+ u';' # 0x003b -> SEMICOLON
+ u'<' # 0x003c -> LESS-THAN SIGN
+ u'=' # 0x003d -> EQUALS SIGN
+ u'>' # 0x003e -> GREATER-THAN SIGN
+ u'?' # 0x003f -> QUESTION MARK
+ u'@' # 0x0040 -> COMMERCIAL AT
+ u'A' # 0x0041 -> LATIN CAPITAL LETTER A
+ u'B' # 0x0042 -> LATIN CAPITAL LETTER B
+ u'C' # 0x0043 -> LATIN CAPITAL LETTER C
+ u'D' # 0x0044 -> LATIN CAPITAL LETTER D
+ u'E' # 0x0045 -> LATIN CAPITAL LETTER E
+ u'F' # 0x0046 -> LATIN CAPITAL LETTER F
+ u'G' # 0x0047 -> LATIN CAPITAL LETTER G
+ u'H' # 0x0048 -> LATIN CAPITAL LETTER H
+ u'I' # 0x0049 -> LATIN CAPITAL LETTER I
+ u'J' # 0x004a -> LATIN CAPITAL LETTER J
+ u'K' # 0x004b -> LATIN CAPITAL LETTER K
+ u'L' # 0x004c -> LATIN CAPITAL LETTER L
+ u'M' # 0x004d -> LATIN CAPITAL LETTER M
+ u'N' # 0x004e -> LATIN CAPITAL LETTER N
+ u'O' # 0x004f -> LATIN CAPITAL LETTER O
+ u'P' # 0x0050 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x0052 -> LATIN CAPITAL LETTER R
+ u'S' # 0x0053 -> LATIN CAPITAL LETTER S
+ u'T' # 0x0054 -> LATIN CAPITAL LETTER T
+ u'U' # 0x0055 -> LATIN CAPITAL LETTER U
+ u'V' # 0x0056 -> LATIN CAPITAL LETTER V
+ u'W' # 0x0057 -> LATIN CAPITAL LETTER W
+ u'X' # 0x0058 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x005a -> LATIN CAPITAL LETTER Z
+ u'[' # 0x005b -> LEFT SQUARE BRACKET
+ u'\\' # 0x005c -> REVERSE SOLIDUS
+ u']' # 0x005d -> RIGHT SQUARE BRACKET
+ u'^' # 0x005e -> CIRCUMFLEX ACCENT
+ u'_' # 0x005f -> LOW LINE
+ u'`' # 0x0060 -> GRAVE ACCENT
+ u'a' # 0x0061 -> LATIN SMALL LETTER A
+ u'b' # 0x0062 -> LATIN SMALL LETTER B
+ u'c' # 0x0063 -> LATIN SMALL LETTER C
+ u'd' # 0x0064 -> LATIN SMALL LETTER D
+ u'e' # 0x0065 -> LATIN SMALL LETTER E
+ u'f' # 0x0066 -> LATIN SMALL LETTER F
+ u'g' # 0x0067 -> LATIN SMALL LETTER G
+ u'h' # 0x0068 -> LATIN SMALL LETTER H
+ u'i' # 0x0069 -> LATIN SMALL LETTER I
+ u'j' # 0x006a -> LATIN SMALL LETTER J
+ u'k' # 0x006b -> LATIN SMALL LETTER K
+ u'l' # 0x006c -> LATIN SMALL LETTER L
+ u'm' # 0x006d -> LATIN SMALL LETTER M
+ u'n' # 0x006e -> LATIN SMALL LETTER N
+ u'o' # 0x006f -> LATIN SMALL LETTER O
+ u'p' # 0x0070 -> LATIN SMALL LETTER P
+ u'q' # 0x0071 -> LATIN SMALL LETTER Q
+ u'r' # 0x0072 -> LATIN SMALL LETTER R
+ u's' # 0x0073 -> LATIN SMALL LETTER S
+ u't' # 0x0074 -> LATIN SMALL LETTER T
+ u'u' # 0x0075 -> LATIN SMALL LETTER U
+ u'v' # 0x0076 -> LATIN SMALL LETTER V
+ u'w' # 0x0077 -> LATIN SMALL LETTER W
+ u'x' # 0x0078 -> LATIN SMALL LETTER X
+ u'y' # 0x0079 -> LATIN SMALL LETTER Y
+ u'z' # 0x007a -> LATIN SMALL LETTER Z
+ u'{' # 0x007b -> LEFT CURLY BRACKET
+ u'|' # 0x007c -> VERTICAL LINE
+ u'}' # 0x007d -> RIGHT CURLY BRACKET
+ u'~' # 0x007e -> TILDE
+ u'\x7f' # 0x007f -> DELETE
+ u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xec' # 0x008d -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE
+ u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE
+ u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xff' # 0x0098 -> LATIN SMALL LETTER Y WITH DIAERESIS
+ u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xa2' # 0x009b -> CENT SIGN
+ u'\xa3' # 0x009c -> POUND SIGN
+ u'\xa5' # 0x009d -> YEN SIGN
+ u'\u20a7' # 0x009e -> PESETA SIGN
+ u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK
+ u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR
+ u'\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR
+ u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK
+ u'\u2310' # 0x00a9 -> REVERSED NOT SIGN
+ u'\xac' # 0x00aa -> NOT SIGN
+ u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF
+ u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER
+ u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK
+ u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2591' # 0x00b0 -> LIGHT SHADE
+ u'\u2592' # 0x00b1 -> MEDIUM SHADE
+ u'\u2593' # 0x00b2 -> DARK SHADE
+ u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL
+ u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL
+ u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT
+ u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT
+ u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT
+ u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT
+ u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL
+ u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
+ u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL
+ u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT
+ u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT
+ u'\u2588' # 0x00db -> FULL BLOCK
+ u'\u2584' # 0x00dc -> LOWER HALF BLOCK
+ u'\u258c' # 0x00dd -> LEFT HALF BLOCK
+ u'\u2590' # 0x00de -> RIGHT HALF BLOCK
+ u'\u2580' # 0x00df -> UPPER HALF BLOCK
+ u'\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA
+ u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S
+ u'\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA
+ u'\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI
+ u'\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA
+ u'\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA
+ u'\xb5' # 0x00e6 -> MICRO SIGN
+ u'\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU
+ u'\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI
+ u'\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA
+ u'\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA
+ u'\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA
+ u'\u221e' # 0x00ec -> INFINITY
+ u'\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI
+ u'\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON
+ u'\u2229' # 0x00ef -> INTERSECTION
+ u'\u2261' # 0x00f0 -> IDENTICAL TO
+ u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN
+ u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO
+ u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO
+ u'\u2320' # 0x00f4 -> TOP HALF INTEGRAL
+ u'\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL
+ u'\xf7' # 0x00f6 -> DIVISION SIGN
+ u'\u2248' # 0x00f7 -> ALMOST EQUAL TO
+ u'\xb0' # 0x00f8 -> DEGREE SIGN
+ u'\u2219' # 0x00f9 -> BULLET OPERATOR
+ u'\xb7' # 0x00fa -> MIDDLE DOT
+ u'\u221a' # 0x00fb -> SQUARE ROOT
+ u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N
+ u'\xb2' # 0x00fd -> SUPERSCRIPT TWO
+ u'\u25a0' # 0x00fe -> BLACK SQUARE
+ u'\xa0' # 0x00ff -> NO-BREAK SPACE
+)
+
+### Encoding Map
+
+encoding_map = {
+ 0x0000: 0x0000, # NULL
+ 0x0001: 0x0001, # START OF HEADING
+ 0x0002: 0x0002, # START OF TEXT
+ 0x0003: 0x0003, # END OF TEXT
+ 0x0004: 0x0004, # END OF TRANSMISSION
+ 0x0005: 0x0005, # ENQUIRY
+ 0x0006: 0x0006, # ACKNOWLEDGE
+ 0x0007: 0x0007, # BELL
+ 0x0008: 0x0008, # BACKSPACE
+ 0x0009: 0x0009, # HORIZONTAL TABULATION
+ 0x000a: 0x000a, # LINE FEED
+ 0x000b: 0x000b, # VERTICAL TABULATION
+ 0x000c: 0x000c, # FORM FEED
+ 0x000d: 0x000d, # CARRIAGE RETURN
+ 0x000e: 0x000e, # SHIFT OUT
+ 0x000f: 0x000f, # SHIFT IN
+ 0x0010: 0x0010, # DATA LINK ESCAPE
+ 0x0011: 0x0011, # DEVICE CONTROL ONE
+ 0x0012: 0x0012, # DEVICE CONTROL TWO
+ 0x0013: 0x0013, # DEVICE CONTROL THREE
+ 0x0014: 0x0014, # DEVICE CONTROL FOUR
+ 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE
+ 0x0016: 0x0016, # SYNCHRONOUS IDLE
+ 0x0017: 0x0017, # END OF TRANSMISSION BLOCK
+ 0x0018: 0x0018, # CANCEL
+ 0x0019: 0x0019, # END OF MEDIUM
+ 0x001a: 0x001a, # SUBSTITUTE
+ 0x001b: 0x001b, # ESCAPE
+ 0x001c: 0x001c, # FILE SEPARATOR
+ 0x001d: 0x001d, # GROUP SEPARATOR
+ 0x001e: 0x001e, # RECORD SEPARATOR
+ 0x001f: 0x001f, # UNIT SEPARATOR
+ 0x0020: 0x0020, # SPACE
+ 0x0021: 0x0021, # EXCLAMATION MARK
+ 0x0022: 0x0022, # QUOTATION MARK
+ 0x0023: 0x0023, # NUMBER SIGN
+ 0x0024: 0x0024, # DOLLAR SIGN
+ 0x0025: 0x0025, # PERCENT SIGN
+ 0x0026: 0x0026, # AMPERSAND
+ 0x0027: 0x0027, # APOSTROPHE
+ 0x0028: 0x0028, # LEFT PARENTHESIS
+ 0x0029: 0x0029, # RIGHT PARENTHESIS
+ 0x002a: 0x002a, # ASTERISK
+ 0x002b: 0x002b, # PLUS SIGN
+ 0x002c: 0x002c, # COMMA
+ 0x002d: 0x002d, # HYPHEN-MINUS
+ 0x002e: 0x002e, # FULL STOP
+ 0x002f: 0x002f, # SOLIDUS
+ 0x0030: 0x0030, # DIGIT ZERO
+ 0x0031: 0x0031, # DIGIT ONE
+ 0x0032: 0x0032, # DIGIT TWO
+ 0x0033: 0x0033, # DIGIT THREE
+ 0x0034: 0x0034, # DIGIT FOUR
+ 0x0035: 0x0035, # DIGIT FIVE
+ 0x0036: 0x0036, # DIGIT SIX
+ 0x0037: 0x0037, # DIGIT SEVEN
+ 0x0038: 0x0038, # DIGIT EIGHT
+ 0x0039: 0x0039, # DIGIT NINE
+ 0x003a: 0x003a, # COLON
+ 0x003b: 0x003b, # SEMICOLON
+ 0x003c: 0x003c, # LESS-THAN SIGN
+ 0x003d: 0x003d, # EQUALS SIGN
+ 0x003e: 0x003e, # GREATER-THAN SIGN
+ 0x003f: 0x003f, # QUESTION MARK
+ 0x0040: 0x0040, # COMMERCIAL AT
+ 0x0041: 0x0041, # LATIN CAPITAL LETTER A
+ 0x0042: 0x0042, # LATIN CAPITAL LETTER B
+ 0x0043: 0x0043, # LATIN CAPITAL LETTER C
+ 0x0044: 0x0044, # LATIN CAPITAL LETTER D
+ 0x0045: 0x0045, # LATIN CAPITAL LETTER E
+ 0x0046: 0x0046, # LATIN CAPITAL LETTER F
+ 0x0047: 0x0047, # LATIN CAPITAL LETTER G
+ 0x0048: 0x0048, # LATIN CAPITAL LETTER H
+ 0x0049: 0x0049, # LATIN CAPITAL LETTER I
+ 0x004a: 0x004a, # LATIN CAPITAL LETTER J
+ 0x004b: 0x004b, # LATIN CAPITAL LETTER K
+ 0x004c: 0x004c, # LATIN CAPITAL LETTER L
+ 0x004d: 0x004d, # LATIN CAPITAL LETTER M
+ 0x004e: 0x004e, # LATIN CAPITAL LETTER N
+ 0x004f: 0x004f, # LATIN CAPITAL LETTER O
+ 0x0050: 0x0050, # LATIN CAPITAL LETTER P
+ 0x0051: 0x0051, # LATIN CAPITAL LETTER Q
+ 0x0052: 0x0052, # LATIN CAPITAL LETTER R
+ 0x0053: 0x0053, # LATIN CAPITAL LETTER S
+ 0x0054: 0x0054, # LATIN CAPITAL LETTER T
+ 0x0055: 0x0055, # LATIN CAPITAL LETTER U
+ 0x0056: 0x0056, # LATIN CAPITAL LETTER V
+ 0x0057: 0x0057, # LATIN CAPITAL LETTER W
+ 0x0058: 0x0058, # LATIN CAPITAL LETTER X
+ 0x0059: 0x0059, # LATIN CAPITAL LETTER Y
+ 0x005a: 0x005a, # LATIN CAPITAL LETTER Z
+ 0x005b: 0x005b, # LEFT SQUARE BRACKET
+ 0x005c: 0x005c, # REVERSE SOLIDUS
+ 0x005d: 0x005d, # RIGHT SQUARE BRACKET
+ 0x005e: 0x005e, # CIRCUMFLEX ACCENT
+ 0x005f: 0x005f, # LOW LINE
+ 0x0060: 0x0060, # GRAVE ACCENT
+ 0x0061: 0x0061, # LATIN SMALL LETTER A
+ 0x0062: 0x0062, # LATIN SMALL LETTER B
+ 0x0063: 0x0063, # LATIN SMALL LETTER C
+ 0x0064: 0x0064, # LATIN SMALL LETTER D
+ 0x0065: 0x0065, # LATIN SMALL LETTER E
+ 0x0066: 0x0066, # LATIN SMALL LETTER F
+ 0x0067: 0x0067, # LATIN SMALL LETTER G
+ 0x0068: 0x0068, # LATIN SMALL LETTER H
+ 0x0069: 0x0069, # LATIN SMALL LETTER I
+ 0x006a: 0x006a, # LATIN SMALL LETTER J
+ 0x006b: 0x006b, # LATIN SMALL LETTER K
+ 0x006c: 0x006c, # LATIN SMALL LETTER L
+ 0x006d: 0x006d, # LATIN SMALL LETTER M
+ 0x006e: 0x006e, # LATIN SMALL LETTER N
+ 0x006f: 0x006f, # LATIN SMALL LETTER O
+ 0x0070: 0x0070, # LATIN SMALL LETTER P
+ 0x0071: 0x0071, # LATIN SMALL LETTER Q
+ 0x0072: 0x0072, # LATIN SMALL LETTER R
+ 0x0073: 0x0073, # LATIN SMALL LETTER S
+ 0x0074: 0x0074, # LATIN SMALL LETTER T
+ 0x0075: 0x0075, # LATIN SMALL LETTER U
+ 0x0076: 0x0076, # LATIN SMALL LETTER V
+ 0x0077: 0x0077, # LATIN SMALL LETTER W
+ 0x0078: 0x0078, # LATIN SMALL LETTER X
+ 0x0079: 0x0079, # LATIN SMALL LETTER Y
+ 0x007a: 0x007a, # LATIN SMALL LETTER Z
+ 0x007b: 0x007b, # LEFT CURLY BRACKET
+ 0x007c: 0x007c, # VERTICAL LINE
+ 0x007d: 0x007d, # RIGHT CURLY BRACKET
+ 0x007e: 0x007e, # TILDE
+ 0x007f: 0x007f, # DELETE
+ 0x00a0: 0x00ff, # NO-BREAK SPACE
+ 0x00a1: 0x00ad, # INVERTED EXCLAMATION MARK
+ 0x00a2: 0x009b, # CENT SIGN
+ 0x00a3: 0x009c, # POUND SIGN
+ 0x00a5: 0x009d, # YEN SIGN
+ 0x00aa: 0x00a6, # FEMININE ORDINAL INDICATOR
+ 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00ac: 0x00aa, # NOT SIGN
+ 0x00b0: 0x00f8, # DEGREE SIGN
+ 0x00b1: 0x00f1, # PLUS-MINUS SIGN
+ 0x00b2: 0x00fd, # SUPERSCRIPT TWO
+ 0x00b5: 0x00e6, # MICRO SIGN
+ 0x00b7: 0x00fa, # MIDDLE DOT
+ 0x00ba: 0x00a7, # MASCULINE ORDINAL INDICATOR
+ 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER
+ 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF
+ 0x00bf: 0x00a8, # INVERTED QUESTION MARK
+ 0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x00c5: 0x008f, # LATIN CAPITAL LETTER A WITH RING ABOVE
+ 0x00c6: 0x0092, # LATIN CAPITAL LIGATURE AE
+ 0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x00d1: 0x00a5, # LATIN CAPITAL LETTER N WITH TILDE
+ 0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S
+ 0x00e0: 0x0085, # LATIN SMALL LETTER A WITH GRAVE
+ 0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x00e5: 0x0086, # LATIN SMALL LETTER A WITH RING ABOVE
+ 0x00e6: 0x0091, # LATIN SMALL LIGATURE AE
+ 0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x00e8: 0x008a, # LATIN SMALL LETTER E WITH GRAVE
+ 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE
+ 0x00ea: 0x0088, # LATIN SMALL LETTER E WITH CIRCUMFLEX
+ 0x00eb: 0x0089, # LATIN SMALL LETTER E WITH DIAERESIS
+ 0x00ec: 0x008d, # LATIN SMALL LETTER I WITH GRAVE
+ 0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00ee: 0x008c, # LATIN SMALL LETTER I WITH CIRCUMFLEX
+ 0x00ef: 0x008b, # LATIN SMALL LETTER I WITH DIAERESIS
+ 0x00f1: 0x00a4, # LATIN SMALL LETTER N WITH TILDE
+ 0x00f2: 0x0095, # LATIN SMALL LETTER O WITH GRAVE
+ 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x00f7: 0x00f6, # DIVISION SIGN
+ 0x00f9: 0x0097, # LATIN SMALL LETTER U WITH GRAVE
+ 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00fb: 0x0096, # LATIN SMALL LETTER U WITH CIRCUMFLEX
+ 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x00ff: 0x0098, # LATIN SMALL LETTER Y WITH DIAERESIS
+ 0x0192: 0x009f, # LATIN SMALL LETTER F WITH HOOK
+ 0x0393: 0x00e2, # GREEK CAPITAL LETTER GAMMA
+ 0x0398: 0x00e9, # GREEK CAPITAL LETTER THETA
+ 0x03a3: 0x00e4, # GREEK CAPITAL LETTER SIGMA
+ 0x03a6: 0x00e8, # GREEK CAPITAL LETTER PHI
+ 0x03a9: 0x00ea, # GREEK CAPITAL LETTER OMEGA
+ 0x03b1: 0x00e0, # GREEK SMALL LETTER ALPHA
+ 0x03b4: 0x00eb, # GREEK SMALL LETTER DELTA
+ 0x03b5: 0x00ee, # GREEK SMALL LETTER EPSILON
+ 0x03c0: 0x00e3, # GREEK SMALL LETTER PI
+ 0x03c3: 0x00e5, # GREEK SMALL LETTER SIGMA
+ 0x03c4: 0x00e7, # GREEK SMALL LETTER TAU
+ 0x03c6: 0x00ed, # GREEK SMALL LETTER PHI
+ 0x207f: 0x00fc, # SUPERSCRIPT LATIN SMALL LETTER N
+ 0x20a7: 0x009e, # PESETA SIGN
+ 0x2219: 0x00f9, # BULLET OPERATOR
+ 0x221a: 0x00fb, # SQUARE ROOT
+ 0x221e: 0x00ec, # INFINITY
+ 0x2229: 0x00ef, # INTERSECTION
+ 0x2248: 0x00f7, # ALMOST EQUAL TO
+ 0x2261: 0x00f0, # IDENTICAL TO
+ 0x2264: 0x00f3, # LESS-THAN OR EQUAL TO
+ 0x2265: 0x00f2, # GREATER-THAN OR EQUAL TO
+ 0x2310: 0x00a9, # REVERSED NOT SIGN
+ 0x2320: 0x00f4, # TOP HALF INTEGRAL
+ 0x2321: 0x00f5, # BOTTOM HALF INTEGRAL
+ 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL
+ 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x2552: 0x00d5, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ 0x2553: 0x00d6, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x2555: 0x00b8, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ 0x2556: 0x00b7, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x2558: 0x00d4, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ 0x2559: 0x00d3, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x255b: 0x00be, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ 0x255c: 0x00bd, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x255e: 0x00c6, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ 0x255f: 0x00c7, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x2561: 0x00b5, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ 0x2562: 0x00b6, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x2564: 0x00d1, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ 0x2565: 0x00d2, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x2567: 0x00cf, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ 0x2568: 0x00d0, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x256a: 0x00d8, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ 0x256b: 0x00d7, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x2580: 0x00df, # UPPER HALF BLOCK
+ 0x2584: 0x00dc, # LOWER HALF BLOCK
+ 0x2588: 0x00db, # FULL BLOCK
+ 0x258c: 0x00dd, # LEFT HALF BLOCK
+ 0x2590: 0x00de, # RIGHT HALF BLOCK
+ 0x2591: 0x00b0, # LIGHT SHADE
+ 0x2592: 0x00b1, # MEDIUM SHADE
+ 0x2593: 0x00b2, # DARK SHADE
+ 0x25a0: 0x00fe, # BLACK SQUARE
+}
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
index 0000000000..5f609574c1
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp500.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp500 generated from 'MAPPINGS/VENDORS/MICSFT/EBCDIC/CP500.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp500',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x9c' # 0x04 -> CONTROL
+ u'\t' # 0x05 -> HORIZONTAL TABULATION
+ u'\x86' # 0x06 -> CONTROL
+ u'\x7f' # 0x07 -> DELETE
+ u'\x97' # 0x08 -> CONTROL
+ u'\x8d' # 0x09 -> CONTROL
+ u'\x8e' # 0x0A -> CONTROL
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x9d' # 0x14 -> CONTROL
+ u'\x85' # 0x15 -> CONTROL
+ u'\x08' # 0x16 -> BACKSPACE
+ u'\x87' # 0x17 -> CONTROL
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x92' # 0x1A -> CONTROL
+ u'\x8f' # 0x1B -> CONTROL
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u'\x80' # 0x20 -> CONTROL
+ u'\x81' # 0x21 -> CONTROL
+ u'\x82' # 0x22 -> CONTROL
+ u'\x83' # 0x23 -> CONTROL
+ u'\x84' # 0x24 -> CONTROL
+ u'\n' # 0x25 -> LINE FEED
+ u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK
+ u'\x1b' # 0x27 -> ESCAPE
+ u'\x88' # 0x28 -> CONTROL
+ u'\x89' # 0x29 -> CONTROL
+ u'\x8a' # 0x2A -> CONTROL
+ u'\x8b' # 0x2B -> CONTROL
+ u'\x8c' # 0x2C -> CONTROL
+ u'\x05' # 0x2D -> ENQUIRY
+ u'\x06' # 0x2E -> ACKNOWLEDGE
+ u'\x07' # 0x2F -> BELL
+ u'\x90' # 0x30 -> CONTROL
+ u'\x91' # 0x31 -> CONTROL
+ u'\x16' # 0x32 -> SYNCHRONOUS IDLE
+ u'\x93' # 0x33 -> CONTROL
+ u'\x94' # 0x34 -> CONTROL
+ u'\x95' # 0x35 -> CONTROL
+ u'\x96' # 0x36 -> CONTROL
+ u'\x04' # 0x37 -> END OF TRANSMISSION
+ u'\x98' # 0x38 -> CONTROL
+ u'\x99' # 0x39 -> CONTROL
+ u'\x9a' # 0x3A -> CONTROL
+ u'\x9b' # 0x3B -> CONTROL
+ u'\x14' # 0x3C -> DEVICE CONTROL FOUR
+ u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE
+ u'\x9e' # 0x3E -> CONTROL
+ u'\x1a' # 0x3F -> SUBSTITUTE
+ u' ' # 0x40 -> SPACE
+ u'\xa0' # 0x41 -> NO-BREAK SPACE
+ u'\xe2' # 0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe4' # 0x43 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe0' # 0x44 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe1' # 0x45 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe3' # 0x46 -> LATIN SMALL LETTER A WITH TILDE
+ u'\xe5' # 0x47 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe7' # 0x48 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xf1' # 0x49 -> LATIN SMALL LETTER N WITH TILDE
+ u'[' # 0x4A -> LEFT SQUARE BRACKET
+ u'.' # 0x4B -> FULL STOP
+ u'<' # 0x4C -> LESS-THAN SIGN
+ u'(' # 0x4D -> LEFT PARENTHESIS
+ u'+' # 0x4E -> PLUS SIGN
+ u'!' # 0x4F -> EXCLAMATION MARK
+ u'&' # 0x50 -> AMPERSAND
+ u'\xe9' # 0x51 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xea' # 0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x53 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xe8' # 0x54 -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xed' # 0x55 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xee' # 0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0x57 -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xec' # 0x58 -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xdf' # 0x59 -> LATIN SMALL LETTER SHARP S (GERMAN)
+ u']' # 0x5A -> RIGHT SQUARE BRACKET
+ u'$' # 0x5B -> DOLLAR SIGN
+ u'*' # 0x5C -> ASTERISK
+ u')' # 0x5D -> RIGHT PARENTHESIS
+ u';' # 0x5E -> SEMICOLON
+ u'^' # 0x5F -> CIRCUMFLEX ACCENT
+ u'-' # 0x60 -> HYPHEN-MINUS
+ u'/' # 0x61 -> SOLIDUS
+ u'\xc2' # 0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xc4' # 0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc0' # 0x64 -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xc1' # 0x65 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc3' # 0x66 -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\xc5' # 0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc7' # 0x68 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xd1' # 0x69 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xa6' # 0x6A -> BROKEN BAR
+ u',' # 0x6B -> COMMA
+ u'%' # 0x6C -> PERCENT SIGN
+ u'_' # 0x6D -> LOW LINE
+ u'>' # 0x6E -> GREATER-THAN SIGN
+ u'?' # 0x6F -> QUESTION MARK
+ u'\xf8' # 0x70 -> LATIN SMALL LETTER O WITH STROKE
+ u'\xc9' # 0x71 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xca' # 0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xcb' # 0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xc8' # 0x74 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xcd' # 0x75 -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\xcc' # 0x78 -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'`' # 0x79 -> GRAVE ACCENT
+ u':' # 0x7A -> COLON
+ u'#' # 0x7B -> NUMBER SIGN
+ u'@' # 0x7C -> COMMERCIAL AT
+ u"'" # 0x7D -> APOSTROPHE
+ u'=' # 0x7E -> EQUALS SIGN
+ u'"' # 0x7F -> QUOTATION MARK
+ u'\xd8' # 0x80 -> LATIN CAPITAL LETTER O WITH STROKE
+ u'a' # 0x81 -> LATIN SMALL LETTER A
+ u'b' # 0x82 -> LATIN SMALL LETTER B
+ u'c' # 0x83 -> LATIN SMALL LETTER C
+ u'd' # 0x84 -> LATIN SMALL LETTER D
+ u'e' # 0x85 -> LATIN SMALL LETTER E
+ u'f' # 0x86 -> LATIN SMALL LETTER F
+ u'g' # 0x87 -> LATIN SMALL LETTER G
+ u'h' # 0x88 -> LATIN SMALL LETTER H
+ u'i' # 0x89 -> LATIN SMALL LETTER I
+ u'\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xf0' # 0x8C -> LATIN SMALL LETTER ETH (ICELANDIC)
+ u'\xfd' # 0x8D -> LATIN SMALL LETTER Y WITH ACUTE
+ u'\xfe' # 0x8E -> LATIN SMALL LETTER THORN (ICELANDIC)
+ u'\xb1' # 0x8F -> PLUS-MINUS SIGN
+ u'\xb0' # 0x90 -> DEGREE SIGN
+ u'j' # 0x91 -> LATIN SMALL LETTER J
+ u'k' # 0x92 -> LATIN SMALL LETTER K
+ u'l' # 0x93 -> LATIN SMALL LETTER L
+ u'm' # 0x94 -> LATIN SMALL LETTER M
+ u'n' # 0x95 -> LATIN SMALL LETTER N
+ u'o' # 0x96 -> LATIN SMALL LETTER O
+ u'p' # 0x97 -> LATIN SMALL LETTER P
+ u'q' # 0x98 -> LATIN SMALL LETTER Q
+ u'r' # 0x99 -> LATIN SMALL LETTER R
+ u'\xaa' # 0x9A -> FEMININE ORDINAL INDICATOR
+ u'\xba' # 0x9B -> MASCULINE ORDINAL INDICATOR
+ u'\xe6' # 0x9C -> LATIN SMALL LIGATURE AE
+ u'\xb8' # 0x9D -> CEDILLA
+ u'\xc6' # 0x9E -> LATIN CAPITAL LIGATURE AE
+ u'\xa4' # 0x9F -> CURRENCY SIGN
+ u'\xb5' # 0xA0 -> MICRO SIGN
+ u'~' # 0xA1 -> TILDE
+ u's' # 0xA2 -> LATIN SMALL LETTER S
+ u't' # 0xA3 -> LATIN SMALL LETTER T
+ u'u' # 0xA4 -> LATIN SMALL LETTER U
+ u'v' # 0xA5 -> LATIN SMALL LETTER V
+ u'w' # 0xA6 -> LATIN SMALL LETTER W
+ u'x' # 0xA7 -> LATIN SMALL LETTER X
+ u'y' # 0xA8 -> LATIN SMALL LETTER Y
+ u'z' # 0xA9 -> LATIN SMALL LETTER Z
+ u'\xa1' # 0xAA -> INVERTED EXCLAMATION MARK
+ u'\xbf' # 0xAB -> INVERTED QUESTION MARK
+ u'\xd0' # 0xAC -> LATIN CAPITAL LETTER ETH (ICELANDIC)
+ u'\xdd' # 0xAD -> LATIN CAPITAL LETTER Y WITH ACUTE
+ u'\xde' # 0xAE -> LATIN CAPITAL LETTER THORN (ICELANDIC)
+ u'\xae' # 0xAF -> REGISTERED SIGN
+ u'\xa2' # 0xB0 -> CENT SIGN
+ u'\xa3' # 0xB1 -> POUND SIGN
+ u'\xa5' # 0xB2 -> YEN SIGN
+ u'\xb7' # 0xB3 -> MIDDLE DOT
+ u'\xa9' # 0xB4 -> COPYRIGHT SIGN
+ u'\xa7' # 0xB5 -> SECTION SIGN
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER
+ u'\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF
+ u'\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS
+ u'\xac' # 0xBA -> NOT SIGN
+ u'|' # 0xBB -> VERTICAL LINE
+ u'\xaf' # 0xBC -> MACRON
+ u'\xa8' # 0xBD -> DIAERESIS
+ u'\xb4' # 0xBE -> ACUTE ACCENT
+ u'\xd7' # 0xBF -> MULTIPLICATION SIGN
+ u'{' # 0xC0 -> LEFT CURLY BRACKET
+ u'A' # 0xC1 -> LATIN CAPITAL LETTER A
+ u'B' # 0xC2 -> LATIN CAPITAL LETTER B
+ u'C' # 0xC3 -> LATIN CAPITAL LETTER C
+ u'D' # 0xC4 -> LATIN CAPITAL LETTER D
+ u'E' # 0xC5 -> LATIN CAPITAL LETTER E
+ u'F' # 0xC6 -> LATIN CAPITAL LETTER F
+ u'G' # 0xC7 -> LATIN CAPITAL LETTER G
+ u'H' # 0xC8 -> LATIN CAPITAL LETTER H
+ u'I' # 0xC9 -> LATIN CAPITAL LETTER I
+ u'\xad' # 0xCA -> SOFT HYPHEN
+ u'\xf4' # 0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf6' # 0xCC -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf2' # 0xCD -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xf3' # 0xCE -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf5' # 0xCF -> LATIN SMALL LETTER O WITH TILDE
+ u'}' # 0xD0 -> RIGHT CURLY BRACKET
+ u'J' # 0xD1 -> LATIN CAPITAL LETTER J
+ u'K' # 0xD2 -> LATIN CAPITAL LETTER K
+ u'L' # 0xD3 -> LATIN CAPITAL LETTER L
+ u'M' # 0xD4 -> LATIN CAPITAL LETTER M
+ u'N' # 0xD5 -> LATIN CAPITAL LETTER N
+ u'O' # 0xD6 -> LATIN CAPITAL LETTER O
+ u'P' # 0xD7 -> LATIN CAPITAL LETTER P
+ u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q
+ u'R' # 0xD9 -> LATIN CAPITAL LETTER R
+ u'\xb9' # 0xDA -> SUPERSCRIPT ONE
+ u'\xfb' # 0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0xDC -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xf9' # 0xDD -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfa' # 0xDE -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xff' # 0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS
+ u'\\' # 0xE0 -> REVERSE SOLIDUS
+ u'\xf7' # 0xE1 -> DIVISION SIGN
+ u'S' # 0xE2 -> LATIN CAPITAL LETTER S
+ u'T' # 0xE3 -> LATIN CAPITAL LETTER T
+ u'U' # 0xE4 -> LATIN CAPITAL LETTER U
+ u'V' # 0xE5 -> LATIN CAPITAL LETTER V
+ u'W' # 0xE6 -> LATIN CAPITAL LETTER W
+ u'X' # 0xE7 -> LATIN CAPITAL LETTER X
+ u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z
+ u'\xb2' # 0xEA -> SUPERSCRIPT TWO
+ u'\xd4' # 0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\xd6' # 0xEC -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xd2' # 0xED -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd5' # 0xEF -> LATIN CAPITAL LETTER O WITH TILDE
+ u'0' # 0xF0 -> DIGIT ZERO
+ u'1' # 0xF1 -> DIGIT ONE
+ u'2' # 0xF2 -> DIGIT TWO
+ u'3' # 0xF3 -> DIGIT THREE
+ u'4' # 0xF4 -> DIGIT FOUR
+ u'5' # 0xF5 -> DIGIT FIVE
+ u'6' # 0xF6 -> DIGIT SIX
+ u'7' # 0xF7 -> DIGIT SEVEN
+ u'8' # 0xF8 -> DIGIT EIGHT
+ u'9' # 0xF9 -> DIGIT NINE
+ u'\xb3' # 0xFA -> SUPERSCRIPT THREE
+ u'\xdb' # 0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xdc' # 0xFC -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xd9' # 0xFD -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\xda' # 0xFE -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\x9f' # 0xFF -> CONTROL
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..e8e0ae169c
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp720.py
@@ -0,0 +1,309 @@
+"""Python Character Mapping Codec cp720 generated on Windows:
+Vista 6.0.6002 SP2 Multiprocessor Free with the command:
+ python Tools/unicode/genwincodec.py 720
+"""#"
+
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp720',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> CONTROL CHARACTER
+ u'\x01' # 0x01 -> CONTROL CHARACTER
+ u'\x02' # 0x02 -> CONTROL CHARACTER
+ u'\x03' # 0x03 -> CONTROL CHARACTER
+ u'\x04' # 0x04 -> CONTROL CHARACTER
+ u'\x05' # 0x05 -> CONTROL CHARACTER
+ u'\x06' # 0x06 -> CONTROL CHARACTER
+ u'\x07' # 0x07 -> CONTROL CHARACTER
+ u'\x08' # 0x08 -> CONTROL CHARACTER
+ u'\t' # 0x09 -> CONTROL CHARACTER
+ u'\n' # 0x0A -> CONTROL CHARACTER
+ u'\x0b' # 0x0B -> CONTROL CHARACTER
+ u'\x0c' # 0x0C -> CONTROL CHARACTER
+ u'\r' # 0x0D -> CONTROL CHARACTER
+ u'\x0e' # 0x0E -> CONTROL CHARACTER
+ u'\x0f' # 0x0F -> CONTROL CHARACTER
+ u'\x10' # 0x10 -> CONTROL CHARACTER
+ u'\x11' # 0x11 -> CONTROL CHARACTER
+ u'\x12' # 0x12 -> CONTROL CHARACTER
+ u'\x13' # 0x13 -> CONTROL CHARACTER
+ u'\x14' # 0x14 -> CONTROL CHARACTER
+ u'\x15' # 0x15 -> CONTROL CHARACTER
+ u'\x16' # 0x16 -> CONTROL CHARACTER
+ u'\x17' # 0x17 -> CONTROL CHARACTER
+ u'\x18' # 0x18 -> CONTROL CHARACTER
+ u'\x19' # 0x19 -> CONTROL CHARACTER
+ u'\x1a' # 0x1A -> CONTROL CHARACTER
+ u'\x1b' # 0x1B -> CONTROL CHARACTER
+ u'\x1c' # 0x1C -> CONTROL CHARACTER
+ u'\x1d' # 0x1D -> CONTROL CHARACTER
+ u'\x1e' # 0x1E -> CONTROL CHARACTER
+ u'\x1f' # 0x1F -> CONTROL CHARACTER
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> CONTROL CHARACTER
+ u'\x80'
+ u'\x81'
+ u'\xe9' # 0x82 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xe2' # 0x83 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\x84'
+ u'\xe0' # 0x85 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\x86'
+ u'\xe7' # 0x87 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xea' # 0x88 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x89 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xe8' # 0x8A -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xef' # 0x8B -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xee' # 0x8C -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\x8d'
+ u'\x8e'
+ u'\x8f'
+ u'\x90'
+ u'\u0651' # 0x91 -> ARABIC SHADDA
+ u'\u0652' # 0x92 -> ARABIC SUKUN
+ u'\xf4' # 0x93 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xa4' # 0x94 -> CURRENCY SIGN
+ u'\u0640' # 0x95 -> ARABIC TATWEEL
+ u'\xfb' # 0x96 -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xf9' # 0x97 -> LATIN SMALL LETTER U WITH GRAVE
+ u'\u0621' # 0x98 -> ARABIC LETTER HAMZA
+ u'\u0622' # 0x99 -> ARABIC LETTER ALEF WITH MADDA ABOVE
+ u'\u0623' # 0x9A -> ARABIC LETTER ALEF WITH HAMZA ABOVE
+ u'\u0624' # 0x9B -> ARABIC LETTER WAW WITH HAMZA ABOVE
+ u'\xa3' # 0x9C -> POUND SIGN
+ u'\u0625' # 0x9D -> ARABIC LETTER ALEF WITH HAMZA BELOW
+ u'\u0626' # 0x9E -> ARABIC LETTER YEH WITH HAMZA ABOVE
+ u'\u0627' # 0x9F -> ARABIC LETTER ALEF
+ u'\u0628' # 0xA0 -> ARABIC LETTER BEH
+ u'\u0629' # 0xA1 -> ARABIC LETTER TEH MARBUTA
+ u'\u062a' # 0xA2 -> ARABIC LETTER TEH
+ u'\u062b' # 0xA3 -> ARABIC LETTER THEH
+ u'\u062c' # 0xA4 -> ARABIC LETTER JEEM
+ u'\u062d' # 0xA5 -> ARABIC LETTER HAH
+ u'\u062e' # 0xA6 -> ARABIC LETTER KHAH
+ u'\u062f' # 0xA7 -> ARABIC LETTER DAL
+ u'\u0630' # 0xA8 -> ARABIC LETTER THAL
+ u'\u0631' # 0xA9 -> ARABIC LETTER REH
+ u'\u0632' # 0xAA -> ARABIC LETTER ZAIN
+ u'\u0633' # 0xAB -> ARABIC LETTER SEEN
+ u'\u0634' # 0xAC -> ARABIC LETTER SHEEN
+ u'\u0635' # 0xAD -> ARABIC LETTER SAD
+ u'\xab' # 0xAE -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0xAF -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2591' # 0xB0 -> LIGHT SHADE
+ u'\u2592' # 0xB1 -> MEDIUM SHADE
+ u'\u2593' # 0xB2 -> DARK SHADE
+ u'\u2502' # 0xB3 -> BOX DRAWINGS LIGHT VERTICAL
+ u'\u2524' # 0xB4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ u'\u2561' # 0xB5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ u'\u2562' # 0xB6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ u'\u2556' # 0xB7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ u'\u2555' # 0xB8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ u'\u2563' # 0xB9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ u'\u2551' # 0xBA -> BOX DRAWINGS DOUBLE VERTICAL
+ u'\u2557' # 0xBB -> BOX DRAWINGS DOUBLE DOWN AND LEFT
+ u'\u255d' # 0xBC -> BOX DRAWINGS DOUBLE UP AND LEFT
+ u'\u255c' # 0xBD -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ u'\u255b' # 0xBE -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ u'\u2510' # 0xBF -> BOX DRAWINGS LIGHT DOWN AND LEFT
+ u'\u2514' # 0xC0 -> BOX DRAWINGS LIGHT UP AND RIGHT
+ u'\u2534' # 0xC1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ u'\u252c' # 0xC2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ u'\u251c' # 0xC3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ u'\u2500' # 0xC4 -> BOX DRAWINGS LIGHT HORIZONTAL
+ u'\u253c' # 0xC5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ u'\u255e' # 0xC6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ u'\u255f' # 0xC7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ u'\u255a' # 0xC8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
+ u'\u2554' # 0xC9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ u'\u2569' # 0xCA -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ u'\u2566' # 0xCB -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ u'\u2560' # 0xCC -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ u'\u2550' # 0xCD -> BOX DRAWINGS DOUBLE HORIZONTAL
+ u'\u256c' # 0xCE -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ u'\u2567' # 0xCF -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ u'\u2568' # 0xD0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ u'\u2564' # 0xD1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ u'\u2565' # 0xD2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ u'\u2559' # 0xD3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ u'\u2558' # 0xD4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ u'\u2552' # 0xD5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ u'\u2553' # 0xD6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ u'\u256b' # 0xD7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ u'\u256a' # 0xD8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ u'\u2518' # 0xD9 -> BOX DRAWINGS LIGHT UP AND LEFT
+ u'\u250c' # 0xDA -> BOX DRAWINGS LIGHT DOWN AND RIGHT
+ u'\u2588' # 0xDB -> FULL BLOCK
+ u'\u2584' # 0xDC -> LOWER HALF BLOCK
+ u'\u258c' # 0xDD -> LEFT HALF BLOCK
+ u'\u2590' # 0xDE -> RIGHT HALF BLOCK
+ u'\u2580' # 0xDF -> UPPER HALF BLOCK
+ u'\u0636' # 0xE0 -> ARABIC LETTER DAD
+ u'\u0637' # 0xE1 -> ARABIC LETTER TAH
+ u'\u0638' # 0xE2 -> ARABIC LETTER ZAH
+ u'\u0639' # 0xE3 -> ARABIC LETTER AIN
+ u'\u063a' # 0xE4 -> ARABIC LETTER GHAIN
+ u'\u0641' # 0xE5 -> ARABIC LETTER FEH
+ u'\xb5' # 0xE6 -> MICRO SIGN
+ u'\u0642' # 0xE7 -> ARABIC LETTER QAF
+ u'\u0643' # 0xE8 -> ARABIC LETTER KAF
+ u'\u0644' # 0xE9 -> ARABIC LETTER LAM
+ u'\u0645' # 0xEA -> ARABIC LETTER MEEM
+ u'\u0646' # 0xEB -> ARABIC LETTER NOON
+ u'\u0647' # 0xEC -> ARABIC LETTER HEH
+ u'\u0648' # 0xED -> ARABIC LETTER WAW
+ u'\u0649' # 0xEE -> ARABIC LETTER ALEF MAKSURA
+ u'\u064a' # 0xEF -> ARABIC LETTER YEH
+ u'\u2261' # 0xF0 -> IDENTICAL TO
+ u'\u064b' # 0xF1 -> ARABIC FATHATAN
+ u'\u064c' # 0xF2 -> ARABIC DAMMATAN
+ u'\u064d' # 0xF3 -> ARABIC KASRATAN
+ u'\u064e' # 0xF4 -> ARABIC FATHA
+ u'\u064f' # 0xF5 -> ARABIC DAMMA
+ u'\u0650' # 0xF6 -> ARABIC KASRA
+ u'\u2248' # 0xF7 -> ALMOST EQUAL TO
+ u'\xb0' # 0xF8 -> DEGREE SIGN
+ u'\u2219' # 0xF9 -> BULLET OPERATOR
+ u'\xb7' # 0xFA -> MIDDLE DOT
+ u'\u221a' # 0xFB -> SQUARE ROOT
+ u'\u207f' # 0xFC -> SUPERSCRIPT LATIN SMALL LETTER N
+ u'\xb2' # 0xFD -> SUPERSCRIPT TWO
+ u'\u25a0' # 0xFE -> BLACK SQUARE
+ u'\xa0' # 0xFF -> NO-BREAK SPACE
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..2c080e5443
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp737.py
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec cp737 generated from 'VENDORS/MICSFT/PC/CP737.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp737',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0080: 0x0391, # GREEK CAPITAL LETTER ALPHA
+ 0x0081: 0x0392, # GREEK CAPITAL LETTER BETA
+ 0x0082: 0x0393, # GREEK CAPITAL LETTER GAMMA
+ 0x0083: 0x0394, # GREEK CAPITAL LETTER DELTA
+ 0x0084: 0x0395, # GREEK CAPITAL LETTER EPSILON
+ 0x0085: 0x0396, # GREEK CAPITAL LETTER ZETA
+ 0x0086: 0x0397, # GREEK CAPITAL LETTER ETA
+ 0x0087: 0x0398, # GREEK CAPITAL LETTER THETA
+ 0x0088: 0x0399, # GREEK CAPITAL LETTER IOTA
+ 0x0089: 0x039a, # GREEK CAPITAL LETTER KAPPA
+ 0x008a: 0x039b, # GREEK CAPITAL LETTER LAMDA
+ 0x008b: 0x039c, # GREEK CAPITAL LETTER MU
+ 0x008c: 0x039d, # GREEK CAPITAL LETTER NU
+ 0x008d: 0x039e, # GREEK CAPITAL LETTER XI
+ 0x008e: 0x039f, # GREEK CAPITAL LETTER OMICRON
+ 0x008f: 0x03a0, # GREEK CAPITAL LETTER PI
+ 0x0090: 0x03a1, # GREEK CAPITAL LETTER RHO
+ 0x0091: 0x03a3, # GREEK CAPITAL LETTER SIGMA
+ 0x0092: 0x03a4, # GREEK CAPITAL LETTER TAU
+ 0x0093: 0x03a5, # GREEK CAPITAL LETTER UPSILON
+ 0x0094: 0x03a6, # GREEK CAPITAL LETTER PHI
+ 0x0095: 0x03a7, # GREEK CAPITAL LETTER CHI
+ 0x0096: 0x03a8, # GREEK CAPITAL LETTER PSI
+ 0x0097: 0x03a9, # GREEK CAPITAL LETTER OMEGA
+ 0x0098: 0x03b1, # GREEK SMALL LETTER ALPHA
+ 0x0099: 0x03b2, # GREEK SMALL LETTER BETA
+ 0x009a: 0x03b3, # GREEK SMALL LETTER GAMMA
+ 0x009b: 0x03b4, # GREEK SMALL LETTER DELTA
+ 0x009c: 0x03b5, # GREEK SMALL LETTER EPSILON
+ 0x009d: 0x03b6, # GREEK SMALL LETTER ZETA
+ 0x009e: 0x03b7, # GREEK SMALL LETTER ETA
+ 0x009f: 0x03b8, # GREEK SMALL LETTER THETA
+ 0x00a0: 0x03b9, # GREEK SMALL LETTER IOTA
+ 0x00a1: 0x03ba, # GREEK SMALL LETTER KAPPA
+ 0x00a2: 0x03bb, # GREEK SMALL LETTER LAMDA
+ 0x00a3: 0x03bc, # GREEK SMALL LETTER MU
+ 0x00a4: 0x03bd, # GREEK SMALL LETTER NU
+ 0x00a5: 0x03be, # GREEK SMALL LETTER XI
+ 0x00a6: 0x03bf, # GREEK SMALL LETTER OMICRON
+ 0x00a7: 0x03c0, # GREEK SMALL LETTER PI
+ 0x00a8: 0x03c1, # GREEK SMALL LETTER RHO
+ 0x00a9: 0x03c3, # GREEK SMALL LETTER SIGMA
+ 0x00aa: 0x03c2, # GREEK SMALL LETTER FINAL SIGMA
+ 0x00ab: 0x03c4, # GREEK SMALL LETTER TAU
+ 0x00ac: 0x03c5, # GREEK SMALL LETTER UPSILON
+ 0x00ad: 0x03c6, # GREEK SMALL LETTER PHI
+ 0x00ae: 0x03c7, # GREEK SMALL LETTER CHI
+ 0x00af: 0x03c8, # GREEK SMALL LETTER PSI
+ 0x00b0: 0x2591, # LIGHT SHADE
+ 0x00b1: 0x2592, # MEDIUM SHADE
+ 0x00b2: 0x2593, # DARK SHADE
+ 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL
+ 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x00db: 0x2588, # FULL BLOCK
+ 0x00dc: 0x2584, # LOWER HALF BLOCK
+ 0x00dd: 0x258c, # LEFT HALF BLOCK
+ 0x00de: 0x2590, # RIGHT HALF BLOCK
+ 0x00df: 0x2580, # UPPER HALF BLOCK
+ 0x00e0: 0x03c9, # GREEK SMALL LETTER OMEGA
+ 0x00e1: 0x03ac, # GREEK SMALL LETTER ALPHA WITH TONOS
+ 0x00e2: 0x03ad, # GREEK SMALL LETTER EPSILON WITH TONOS
+ 0x00e3: 0x03ae, # GREEK SMALL LETTER ETA WITH TONOS
+ 0x00e4: 0x03ca, # GREEK SMALL LETTER IOTA WITH DIALYTIKA
+ 0x00e5: 0x03af, # GREEK SMALL LETTER IOTA WITH TONOS
+ 0x00e6: 0x03cc, # GREEK SMALL LETTER OMICRON WITH TONOS
+ 0x00e7: 0x03cd, # GREEK SMALL LETTER UPSILON WITH TONOS
+ 0x00e8: 0x03cb, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA
+ 0x00e9: 0x03ce, # GREEK SMALL LETTER OMEGA WITH TONOS
+ 0x00ea: 0x0386, # GREEK CAPITAL LETTER ALPHA WITH TONOS
+ 0x00eb: 0x0388, # GREEK CAPITAL LETTER EPSILON WITH TONOS
+ 0x00ec: 0x0389, # GREEK CAPITAL LETTER ETA WITH TONOS
+ 0x00ed: 0x038a, # GREEK CAPITAL LETTER IOTA WITH TONOS
+ 0x00ee: 0x038c, # GREEK CAPITAL LETTER OMICRON WITH TONOS
+ 0x00ef: 0x038e, # GREEK CAPITAL LETTER UPSILON WITH TONOS
+ 0x00f0: 0x038f, # GREEK CAPITAL LETTER OMEGA WITH TONOS
+ 0x00f1: 0x00b1, # PLUS-MINUS SIGN
+ 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO
+ 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO
+ 0x00f4: 0x03aa, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA
+ 0x00f5: 0x03ab, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
+ 0x00f6: 0x00f7, # DIVISION SIGN
+ 0x00f7: 0x2248, # ALMOST EQUAL TO
+ 0x00f8: 0x00b0, # DEGREE SIGN
+ 0x00f9: 0x2219, # BULLET OPERATOR
+ 0x00fa: 0x00b7, # MIDDLE DOT
+ 0x00fb: 0x221a, # SQUARE ROOT
+ 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N
+ 0x00fd: 0x00b2, # SUPERSCRIPT TWO
+ 0x00fe: 0x25a0, # BLACK SQUARE
+ 0x00ff: 0x00a0, # NO-BREAK SPACE
+})
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x0000 -> NULL
+ u'\x01' # 0x0001 -> START OF HEADING
+ u'\x02' # 0x0002 -> START OF TEXT
+ u'\x03' # 0x0003 -> END OF TEXT
+ u'\x04' # 0x0004 -> END OF TRANSMISSION
+ u'\x05' # 0x0005 -> ENQUIRY
+ u'\x06' # 0x0006 -> ACKNOWLEDGE
+ u'\x07' # 0x0007 -> BELL
+ u'\x08' # 0x0008 -> BACKSPACE
+ u'\t' # 0x0009 -> HORIZONTAL TABULATION
+ u'\n' # 0x000a -> LINE FEED
+ u'\x0b' # 0x000b -> VERTICAL TABULATION
+ u'\x0c' # 0x000c -> FORM FEED
+ u'\r' # 0x000d -> CARRIAGE RETURN
+ u'\x0e' # 0x000e -> SHIFT OUT
+ u'\x0f' # 0x000f -> SHIFT IN
+ u'\x10' # 0x0010 -> DATA LINK ESCAPE
+ u'\x11' # 0x0011 -> DEVICE CONTROL ONE
+ u'\x12' # 0x0012 -> DEVICE CONTROL TWO
+ u'\x13' # 0x0013 -> DEVICE CONTROL THREE
+ u'\x14' # 0x0014 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x0016 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x0018 -> CANCEL
+ u'\x19' # 0x0019 -> END OF MEDIUM
+ u'\x1a' # 0x001a -> SUBSTITUTE
+ u'\x1b' # 0x001b -> ESCAPE
+ u'\x1c' # 0x001c -> FILE SEPARATOR
+ u'\x1d' # 0x001d -> GROUP SEPARATOR
+ u'\x1e' # 0x001e -> RECORD SEPARATOR
+ u'\x1f' # 0x001f -> UNIT SEPARATOR
+ u' ' # 0x0020 -> SPACE
+ u'!' # 0x0021 -> EXCLAMATION MARK
+ u'"' # 0x0022 -> QUOTATION MARK
+ u'#' # 0x0023 -> NUMBER SIGN
+ u'$' # 0x0024 -> DOLLAR SIGN
+ u'%' # 0x0025 -> PERCENT SIGN
+ u'&' # 0x0026 -> AMPERSAND
+ u"'" # 0x0027 -> APOSTROPHE
+ u'(' # 0x0028 -> LEFT PARENTHESIS
+ u')' # 0x0029 -> RIGHT PARENTHESIS
+ u'*' # 0x002a -> ASTERISK
+ u'+' # 0x002b -> PLUS SIGN
+ u',' # 0x002c -> COMMA
+ u'-' # 0x002d -> HYPHEN-MINUS
+ u'.' # 0x002e -> FULL STOP
+ u'/' # 0x002f -> SOLIDUS
+ u'0' # 0x0030 -> DIGIT ZERO
+ u'1' # 0x0031 -> DIGIT ONE
+ u'2' # 0x0032 -> DIGIT TWO
+ u'3' # 0x0033 -> DIGIT THREE
+ u'4' # 0x0034 -> DIGIT FOUR
+ u'5' # 0x0035 -> DIGIT FIVE
+ u'6' # 0x0036 -> DIGIT SIX
+ u'7' # 0x0037 -> DIGIT SEVEN
+ u'8' # 0x0038 -> DIGIT EIGHT
+ u'9' # 0x0039 -> DIGIT NINE
+ u':' # 0x003a -> COLON
+ u';' # 0x003b -> SEMICOLON
+ u'<' # 0x003c -> LESS-THAN SIGN
+ u'=' # 0x003d -> EQUALS SIGN
+ u'>' # 0x003e -> GREATER-THAN SIGN
+ u'?' # 0x003f -> QUESTION MARK
+ u'@' # 0x0040 -> COMMERCIAL AT
+ u'A' # 0x0041 -> LATIN CAPITAL LETTER A
+ u'B' # 0x0042 -> LATIN CAPITAL LETTER B
+ u'C' # 0x0043 -> LATIN CAPITAL LETTER C
+ u'D' # 0x0044 -> LATIN CAPITAL LETTER D
+ u'E' # 0x0045 -> LATIN CAPITAL LETTER E
+ u'F' # 0x0046 -> LATIN CAPITAL LETTER F
+ u'G' # 0x0047 -> LATIN CAPITAL LETTER G
+ u'H' # 0x0048 -> LATIN CAPITAL LETTER H
+ u'I' # 0x0049 -> LATIN CAPITAL LETTER I
+ u'J' # 0x004a -> LATIN CAPITAL LETTER J
+ u'K' # 0x004b -> LATIN CAPITAL LETTER K
+ u'L' # 0x004c -> LATIN CAPITAL LETTER L
+ u'M' # 0x004d -> LATIN CAPITAL LETTER M
+ u'N' # 0x004e -> LATIN CAPITAL LETTER N
+ u'O' # 0x004f -> LATIN CAPITAL LETTER O
+ u'P' # 0x0050 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x0052 -> LATIN CAPITAL LETTER R
+ u'S' # 0x0053 -> LATIN CAPITAL LETTER S
+ u'T' # 0x0054 -> LATIN CAPITAL LETTER T
+ u'U' # 0x0055 -> LATIN CAPITAL LETTER U
+ u'V' # 0x0056 -> LATIN CAPITAL LETTER V
+ u'W' # 0x0057 -> LATIN CAPITAL LETTER W
+ u'X' # 0x0058 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x005a -> LATIN CAPITAL LETTER Z
+ u'[' # 0x005b -> LEFT SQUARE BRACKET
+ u'\\' # 0x005c -> REVERSE SOLIDUS
+ u']' # 0x005d -> RIGHT SQUARE BRACKET
+ u'^' # 0x005e -> CIRCUMFLEX ACCENT
+ u'_' # 0x005f -> LOW LINE
+ u'`' # 0x0060 -> GRAVE ACCENT
+ u'a' # 0x0061 -> LATIN SMALL LETTER A
+ u'b' # 0x0062 -> LATIN SMALL LETTER B
+ u'c' # 0x0063 -> LATIN SMALL LETTER C
+ u'd' # 0x0064 -> LATIN SMALL LETTER D
+ u'e' # 0x0065 -> LATIN SMALL LETTER E
+ u'f' # 0x0066 -> LATIN SMALL LETTER F
+ u'g' # 0x0067 -> LATIN SMALL LETTER G
+ u'h' # 0x0068 -> LATIN SMALL LETTER H
+ u'i' # 0x0069 -> LATIN SMALL LETTER I
+ u'j' # 0x006a -> LATIN SMALL LETTER J
+ u'k' # 0x006b -> LATIN SMALL LETTER K
+ u'l' # 0x006c -> LATIN SMALL LETTER L
+ u'm' # 0x006d -> LATIN SMALL LETTER M
+ u'n' # 0x006e -> LATIN SMALL LETTER N
+ u'o' # 0x006f -> LATIN SMALL LETTER O
+ u'p' # 0x0070 -> LATIN SMALL LETTER P
+ u'q' # 0x0071 -> LATIN SMALL LETTER Q
+ u'r' # 0x0072 -> LATIN SMALL LETTER R
+ u's' # 0x0073 -> LATIN SMALL LETTER S
+ u't' # 0x0074 -> LATIN SMALL LETTER T
+ u'u' # 0x0075 -> LATIN SMALL LETTER U
+ u'v' # 0x0076 -> LATIN SMALL LETTER V
+ u'w' # 0x0077 -> LATIN SMALL LETTER W
+ u'x' # 0x0078 -> LATIN SMALL LETTER X
+ u'y' # 0x0079 -> LATIN SMALL LETTER Y
+ u'z' # 0x007a -> LATIN SMALL LETTER Z
+ u'{' # 0x007b -> LEFT CURLY BRACKET
+ u'|' # 0x007c -> VERTICAL LINE
+ u'}' # 0x007d -> RIGHT CURLY BRACKET
+ u'~' # 0x007e -> TILDE
+ u'\x7f' # 0x007f -> DELETE
+ u'\u0391' # 0x0080 -> GREEK CAPITAL LETTER ALPHA
+ u'\u0392' # 0x0081 -> GREEK CAPITAL LETTER BETA
+ u'\u0393' # 0x0082 -> GREEK CAPITAL LETTER GAMMA
+ u'\u0394' # 0x0083 -> GREEK CAPITAL LETTER DELTA
+ u'\u0395' # 0x0084 -> GREEK CAPITAL LETTER EPSILON
+ u'\u0396' # 0x0085 -> GREEK CAPITAL LETTER ZETA
+ u'\u0397' # 0x0086 -> GREEK CAPITAL LETTER ETA
+ u'\u0398' # 0x0087 -> GREEK CAPITAL LETTER THETA
+ u'\u0399' # 0x0088 -> GREEK CAPITAL LETTER IOTA
+ u'\u039a' # 0x0089 -> GREEK CAPITAL LETTER KAPPA
+ u'\u039b' # 0x008a -> GREEK CAPITAL LETTER LAMDA
+ u'\u039c' # 0x008b -> GREEK CAPITAL LETTER MU
+ u'\u039d' # 0x008c -> GREEK CAPITAL LETTER NU
+ u'\u039e' # 0x008d -> GREEK CAPITAL LETTER XI
+ u'\u039f' # 0x008e -> GREEK CAPITAL LETTER OMICRON
+ u'\u03a0' # 0x008f -> GREEK CAPITAL LETTER PI
+ u'\u03a1' # 0x0090 -> GREEK CAPITAL LETTER RHO
+ u'\u03a3' # 0x0091 -> GREEK CAPITAL LETTER SIGMA
+ u'\u03a4' # 0x0092 -> GREEK CAPITAL LETTER TAU
+ u'\u03a5' # 0x0093 -> GREEK CAPITAL LETTER UPSILON
+ u'\u03a6' # 0x0094 -> GREEK CAPITAL LETTER PHI
+ u'\u03a7' # 0x0095 -> GREEK CAPITAL LETTER CHI
+ u'\u03a8' # 0x0096 -> GREEK CAPITAL LETTER PSI
+ u'\u03a9' # 0x0097 -> GREEK CAPITAL LETTER OMEGA
+ u'\u03b1' # 0x0098 -> GREEK SMALL LETTER ALPHA
+ u'\u03b2' # 0x0099 -> GREEK SMALL LETTER BETA
+ u'\u03b3' # 0x009a -> GREEK SMALL LETTER GAMMA
+ u'\u03b4' # 0x009b -> GREEK SMALL LETTER DELTA
+ u'\u03b5' # 0x009c -> GREEK SMALL LETTER EPSILON
+ u'\u03b6' # 0x009d -> GREEK SMALL LETTER ZETA
+ u'\u03b7' # 0x009e -> GREEK SMALL LETTER ETA
+ u'\u03b8' # 0x009f -> GREEK SMALL LETTER THETA
+ u'\u03b9' # 0x00a0 -> GREEK SMALL LETTER IOTA
+ u'\u03ba' # 0x00a1 -> GREEK SMALL LETTER KAPPA
+ u'\u03bb' # 0x00a2 -> GREEK SMALL LETTER LAMDA
+ u'\u03bc' # 0x00a3 -> GREEK SMALL LETTER MU
+ u'\u03bd' # 0x00a4 -> GREEK SMALL LETTER NU
+ u'\u03be' # 0x00a5 -> GREEK SMALL LETTER XI
+ u'\u03bf' # 0x00a6 -> GREEK SMALL LETTER OMICRON
+ u'\u03c0' # 0x00a7 -> GREEK SMALL LETTER PI
+ u'\u03c1' # 0x00a8 -> GREEK SMALL LETTER RHO
+ u'\u03c3' # 0x00a9 -> GREEK SMALL LETTER SIGMA
+ u'\u03c2' # 0x00aa -> GREEK SMALL LETTER FINAL SIGMA
+ u'\u03c4' # 0x00ab -> GREEK SMALL LETTER TAU
+ u'\u03c5' # 0x00ac -> GREEK SMALL LETTER UPSILON
+ u'\u03c6' # 0x00ad -> GREEK SMALL LETTER PHI
+ u'\u03c7' # 0x00ae -> GREEK SMALL LETTER CHI
+ u'\u03c8' # 0x00af -> GREEK SMALL LETTER PSI
+ u'\u2591' # 0x00b0 -> LIGHT SHADE
+ u'\u2592' # 0x00b1 -> MEDIUM SHADE
+ u'\u2593' # 0x00b2 -> DARK SHADE
+ u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL
+ u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL
+ u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT
+ u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT
+ u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT
+ u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT
+ u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL
+ u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
+ u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL
+ u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT
+ u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT
+ u'\u2588' # 0x00db -> FULL BLOCK
+ u'\u2584' # 0x00dc -> LOWER HALF BLOCK
+ u'\u258c' # 0x00dd -> LEFT HALF BLOCK
+ u'\u2590' # 0x00de -> RIGHT HALF BLOCK
+ u'\u2580' # 0x00df -> UPPER HALF BLOCK
+ u'\u03c9' # 0x00e0 -> GREEK SMALL LETTER OMEGA
+ u'\u03ac' # 0x00e1 -> GREEK SMALL LETTER ALPHA WITH TONOS
+ u'\u03ad' # 0x00e2 -> GREEK SMALL LETTER EPSILON WITH TONOS
+ u'\u03ae' # 0x00e3 -> GREEK SMALL LETTER ETA WITH TONOS
+ u'\u03ca' # 0x00e4 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA
+ u'\u03af' # 0x00e5 -> GREEK SMALL LETTER IOTA WITH TONOS
+ u'\u03cc' # 0x00e6 -> GREEK SMALL LETTER OMICRON WITH TONOS
+ u'\u03cd' # 0x00e7 -> GREEK SMALL LETTER UPSILON WITH TONOS
+ u'\u03cb' # 0x00e8 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA
+ u'\u03ce' # 0x00e9 -> GREEK SMALL LETTER OMEGA WITH TONOS
+ u'\u0386' # 0x00ea -> GREEK CAPITAL LETTER ALPHA WITH TONOS
+ u'\u0388' # 0x00eb -> GREEK CAPITAL LETTER EPSILON WITH TONOS
+ u'\u0389' # 0x00ec -> GREEK CAPITAL LETTER ETA WITH TONOS
+ u'\u038a' # 0x00ed -> GREEK CAPITAL LETTER IOTA WITH TONOS
+ u'\u038c' # 0x00ee -> GREEK CAPITAL LETTER OMICRON WITH TONOS
+ u'\u038e' # 0x00ef -> GREEK CAPITAL LETTER UPSILON WITH TONOS
+ u'\u038f' # 0x00f0 -> GREEK CAPITAL LETTER OMEGA WITH TONOS
+ u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN
+ u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO
+ u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO
+ u'\u03aa' # 0x00f4 -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA
+ u'\u03ab' # 0x00f5 -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
+ u'\xf7' # 0x00f6 -> DIVISION SIGN
+ u'\u2248' # 0x00f7 -> ALMOST EQUAL TO
+ u'\xb0' # 0x00f8 -> DEGREE SIGN
+ u'\u2219' # 0x00f9 -> BULLET OPERATOR
+ u'\xb7' # 0x00fa -> MIDDLE DOT
+ u'\u221a' # 0x00fb -> SQUARE ROOT
+ u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N
+ u'\xb2' # 0x00fd -> SUPERSCRIPT TWO
+ u'\u25a0' # 0x00fe -> BLACK SQUARE
+ u'\xa0' # 0x00ff -> NO-BREAK SPACE
+)
+
+### Encoding Map
+
+encoding_map = {
+ 0x0000: 0x0000, # NULL
+ 0x0001: 0x0001, # START OF HEADING
+ 0x0002: 0x0002, # START OF TEXT
+ 0x0003: 0x0003, # END OF TEXT
+ 0x0004: 0x0004, # END OF TRANSMISSION
+ 0x0005: 0x0005, # ENQUIRY
+ 0x0006: 0x0006, # ACKNOWLEDGE
+ 0x0007: 0x0007, # BELL
+ 0x0008: 0x0008, # BACKSPACE
+ 0x0009: 0x0009, # HORIZONTAL TABULATION
+ 0x000a: 0x000a, # LINE FEED
+ 0x000b: 0x000b, # VERTICAL TABULATION
+ 0x000c: 0x000c, # FORM FEED
+ 0x000d: 0x000d, # CARRIAGE RETURN
+ 0x000e: 0x000e, # SHIFT OUT
+ 0x000f: 0x000f, # SHIFT IN
+ 0x0010: 0x0010, # DATA LINK ESCAPE
+ 0x0011: 0x0011, # DEVICE CONTROL ONE
+ 0x0012: 0x0012, # DEVICE CONTROL TWO
+ 0x0013: 0x0013, # DEVICE CONTROL THREE
+ 0x0014: 0x0014, # DEVICE CONTROL FOUR
+ 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE
+ 0x0016: 0x0016, # SYNCHRONOUS IDLE
+ 0x0017: 0x0017, # END OF TRANSMISSION BLOCK
+ 0x0018: 0x0018, # CANCEL
+ 0x0019: 0x0019, # END OF MEDIUM
+ 0x001a: 0x001a, # SUBSTITUTE
+ 0x001b: 0x001b, # ESCAPE
+ 0x001c: 0x001c, # FILE SEPARATOR
+ 0x001d: 0x001d, # GROUP SEPARATOR
+ 0x001e: 0x001e, # RECORD SEPARATOR
+ 0x001f: 0x001f, # UNIT SEPARATOR
+ 0x0020: 0x0020, # SPACE
+ 0x0021: 0x0021, # EXCLAMATION MARK
+ 0x0022: 0x0022, # QUOTATION MARK
+ 0x0023: 0x0023, # NUMBER SIGN
+ 0x0024: 0x0024, # DOLLAR SIGN
+ 0x0025: 0x0025, # PERCENT SIGN
+ 0x0026: 0x0026, # AMPERSAND
+ 0x0027: 0x0027, # APOSTROPHE
+ 0x0028: 0x0028, # LEFT PARENTHESIS
+ 0x0029: 0x0029, # RIGHT PARENTHESIS
+ 0x002a: 0x002a, # ASTERISK
+ 0x002b: 0x002b, # PLUS SIGN
+ 0x002c: 0x002c, # COMMA
+ 0x002d: 0x002d, # HYPHEN-MINUS
+ 0x002e: 0x002e, # FULL STOP
+ 0x002f: 0x002f, # SOLIDUS
+ 0x0030: 0x0030, # DIGIT ZERO
+ 0x0031: 0x0031, # DIGIT ONE
+ 0x0032: 0x0032, # DIGIT TWO
+ 0x0033: 0x0033, # DIGIT THREE
+ 0x0034: 0x0034, # DIGIT FOUR
+ 0x0035: 0x0035, # DIGIT FIVE
+ 0x0036: 0x0036, # DIGIT SIX
+ 0x0037: 0x0037, # DIGIT SEVEN
+ 0x0038: 0x0038, # DIGIT EIGHT
+ 0x0039: 0x0039, # DIGIT NINE
+ 0x003a: 0x003a, # COLON
+ 0x003b: 0x003b, # SEMICOLON
+ 0x003c: 0x003c, # LESS-THAN SIGN
+ 0x003d: 0x003d, # EQUALS SIGN
+ 0x003e: 0x003e, # GREATER-THAN SIGN
+ 0x003f: 0x003f, # QUESTION MARK
+ 0x0040: 0x0040, # COMMERCIAL AT
+ 0x0041: 0x0041, # LATIN CAPITAL LETTER A
+ 0x0042: 0x0042, # LATIN CAPITAL LETTER B
+ 0x0043: 0x0043, # LATIN CAPITAL LETTER C
+ 0x0044: 0x0044, # LATIN CAPITAL LETTER D
+ 0x0045: 0x0045, # LATIN CAPITAL LETTER E
+ 0x0046: 0x0046, # LATIN CAPITAL LETTER F
+ 0x0047: 0x0047, # LATIN CAPITAL LETTER G
+ 0x0048: 0x0048, # LATIN CAPITAL LETTER H
+ 0x0049: 0x0049, # LATIN CAPITAL LETTER I
+ 0x004a: 0x004a, # LATIN CAPITAL LETTER J
+ 0x004b: 0x004b, # LATIN CAPITAL LETTER K
+ 0x004c: 0x004c, # LATIN CAPITAL LETTER L
+ 0x004d: 0x004d, # LATIN CAPITAL LETTER M
+ 0x004e: 0x004e, # LATIN CAPITAL LETTER N
+ 0x004f: 0x004f, # LATIN CAPITAL LETTER O
+ 0x0050: 0x0050, # LATIN CAPITAL LETTER P
+ 0x0051: 0x0051, # LATIN CAPITAL LETTER Q
+ 0x0052: 0x0052, # LATIN CAPITAL LETTER R
+ 0x0053: 0x0053, # LATIN CAPITAL LETTER S
+ 0x0054: 0x0054, # LATIN CAPITAL LETTER T
+ 0x0055: 0x0055, # LATIN CAPITAL LETTER U
+ 0x0056: 0x0056, # LATIN CAPITAL LETTER V
+ 0x0057: 0x0057, # LATIN CAPITAL LETTER W
+ 0x0058: 0x0058, # LATIN CAPITAL LETTER X
+ 0x0059: 0x0059, # LATIN CAPITAL LETTER Y
+ 0x005a: 0x005a, # LATIN CAPITAL LETTER Z
+ 0x005b: 0x005b, # LEFT SQUARE BRACKET
+ 0x005c: 0x005c, # REVERSE SOLIDUS
+ 0x005d: 0x005d, # RIGHT SQUARE BRACKET
+ 0x005e: 0x005e, # CIRCUMFLEX ACCENT
+ 0x005f: 0x005f, # LOW LINE
+ 0x0060: 0x0060, # GRAVE ACCENT
+ 0x0061: 0x0061, # LATIN SMALL LETTER A
+ 0x0062: 0x0062, # LATIN SMALL LETTER B
+ 0x0063: 0x0063, # LATIN SMALL LETTER C
+ 0x0064: 0x0064, # LATIN SMALL LETTER D
+ 0x0065: 0x0065, # LATIN SMALL LETTER E
+ 0x0066: 0x0066, # LATIN SMALL LETTER F
+ 0x0067: 0x0067, # LATIN SMALL LETTER G
+ 0x0068: 0x0068, # LATIN SMALL LETTER H
+ 0x0069: 0x0069, # LATIN SMALL LETTER I
+ 0x006a: 0x006a, # LATIN SMALL LETTER J
+ 0x006b: 0x006b, # LATIN SMALL LETTER K
+ 0x006c: 0x006c, # LATIN SMALL LETTER L
+ 0x006d: 0x006d, # LATIN SMALL LETTER M
+ 0x006e: 0x006e, # LATIN SMALL LETTER N
+ 0x006f: 0x006f, # LATIN SMALL LETTER O
+ 0x0070: 0x0070, # LATIN SMALL LETTER P
+ 0x0071: 0x0071, # LATIN SMALL LETTER Q
+ 0x0072: 0x0072, # LATIN SMALL LETTER R
+ 0x0073: 0x0073, # LATIN SMALL LETTER S
+ 0x0074: 0x0074, # LATIN SMALL LETTER T
+ 0x0075: 0x0075, # LATIN SMALL LETTER U
+ 0x0076: 0x0076, # LATIN SMALL LETTER V
+ 0x0077: 0x0077, # LATIN SMALL LETTER W
+ 0x0078: 0x0078, # LATIN SMALL LETTER X
+ 0x0079: 0x0079, # LATIN SMALL LETTER Y
+ 0x007a: 0x007a, # LATIN SMALL LETTER Z
+ 0x007b: 0x007b, # LEFT CURLY BRACKET
+ 0x007c: 0x007c, # VERTICAL LINE
+ 0x007d: 0x007d, # RIGHT CURLY BRACKET
+ 0x007e: 0x007e, # TILDE
+ 0x007f: 0x007f, # DELETE
+ 0x00a0: 0x00ff, # NO-BREAK SPACE
+ 0x00b0: 0x00f8, # DEGREE SIGN
+ 0x00b1: 0x00f1, # PLUS-MINUS SIGN
+ 0x00b2: 0x00fd, # SUPERSCRIPT TWO
+ 0x00b7: 0x00fa, # MIDDLE DOT
+ 0x00f7: 0x00f6, # DIVISION SIGN
+ 0x0386: 0x00ea, # GREEK CAPITAL LETTER ALPHA WITH TONOS
+ 0x0388: 0x00eb, # GREEK CAPITAL LETTER EPSILON WITH TONOS
+ 0x0389: 0x00ec, # GREEK CAPITAL LETTER ETA WITH TONOS
+ 0x038a: 0x00ed, # GREEK CAPITAL LETTER IOTA WITH TONOS
+ 0x038c: 0x00ee, # GREEK CAPITAL LETTER OMICRON WITH TONOS
+ 0x038e: 0x00ef, # GREEK CAPITAL LETTER UPSILON WITH TONOS
+ 0x038f: 0x00f0, # GREEK CAPITAL LETTER OMEGA WITH TONOS
+ 0x0391: 0x0080, # GREEK CAPITAL LETTER ALPHA
+ 0x0392: 0x0081, # GREEK CAPITAL LETTER BETA
+ 0x0393: 0x0082, # GREEK CAPITAL LETTER GAMMA
+ 0x0394: 0x0083, # GREEK CAPITAL LETTER DELTA
+ 0x0395: 0x0084, # GREEK CAPITAL LETTER EPSILON
+ 0x0396: 0x0085, # GREEK CAPITAL LETTER ZETA
+ 0x0397: 0x0086, # GREEK CAPITAL LETTER ETA
+ 0x0398: 0x0087, # GREEK CAPITAL LETTER THETA
+ 0x0399: 0x0088, # GREEK CAPITAL LETTER IOTA
+ 0x039a: 0x0089, # GREEK CAPITAL LETTER KAPPA
+ 0x039b: 0x008a, # GREEK CAPITAL LETTER LAMDA
+ 0x039c: 0x008b, # GREEK CAPITAL LETTER MU
+ 0x039d: 0x008c, # GREEK CAPITAL LETTER NU
+ 0x039e: 0x008d, # GREEK CAPITAL LETTER XI
+ 0x039f: 0x008e, # GREEK CAPITAL LETTER OMICRON
+ 0x03a0: 0x008f, # GREEK CAPITAL LETTER PI
+ 0x03a1: 0x0090, # GREEK CAPITAL LETTER RHO
+ 0x03a3: 0x0091, # GREEK CAPITAL LETTER SIGMA
+ 0x03a4: 0x0092, # GREEK CAPITAL LETTER TAU
+ 0x03a5: 0x0093, # GREEK CAPITAL LETTER UPSILON
+ 0x03a6: 0x0094, # GREEK CAPITAL LETTER PHI
+ 0x03a7: 0x0095, # GREEK CAPITAL LETTER CHI
+ 0x03a8: 0x0096, # GREEK CAPITAL LETTER PSI
+ 0x03a9: 0x0097, # GREEK CAPITAL LETTER OMEGA
+ 0x03aa: 0x00f4, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA
+ 0x03ab: 0x00f5, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
+ 0x03ac: 0x00e1, # GREEK SMALL LETTER ALPHA WITH TONOS
+ 0x03ad: 0x00e2, # GREEK SMALL LETTER EPSILON WITH TONOS
+ 0x03ae: 0x00e3, # GREEK SMALL LETTER ETA WITH TONOS
+ 0x03af: 0x00e5, # GREEK SMALL LETTER IOTA WITH TONOS
+ 0x03b1: 0x0098, # GREEK SMALL LETTER ALPHA
+ 0x03b2: 0x0099, # GREEK SMALL LETTER BETA
+ 0x03b3: 0x009a, # GREEK SMALL LETTER GAMMA
+ 0x03b4: 0x009b, # GREEK SMALL LETTER DELTA
+ 0x03b5: 0x009c, # GREEK SMALL LETTER EPSILON
+ 0x03b6: 0x009d, # GREEK SMALL LETTER ZETA
+ 0x03b7: 0x009e, # GREEK SMALL LETTER ETA
+ 0x03b8: 0x009f, # GREEK SMALL LETTER THETA
+ 0x03b9: 0x00a0, # GREEK SMALL LETTER IOTA
+ 0x03ba: 0x00a1, # GREEK SMALL LETTER KAPPA
+ 0x03bb: 0x00a2, # GREEK SMALL LETTER LAMDA
+ 0x03bc: 0x00a3, # GREEK SMALL LETTER MU
+ 0x03bd: 0x00a4, # GREEK SMALL LETTER NU
+ 0x03be: 0x00a5, # GREEK SMALL LETTER XI
+ 0x03bf: 0x00a6, # GREEK SMALL LETTER OMICRON
+ 0x03c0: 0x00a7, # GREEK SMALL LETTER PI
+ 0x03c1: 0x00a8, # GREEK SMALL LETTER RHO
+ 0x03c2: 0x00aa, # GREEK SMALL LETTER FINAL SIGMA
+ 0x03c3: 0x00a9, # GREEK SMALL LETTER SIGMA
+ 0x03c4: 0x00ab, # GREEK SMALL LETTER TAU
+ 0x03c5: 0x00ac, # GREEK SMALL LETTER UPSILON
+ 0x03c6: 0x00ad, # GREEK SMALL LETTER PHI
+ 0x03c7: 0x00ae, # GREEK SMALL LETTER CHI
+ 0x03c8: 0x00af, # GREEK SMALL LETTER PSI
+ 0x03c9: 0x00e0, # GREEK SMALL LETTER OMEGA
+ 0x03ca: 0x00e4, # GREEK SMALL LETTER IOTA WITH DIALYTIKA
+ 0x03cb: 0x00e8, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA
+ 0x03cc: 0x00e6, # GREEK SMALL LETTER OMICRON WITH TONOS
+ 0x03cd: 0x00e7, # GREEK SMALL LETTER UPSILON WITH TONOS
+ 0x03ce: 0x00e9, # GREEK SMALL LETTER OMEGA WITH TONOS
+ 0x207f: 0x00fc, # SUPERSCRIPT LATIN SMALL LETTER N
+ 0x2219: 0x00f9, # BULLET OPERATOR
+ 0x221a: 0x00fb, # SQUARE ROOT
+ 0x2248: 0x00f7, # ALMOST EQUAL TO
+ 0x2264: 0x00f3, # LESS-THAN OR EQUAL TO
+ 0x2265: 0x00f2, # GREATER-THAN OR EQUAL TO
+ 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL
+ 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x2552: 0x00d5, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ 0x2553: 0x00d6, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x2555: 0x00b8, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ 0x2556: 0x00b7, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x2558: 0x00d4, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ 0x2559: 0x00d3, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x255b: 0x00be, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ 0x255c: 0x00bd, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x255e: 0x00c6, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ 0x255f: 0x00c7, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x2561: 0x00b5, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ 0x2562: 0x00b6, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x2564: 0x00d1, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ 0x2565: 0x00d2, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x2567: 0x00cf, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ 0x2568: 0x00d0, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x256a: 0x00d8, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ 0x256b: 0x00d7, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x2580: 0x00df, # UPPER HALF BLOCK
+ 0x2584: 0x00dc, # LOWER HALF BLOCK
+ 0x2588: 0x00db, # FULL BLOCK
+ 0x258c: 0x00dd, # LEFT HALF BLOCK
+ 0x2590: 0x00de, # RIGHT HALF BLOCK
+ 0x2591: 0x00b0, # LIGHT SHADE
+ 0x2592: 0x00b1, # MEDIUM SHADE
+ 0x2593: 0x00b2, # DARK SHADE
+ 0x25a0: 0x00fe, # BLACK SQUARE
+}
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
index 0000000000..eadb989e13
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp775.py
@@ -0,0 +1,697 @@
+""" Python Character Mapping Codec cp775 generated from 'VENDORS/MICSFT/PC/CP775.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp775',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0080: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE
+ 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE
+ 0x0083: 0x0101, # LATIN SMALL LETTER A WITH MACRON
+ 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x0085: 0x0123, # LATIN SMALL LETTER G WITH CEDILLA
+ 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE
+ 0x0087: 0x0107, # LATIN SMALL LETTER C WITH ACUTE
+ 0x0088: 0x0142, # LATIN SMALL LETTER L WITH STROKE
+ 0x0089: 0x0113, # LATIN SMALL LETTER E WITH MACRON
+ 0x008a: 0x0156, # LATIN CAPITAL LETTER R WITH CEDILLA
+ 0x008b: 0x0157, # LATIN SMALL LETTER R WITH CEDILLA
+ 0x008c: 0x012b, # LATIN SMALL LETTER I WITH MACRON
+ 0x008d: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE
+ 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE
+ 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE
+ 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE
+ 0x0093: 0x014d, # LATIN SMALL LETTER O WITH MACRON
+ 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x0095: 0x0122, # LATIN CAPITAL LETTER G WITH CEDILLA
+ 0x0096: 0x00a2, # CENT SIGN
+ 0x0097: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE
+ 0x0098: 0x015b, # LATIN SMALL LETTER S WITH ACUTE
+ 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE
+ 0x009c: 0x00a3, # POUND SIGN
+ 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE
+ 0x009e: 0x00d7, # MULTIPLICATION SIGN
+ 0x009f: 0x00a4, # CURRENCY SIGN
+ 0x00a0: 0x0100, # LATIN CAPITAL LETTER A WITH MACRON
+ 0x00a1: 0x012a, # LATIN CAPITAL LETTER I WITH MACRON
+ 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00a3: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE
+ 0x00a4: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE
+ 0x00a5: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE
+ 0x00a6: 0x201d, # RIGHT DOUBLE QUOTATION MARK
+ 0x00a7: 0x00a6, # BROKEN BAR
+ 0x00a8: 0x00a9, # COPYRIGHT SIGN
+ 0x00a9: 0x00ae, # REGISTERED SIGN
+ 0x00aa: 0x00ac, # NOT SIGN
+ 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF
+ 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER
+ 0x00ad: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE
+ 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00b0: 0x2591, # LIGHT SHADE
+ 0x00b1: 0x2592, # MEDIUM SHADE
+ 0x00b2: 0x2593, # DARK SHADE
+ 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL
+ 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x00b5: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK
+ 0x00b6: 0x010c, # LATIN CAPITAL LETTER C WITH CARON
+ 0x00b7: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK
+ 0x00b8: 0x0116, # LATIN CAPITAL LETTER E WITH DOT ABOVE
+ 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x00bd: 0x012e, # LATIN CAPITAL LETTER I WITH OGONEK
+ 0x00be: 0x0160, # LATIN CAPITAL LETTER S WITH CARON
+ 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x00c6: 0x0172, # LATIN CAPITAL LETTER U WITH OGONEK
+ 0x00c7: 0x016a, # LATIN CAPITAL LETTER U WITH MACRON
+ 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x00cf: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON
+ 0x00d0: 0x0105, # LATIN SMALL LETTER A WITH OGONEK
+ 0x00d1: 0x010d, # LATIN SMALL LETTER C WITH CARON
+ 0x00d2: 0x0119, # LATIN SMALL LETTER E WITH OGONEK
+ 0x00d3: 0x0117, # LATIN SMALL LETTER E WITH DOT ABOVE
+ 0x00d4: 0x012f, # LATIN SMALL LETTER I WITH OGONEK
+ 0x00d5: 0x0161, # LATIN SMALL LETTER S WITH CARON
+ 0x00d6: 0x0173, # LATIN SMALL LETTER U WITH OGONEK
+ 0x00d7: 0x016b, # LATIN SMALL LETTER U WITH MACRON
+ 0x00d8: 0x017e, # LATIN SMALL LETTER Z WITH CARON
+ 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x00db: 0x2588, # FULL BLOCK
+ 0x00dc: 0x2584, # LOWER HALF BLOCK
+ 0x00dd: 0x258c, # LEFT HALF BLOCK
+ 0x00de: 0x2590, # RIGHT HALF BLOCK
+ 0x00df: 0x2580, # UPPER HALF BLOCK
+ 0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE
+ 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S (GERMAN)
+ 0x00e2: 0x014c, # LATIN CAPITAL LETTER O WITH MACRON
+ 0x00e3: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE
+ 0x00e4: 0x00f5, # LATIN SMALL LETTER O WITH TILDE
+ 0x00e5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE
+ 0x00e6: 0x00b5, # MICRO SIGN
+ 0x00e7: 0x0144, # LATIN SMALL LETTER N WITH ACUTE
+ 0x00e8: 0x0136, # LATIN CAPITAL LETTER K WITH CEDILLA
+ 0x00e9: 0x0137, # LATIN SMALL LETTER K WITH CEDILLA
+ 0x00ea: 0x013b, # LATIN CAPITAL LETTER L WITH CEDILLA
+ 0x00eb: 0x013c, # LATIN SMALL LETTER L WITH CEDILLA
+ 0x00ec: 0x0146, # LATIN SMALL LETTER N WITH CEDILLA
+ 0x00ed: 0x0112, # LATIN CAPITAL LETTER E WITH MACRON
+ 0x00ee: 0x0145, # LATIN CAPITAL LETTER N WITH CEDILLA
+ 0x00ef: 0x2019, # RIGHT SINGLE QUOTATION MARK
+ 0x00f0: 0x00ad, # SOFT HYPHEN
+ 0x00f1: 0x00b1, # PLUS-MINUS SIGN
+ 0x00f2: 0x201c, # LEFT DOUBLE QUOTATION MARK
+ 0x00f3: 0x00be, # VULGAR FRACTION THREE QUARTERS
+ 0x00f4: 0x00b6, # PILCROW SIGN
+ 0x00f5: 0x00a7, # SECTION SIGN
+ 0x00f6: 0x00f7, # DIVISION SIGN
+ 0x00f7: 0x201e, # DOUBLE LOW-9 QUOTATION MARK
+ 0x00f8: 0x00b0, # DEGREE SIGN
+ 0x00f9: 0x2219, # BULLET OPERATOR
+ 0x00fa: 0x00b7, # MIDDLE DOT
+ 0x00fb: 0x00b9, # SUPERSCRIPT ONE
+ 0x00fc: 0x00b3, # SUPERSCRIPT THREE
+ 0x00fd: 0x00b2, # SUPERSCRIPT TWO
+ 0x00fe: 0x25a0, # BLACK SQUARE
+ 0x00ff: 0x00a0, # NO-BREAK SPACE
+})
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x0000 -> NULL
+ u'\x01' # 0x0001 -> START OF HEADING
+ u'\x02' # 0x0002 -> START OF TEXT
+ u'\x03' # 0x0003 -> END OF TEXT
+ u'\x04' # 0x0004 -> END OF TRANSMISSION
+ u'\x05' # 0x0005 -> ENQUIRY
+ u'\x06' # 0x0006 -> ACKNOWLEDGE
+ u'\x07' # 0x0007 -> BELL
+ u'\x08' # 0x0008 -> BACKSPACE
+ u'\t' # 0x0009 -> HORIZONTAL TABULATION
+ u'\n' # 0x000a -> LINE FEED
+ u'\x0b' # 0x000b -> VERTICAL TABULATION
+ u'\x0c' # 0x000c -> FORM FEED
+ u'\r' # 0x000d -> CARRIAGE RETURN
+ u'\x0e' # 0x000e -> SHIFT OUT
+ u'\x0f' # 0x000f -> SHIFT IN
+ u'\x10' # 0x0010 -> DATA LINK ESCAPE
+ u'\x11' # 0x0011 -> DEVICE CONTROL ONE
+ u'\x12' # 0x0012 -> DEVICE CONTROL TWO
+ u'\x13' # 0x0013 -> DEVICE CONTROL THREE
+ u'\x14' # 0x0014 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x0016 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x0018 -> CANCEL
+ u'\x19' # 0x0019 -> END OF MEDIUM
+ u'\x1a' # 0x001a -> SUBSTITUTE
+ u'\x1b' # 0x001b -> ESCAPE
+ u'\x1c' # 0x001c -> FILE SEPARATOR
+ u'\x1d' # 0x001d -> GROUP SEPARATOR
+ u'\x1e' # 0x001e -> RECORD SEPARATOR
+ u'\x1f' # 0x001f -> UNIT SEPARATOR
+ u' ' # 0x0020 -> SPACE
+ u'!' # 0x0021 -> EXCLAMATION MARK
+ u'"' # 0x0022 -> QUOTATION MARK
+ u'#' # 0x0023 -> NUMBER SIGN
+ u'$' # 0x0024 -> DOLLAR SIGN
+ u'%' # 0x0025 -> PERCENT SIGN
+ u'&' # 0x0026 -> AMPERSAND
+ u"'" # 0x0027 -> APOSTROPHE
+ u'(' # 0x0028 -> LEFT PARENTHESIS
+ u')' # 0x0029 -> RIGHT PARENTHESIS
+ u'*' # 0x002a -> ASTERISK
+ u'+' # 0x002b -> PLUS SIGN
+ u',' # 0x002c -> COMMA
+ u'-' # 0x002d -> HYPHEN-MINUS
+ u'.' # 0x002e -> FULL STOP
+ u'/' # 0x002f -> SOLIDUS
+ u'0' # 0x0030 -> DIGIT ZERO
+ u'1' # 0x0031 -> DIGIT ONE
+ u'2' # 0x0032 -> DIGIT TWO
+ u'3' # 0x0033 -> DIGIT THREE
+ u'4' # 0x0034 -> DIGIT FOUR
+ u'5' # 0x0035 -> DIGIT FIVE
+ u'6' # 0x0036 -> DIGIT SIX
+ u'7' # 0x0037 -> DIGIT SEVEN
+ u'8' # 0x0038 -> DIGIT EIGHT
+ u'9' # 0x0039 -> DIGIT NINE
+ u':' # 0x003a -> COLON
+ u';' # 0x003b -> SEMICOLON
+ u'<' # 0x003c -> LESS-THAN SIGN
+ u'=' # 0x003d -> EQUALS SIGN
+ u'>' # 0x003e -> GREATER-THAN SIGN
+ u'?' # 0x003f -> QUESTION MARK
+ u'@' # 0x0040 -> COMMERCIAL AT
+ u'A' # 0x0041 -> LATIN CAPITAL LETTER A
+ u'B' # 0x0042 -> LATIN CAPITAL LETTER B
+ u'C' # 0x0043 -> LATIN CAPITAL LETTER C
+ u'D' # 0x0044 -> LATIN CAPITAL LETTER D
+ u'E' # 0x0045 -> LATIN CAPITAL LETTER E
+ u'F' # 0x0046 -> LATIN CAPITAL LETTER F
+ u'G' # 0x0047 -> LATIN CAPITAL LETTER G
+ u'H' # 0x0048 -> LATIN CAPITAL LETTER H
+ u'I' # 0x0049 -> LATIN CAPITAL LETTER I
+ u'J' # 0x004a -> LATIN CAPITAL LETTER J
+ u'K' # 0x004b -> LATIN CAPITAL LETTER K
+ u'L' # 0x004c -> LATIN CAPITAL LETTER L
+ u'M' # 0x004d -> LATIN CAPITAL LETTER M
+ u'N' # 0x004e -> LATIN CAPITAL LETTER N
+ u'O' # 0x004f -> LATIN CAPITAL LETTER O
+ u'P' # 0x0050 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x0052 -> LATIN CAPITAL LETTER R
+ u'S' # 0x0053 -> LATIN CAPITAL LETTER S
+ u'T' # 0x0054 -> LATIN CAPITAL LETTER T
+ u'U' # 0x0055 -> LATIN CAPITAL LETTER U
+ u'V' # 0x0056 -> LATIN CAPITAL LETTER V
+ u'W' # 0x0057 -> LATIN CAPITAL LETTER W
+ u'X' # 0x0058 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x005a -> LATIN CAPITAL LETTER Z
+ u'[' # 0x005b -> LEFT SQUARE BRACKET
+ u'\\' # 0x005c -> REVERSE SOLIDUS
+ u']' # 0x005d -> RIGHT SQUARE BRACKET
+ u'^' # 0x005e -> CIRCUMFLEX ACCENT
+ u'_' # 0x005f -> LOW LINE
+ u'`' # 0x0060 -> GRAVE ACCENT
+ u'a' # 0x0061 -> LATIN SMALL LETTER A
+ u'b' # 0x0062 -> LATIN SMALL LETTER B
+ u'c' # 0x0063 -> LATIN SMALL LETTER C
+ u'd' # 0x0064 -> LATIN SMALL LETTER D
+ u'e' # 0x0065 -> LATIN SMALL LETTER E
+ u'f' # 0x0066 -> LATIN SMALL LETTER F
+ u'g' # 0x0067 -> LATIN SMALL LETTER G
+ u'h' # 0x0068 -> LATIN SMALL LETTER H
+ u'i' # 0x0069 -> LATIN SMALL LETTER I
+ u'j' # 0x006a -> LATIN SMALL LETTER J
+ u'k' # 0x006b -> LATIN SMALL LETTER K
+ u'l' # 0x006c -> LATIN SMALL LETTER L
+ u'm' # 0x006d -> LATIN SMALL LETTER M
+ u'n' # 0x006e -> LATIN SMALL LETTER N
+ u'o' # 0x006f -> LATIN SMALL LETTER O
+ u'p' # 0x0070 -> LATIN SMALL LETTER P
+ u'q' # 0x0071 -> LATIN SMALL LETTER Q
+ u'r' # 0x0072 -> LATIN SMALL LETTER R
+ u's' # 0x0073 -> LATIN SMALL LETTER S
+ u't' # 0x0074 -> LATIN SMALL LETTER T
+ u'u' # 0x0075 -> LATIN SMALL LETTER U
+ u'v' # 0x0076 -> LATIN SMALL LETTER V
+ u'w' # 0x0077 -> LATIN SMALL LETTER W
+ u'x' # 0x0078 -> LATIN SMALL LETTER X
+ u'y' # 0x0079 -> LATIN SMALL LETTER Y
+ u'z' # 0x007a -> LATIN SMALL LETTER Z
+ u'{' # 0x007b -> LEFT CURLY BRACKET
+ u'|' # 0x007c -> VERTICAL LINE
+ u'}' # 0x007d -> RIGHT CURLY BRACKET
+ u'~' # 0x007e -> TILDE
+ u'\x7f' # 0x007f -> DELETE
+ u'\u0106' # 0x0080 -> LATIN CAPITAL LETTER C WITH ACUTE
+ u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\u0101' # 0x0083 -> LATIN SMALL LETTER A WITH MACRON
+ u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\u0123' # 0x0085 -> LATIN SMALL LETTER G WITH CEDILLA
+ u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\u0107' # 0x0087 -> LATIN SMALL LETTER C WITH ACUTE
+ u'\u0142' # 0x0088 -> LATIN SMALL LETTER L WITH STROKE
+ u'\u0113' # 0x0089 -> LATIN SMALL LETTER E WITH MACRON
+ u'\u0156' # 0x008a -> LATIN CAPITAL LETTER R WITH CEDILLA
+ u'\u0157' # 0x008b -> LATIN SMALL LETTER R WITH CEDILLA
+ u'\u012b' # 0x008c -> LATIN SMALL LETTER I WITH MACRON
+ u'\u0179' # 0x008d -> LATIN CAPITAL LETTER Z WITH ACUTE
+ u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE
+ u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE
+ u'\u014d' # 0x0093 -> LATIN SMALL LETTER O WITH MACRON
+ u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\u0122' # 0x0095 -> LATIN CAPITAL LETTER G WITH CEDILLA
+ u'\xa2' # 0x0096 -> CENT SIGN
+ u'\u015a' # 0x0097 -> LATIN CAPITAL LETTER S WITH ACUTE
+ u'\u015b' # 0x0098 -> LATIN SMALL LETTER S WITH ACUTE
+ u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE
+ u'\xa3' # 0x009c -> POUND SIGN
+ u'\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\xd7' # 0x009e -> MULTIPLICATION SIGN
+ u'\xa4' # 0x009f -> CURRENCY SIGN
+ u'\u0100' # 0x00a0 -> LATIN CAPITAL LETTER A WITH MACRON
+ u'\u012a' # 0x00a1 -> LATIN CAPITAL LETTER I WITH MACRON
+ u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\u017b' # 0x00a3 -> LATIN CAPITAL LETTER Z WITH DOT ABOVE
+ u'\u017c' # 0x00a4 -> LATIN SMALL LETTER Z WITH DOT ABOVE
+ u'\u017a' # 0x00a5 -> LATIN SMALL LETTER Z WITH ACUTE
+ u'\u201d' # 0x00a6 -> RIGHT DOUBLE QUOTATION MARK
+ u'\xa6' # 0x00a7 -> BROKEN BAR
+ u'\xa9' # 0x00a8 -> COPYRIGHT SIGN
+ u'\xae' # 0x00a9 -> REGISTERED SIGN
+ u'\xac' # 0x00aa -> NOT SIGN
+ u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF
+ u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER
+ u'\u0141' # 0x00ad -> LATIN CAPITAL LETTER L WITH STROKE
+ u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2591' # 0x00b0 -> LIGHT SHADE
+ u'\u2592' # 0x00b1 -> MEDIUM SHADE
+ u'\u2593' # 0x00b2 -> DARK SHADE
+ u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL
+ u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ u'\u0104' # 0x00b5 -> LATIN CAPITAL LETTER A WITH OGONEK
+ u'\u010c' # 0x00b6 -> LATIN CAPITAL LETTER C WITH CARON
+ u'\u0118' # 0x00b7 -> LATIN CAPITAL LETTER E WITH OGONEK
+ u'\u0116' # 0x00b8 -> LATIN CAPITAL LETTER E WITH DOT ABOVE
+ u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL
+ u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT
+ u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT
+ u'\u012e' # 0x00bd -> LATIN CAPITAL LETTER I WITH OGONEK
+ u'\u0160' # 0x00be -> LATIN CAPITAL LETTER S WITH CARON
+ u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT
+ u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT
+ u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL
+ u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ u'\u0172' # 0x00c6 -> LATIN CAPITAL LETTER U WITH OGONEK
+ u'\u016a' # 0x00c7 -> LATIN CAPITAL LETTER U WITH MACRON
+ u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
+ u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL
+ u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ u'\u017d' # 0x00cf -> LATIN CAPITAL LETTER Z WITH CARON
+ u'\u0105' # 0x00d0 -> LATIN SMALL LETTER A WITH OGONEK
+ u'\u010d' # 0x00d1 -> LATIN SMALL LETTER C WITH CARON
+ u'\u0119' # 0x00d2 -> LATIN SMALL LETTER E WITH OGONEK
+ u'\u0117' # 0x00d3 -> LATIN SMALL LETTER E WITH DOT ABOVE
+ u'\u012f' # 0x00d4 -> LATIN SMALL LETTER I WITH OGONEK
+ u'\u0161' # 0x00d5 -> LATIN SMALL LETTER S WITH CARON
+ u'\u0173' # 0x00d6 -> LATIN SMALL LETTER U WITH OGONEK
+ u'\u016b' # 0x00d7 -> LATIN SMALL LETTER U WITH MACRON
+ u'\u017e' # 0x00d8 -> LATIN SMALL LETTER Z WITH CARON
+ u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT
+ u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT
+ u'\u2588' # 0x00db -> FULL BLOCK
+ u'\u2584' # 0x00dc -> LOWER HALF BLOCK
+ u'\u258c' # 0x00dd -> LEFT HALF BLOCK
+ u'\u2590' # 0x00de -> RIGHT HALF BLOCK
+ u'\u2580' # 0x00df -> UPPER HALF BLOCK
+ u'\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S (GERMAN)
+ u'\u014c' # 0x00e2 -> LATIN CAPITAL LETTER O WITH MACRON
+ u'\u0143' # 0x00e3 -> LATIN CAPITAL LETTER N WITH ACUTE
+ u'\xf5' # 0x00e4 -> LATIN SMALL LETTER O WITH TILDE
+ u'\xd5' # 0x00e5 -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\xb5' # 0x00e6 -> MICRO SIGN
+ u'\u0144' # 0x00e7 -> LATIN SMALL LETTER N WITH ACUTE
+ u'\u0136' # 0x00e8 -> LATIN CAPITAL LETTER K WITH CEDILLA
+ u'\u0137' # 0x00e9 -> LATIN SMALL LETTER K WITH CEDILLA
+ u'\u013b' # 0x00ea -> LATIN CAPITAL LETTER L WITH CEDILLA
+ u'\u013c' # 0x00eb -> LATIN SMALL LETTER L WITH CEDILLA
+ u'\u0146' # 0x00ec -> LATIN SMALL LETTER N WITH CEDILLA
+ u'\u0112' # 0x00ed -> LATIN CAPITAL LETTER E WITH MACRON
+ u'\u0145' # 0x00ee -> LATIN CAPITAL LETTER N WITH CEDILLA
+ u'\u2019' # 0x00ef -> RIGHT SINGLE QUOTATION MARK
+ u'\xad' # 0x00f0 -> SOFT HYPHEN
+ u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN
+ u'\u201c' # 0x00f2 -> LEFT DOUBLE QUOTATION MARK
+ u'\xbe' # 0x00f3 -> VULGAR FRACTION THREE QUARTERS
+ u'\xb6' # 0x00f4 -> PILCROW SIGN
+ u'\xa7' # 0x00f5 -> SECTION SIGN
+ u'\xf7' # 0x00f6 -> DIVISION SIGN
+ u'\u201e' # 0x00f7 -> DOUBLE LOW-9 QUOTATION MARK
+ u'\xb0' # 0x00f8 -> DEGREE SIGN
+ u'\u2219' # 0x00f9 -> BULLET OPERATOR
+ u'\xb7' # 0x00fa -> MIDDLE DOT
+ u'\xb9' # 0x00fb -> SUPERSCRIPT ONE
+ u'\xb3' # 0x00fc -> SUPERSCRIPT THREE
+ u'\xb2' # 0x00fd -> SUPERSCRIPT TWO
+ u'\u25a0' # 0x00fe -> BLACK SQUARE
+ u'\xa0' # 0x00ff -> NO-BREAK SPACE
+)
+
+### Encoding Map
+
+encoding_map = {
+ 0x0000: 0x0000, # NULL
+ 0x0001: 0x0001, # START OF HEADING
+ 0x0002: 0x0002, # START OF TEXT
+ 0x0003: 0x0003, # END OF TEXT
+ 0x0004: 0x0004, # END OF TRANSMISSION
+ 0x0005: 0x0005, # ENQUIRY
+ 0x0006: 0x0006, # ACKNOWLEDGE
+ 0x0007: 0x0007, # BELL
+ 0x0008: 0x0008, # BACKSPACE
+ 0x0009: 0x0009, # HORIZONTAL TABULATION
+ 0x000a: 0x000a, # LINE FEED
+ 0x000b: 0x000b, # VERTICAL TABULATION
+ 0x000c: 0x000c, # FORM FEED
+ 0x000d: 0x000d, # CARRIAGE RETURN
+ 0x000e: 0x000e, # SHIFT OUT
+ 0x000f: 0x000f, # SHIFT IN
+ 0x0010: 0x0010, # DATA LINK ESCAPE
+ 0x0011: 0x0011, # DEVICE CONTROL ONE
+ 0x0012: 0x0012, # DEVICE CONTROL TWO
+ 0x0013: 0x0013, # DEVICE CONTROL THREE
+ 0x0014: 0x0014, # DEVICE CONTROL FOUR
+ 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE
+ 0x0016: 0x0016, # SYNCHRONOUS IDLE
+ 0x0017: 0x0017, # END OF TRANSMISSION BLOCK
+ 0x0018: 0x0018, # CANCEL
+ 0x0019: 0x0019, # END OF MEDIUM
+ 0x001a: 0x001a, # SUBSTITUTE
+ 0x001b: 0x001b, # ESCAPE
+ 0x001c: 0x001c, # FILE SEPARATOR
+ 0x001d: 0x001d, # GROUP SEPARATOR
+ 0x001e: 0x001e, # RECORD SEPARATOR
+ 0x001f: 0x001f, # UNIT SEPARATOR
+ 0x0020: 0x0020, # SPACE
+ 0x0021: 0x0021, # EXCLAMATION MARK
+ 0x0022: 0x0022, # QUOTATION MARK
+ 0x0023: 0x0023, # NUMBER SIGN
+ 0x0024: 0x0024, # DOLLAR SIGN
+ 0x0025: 0x0025, # PERCENT SIGN
+ 0x0026: 0x0026, # AMPERSAND
+ 0x0027: 0x0027, # APOSTROPHE
+ 0x0028: 0x0028, # LEFT PARENTHESIS
+ 0x0029: 0x0029, # RIGHT PARENTHESIS
+ 0x002a: 0x002a, # ASTERISK
+ 0x002b: 0x002b, # PLUS SIGN
+ 0x002c: 0x002c, # COMMA
+ 0x002d: 0x002d, # HYPHEN-MINUS
+ 0x002e: 0x002e, # FULL STOP
+ 0x002f: 0x002f, # SOLIDUS
+ 0x0030: 0x0030, # DIGIT ZERO
+ 0x0031: 0x0031, # DIGIT ONE
+ 0x0032: 0x0032, # DIGIT TWO
+ 0x0033: 0x0033, # DIGIT THREE
+ 0x0034: 0x0034, # DIGIT FOUR
+ 0x0035: 0x0035, # DIGIT FIVE
+ 0x0036: 0x0036, # DIGIT SIX
+ 0x0037: 0x0037, # DIGIT SEVEN
+ 0x0038: 0x0038, # DIGIT EIGHT
+ 0x0039: 0x0039, # DIGIT NINE
+ 0x003a: 0x003a, # COLON
+ 0x003b: 0x003b, # SEMICOLON
+ 0x003c: 0x003c, # LESS-THAN SIGN
+ 0x003d: 0x003d, # EQUALS SIGN
+ 0x003e: 0x003e, # GREATER-THAN SIGN
+ 0x003f: 0x003f, # QUESTION MARK
+ 0x0040: 0x0040, # COMMERCIAL AT
+ 0x0041: 0x0041, # LATIN CAPITAL LETTER A
+ 0x0042: 0x0042, # LATIN CAPITAL LETTER B
+ 0x0043: 0x0043, # LATIN CAPITAL LETTER C
+ 0x0044: 0x0044, # LATIN CAPITAL LETTER D
+ 0x0045: 0x0045, # LATIN CAPITAL LETTER E
+ 0x0046: 0x0046, # LATIN CAPITAL LETTER F
+ 0x0047: 0x0047, # LATIN CAPITAL LETTER G
+ 0x0048: 0x0048, # LATIN CAPITAL LETTER H
+ 0x0049: 0x0049, # LATIN CAPITAL LETTER I
+ 0x004a: 0x004a, # LATIN CAPITAL LETTER J
+ 0x004b: 0x004b, # LATIN CAPITAL LETTER K
+ 0x004c: 0x004c, # LATIN CAPITAL LETTER L
+ 0x004d: 0x004d, # LATIN CAPITAL LETTER M
+ 0x004e: 0x004e, # LATIN CAPITAL LETTER N
+ 0x004f: 0x004f, # LATIN CAPITAL LETTER O
+ 0x0050: 0x0050, # LATIN CAPITAL LETTER P
+ 0x0051: 0x0051, # LATIN CAPITAL LETTER Q
+ 0x0052: 0x0052, # LATIN CAPITAL LETTER R
+ 0x0053: 0x0053, # LATIN CAPITAL LETTER S
+ 0x0054: 0x0054, # LATIN CAPITAL LETTER T
+ 0x0055: 0x0055, # LATIN CAPITAL LETTER U
+ 0x0056: 0x0056, # LATIN CAPITAL LETTER V
+ 0x0057: 0x0057, # LATIN CAPITAL LETTER W
+ 0x0058: 0x0058, # LATIN CAPITAL LETTER X
+ 0x0059: 0x0059, # LATIN CAPITAL LETTER Y
+ 0x005a: 0x005a, # LATIN CAPITAL LETTER Z
+ 0x005b: 0x005b, # LEFT SQUARE BRACKET
+ 0x005c: 0x005c, # REVERSE SOLIDUS
+ 0x005d: 0x005d, # RIGHT SQUARE BRACKET
+ 0x005e: 0x005e, # CIRCUMFLEX ACCENT
+ 0x005f: 0x005f, # LOW LINE
+ 0x0060: 0x0060, # GRAVE ACCENT
+ 0x0061: 0x0061, # LATIN SMALL LETTER A
+ 0x0062: 0x0062, # LATIN SMALL LETTER B
+ 0x0063: 0x0063, # LATIN SMALL LETTER C
+ 0x0064: 0x0064, # LATIN SMALL LETTER D
+ 0x0065: 0x0065, # LATIN SMALL LETTER E
+ 0x0066: 0x0066, # LATIN SMALL LETTER F
+ 0x0067: 0x0067, # LATIN SMALL LETTER G
+ 0x0068: 0x0068, # LATIN SMALL LETTER H
+ 0x0069: 0x0069, # LATIN SMALL LETTER I
+ 0x006a: 0x006a, # LATIN SMALL LETTER J
+ 0x006b: 0x006b, # LATIN SMALL LETTER K
+ 0x006c: 0x006c, # LATIN SMALL LETTER L
+ 0x006d: 0x006d, # LATIN SMALL LETTER M
+ 0x006e: 0x006e, # LATIN SMALL LETTER N
+ 0x006f: 0x006f, # LATIN SMALL LETTER O
+ 0x0070: 0x0070, # LATIN SMALL LETTER P
+ 0x0071: 0x0071, # LATIN SMALL LETTER Q
+ 0x0072: 0x0072, # LATIN SMALL LETTER R
+ 0x0073: 0x0073, # LATIN SMALL LETTER S
+ 0x0074: 0x0074, # LATIN SMALL LETTER T
+ 0x0075: 0x0075, # LATIN SMALL LETTER U
+ 0x0076: 0x0076, # LATIN SMALL LETTER V
+ 0x0077: 0x0077, # LATIN SMALL LETTER W
+ 0x0078: 0x0078, # LATIN SMALL LETTER X
+ 0x0079: 0x0079, # LATIN SMALL LETTER Y
+ 0x007a: 0x007a, # LATIN SMALL LETTER Z
+ 0x007b: 0x007b, # LEFT CURLY BRACKET
+ 0x007c: 0x007c, # VERTICAL LINE
+ 0x007d: 0x007d, # RIGHT CURLY BRACKET
+ 0x007e: 0x007e, # TILDE
+ 0x007f: 0x007f, # DELETE
+ 0x00a0: 0x00ff, # NO-BREAK SPACE
+ 0x00a2: 0x0096, # CENT SIGN
+ 0x00a3: 0x009c, # POUND SIGN
+ 0x00a4: 0x009f, # CURRENCY SIGN
+ 0x00a6: 0x00a7, # BROKEN BAR
+ 0x00a7: 0x00f5, # SECTION SIGN
+ 0x00a9: 0x00a8, # COPYRIGHT SIGN
+ 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00ac: 0x00aa, # NOT SIGN
+ 0x00ad: 0x00f0, # SOFT HYPHEN
+ 0x00ae: 0x00a9, # REGISTERED SIGN
+ 0x00b0: 0x00f8, # DEGREE SIGN
+ 0x00b1: 0x00f1, # PLUS-MINUS SIGN
+ 0x00b2: 0x00fd, # SUPERSCRIPT TWO
+ 0x00b3: 0x00fc, # SUPERSCRIPT THREE
+ 0x00b5: 0x00e6, # MICRO SIGN
+ 0x00b6: 0x00f4, # PILCROW SIGN
+ 0x00b7: 0x00fa, # MIDDLE DOT
+ 0x00b9: 0x00fb, # SUPERSCRIPT ONE
+ 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER
+ 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF
+ 0x00be: 0x00f3, # VULGAR FRACTION THREE QUARTERS
+ 0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x00c5: 0x008f, # LATIN CAPITAL LETTER A WITH RING ABOVE
+ 0x00c6: 0x0092, # LATIN CAPITAL LIGATURE AE
+ 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x00d3: 0x00e0, # LATIN CAPITAL LETTER O WITH ACUTE
+ 0x00d5: 0x00e5, # LATIN CAPITAL LETTER O WITH TILDE
+ 0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x00d7: 0x009e, # MULTIPLICATION SIGN
+ 0x00d8: 0x009d, # LATIN CAPITAL LETTER O WITH STROKE
+ 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S (GERMAN)
+ 0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x00e5: 0x0086, # LATIN SMALL LETTER A WITH RING ABOVE
+ 0x00e6: 0x0091, # LATIN SMALL LIGATURE AE
+ 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE
+ 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00f5: 0x00e4, # LATIN SMALL LETTER O WITH TILDE
+ 0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x00f7: 0x00f6, # DIVISION SIGN
+ 0x00f8: 0x009b, # LATIN SMALL LETTER O WITH STROKE
+ 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x0100: 0x00a0, # LATIN CAPITAL LETTER A WITH MACRON
+ 0x0101: 0x0083, # LATIN SMALL LETTER A WITH MACRON
+ 0x0104: 0x00b5, # LATIN CAPITAL LETTER A WITH OGONEK
+ 0x0105: 0x00d0, # LATIN SMALL LETTER A WITH OGONEK
+ 0x0106: 0x0080, # LATIN CAPITAL LETTER C WITH ACUTE
+ 0x0107: 0x0087, # LATIN SMALL LETTER C WITH ACUTE
+ 0x010c: 0x00b6, # LATIN CAPITAL LETTER C WITH CARON
+ 0x010d: 0x00d1, # LATIN SMALL LETTER C WITH CARON
+ 0x0112: 0x00ed, # LATIN CAPITAL LETTER E WITH MACRON
+ 0x0113: 0x0089, # LATIN SMALL LETTER E WITH MACRON
+ 0x0116: 0x00b8, # LATIN CAPITAL LETTER E WITH DOT ABOVE
+ 0x0117: 0x00d3, # LATIN SMALL LETTER E WITH DOT ABOVE
+ 0x0118: 0x00b7, # LATIN CAPITAL LETTER E WITH OGONEK
+ 0x0119: 0x00d2, # LATIN SMALL LETTER E WITH OGONEK
+ 0x0122: 0x0095, # LATIN CAPITAL LETTER G WITH CEDILLA
+ 0x0123: 0x0085, # LATIN SMALL LETTER G WITH CEDILLA
+ 0x012a: 0x00a1, # LATIN CAPITAL LETTER I WITH MACRON
+ 0x012b: 0x008c, # LATIN SMALL LETTER I WITH MACRON
+ 0x012e: 0x00bd, # LATIN CAPITAL LETTER I WITH OGONEK
+ 0x012f: 0x00d4, # LATIN SMALL LETTER I WITH OGONEK
+ 0x0136: 0x00e8, # LATIN CAPITAL LETTER K WITH CEDILLA
+ 0x0137: 0x00e9, # LATIN SMALL LETTER K WITH CEDILLA
+ 0x013b: 0x00ea, # LATIN CAPITAL LETTER L WITH CEDILLA
+ 0x013c: 0x00eb, # LATIN SMALL LETTER L WITH CEDILLA
+ 0x0141: 0x00ad, # LATIN CAPITAL LETTER L WITH STROKE
+ 0x0142: 0x0088, # LATIN SMALL LETTER L WITH STROKE
+ 0x0143: 0x00e3, # LATIN CAPITAL LETTER N WITH ACUTE
+ 0x0144: 0x00e7, # LATIN SMALL LETTER N WITH ACUTE
+ 0x0145: 0x00ee, # LATIN CAPITAL LETTER N WITH CEDILLA
+ 0x0146: 0x00ec, # LATIN SMALL LETTER N WITH CEDILLA
+ 0x014c: 0x00e2, # LATIN CAPITAL LETTER O WITH MACRON
+ 0x014d: 0x0093, # LATIN SMALL LETTER O WITH MACRON
+ 0x0156: 0x008a, # LATIN CAPITAL LETTER R WITH CEDILLA
+ 0x0157: 0x008b, # LATIN SMALL LETTER R WITH CEDILLA
+ 0x015a: 0x0097, # LATIN CAPITAL LETTER S WITH ACUTE
+ 0x015b: 0x0098, # LATIN SMALL LETTER S WITH ACUTE
+ 0x0160: 0x00be, # LATIN CAPITAL LETTER S WITH CARON
+ 0x0161: 0x00d5, # LATIN SMALL LETTER S WITH CARON
+ 0x016a: 0x00c7, # LATIN CAPITAL LETTER U WITH MACRON
+ 0x016b: 0x00d7, # LATIN SMALL LETTER U WITH MACRON
+ 0x0172: 0x00c6, # LATIN CAPITAL LETTER U WITH OGONEK
+ 0x0173: 0x00d6, # LATIN SMALL LETTER U WITH OGONEK
+ 0x0179: 0x008d, # LATIN CAPITAL LETTER Z WITH ACUTE
+ 0x017a: 0x00a5, # LATIN SMALL LETTER Z WITH ACUTE
+ 0x017b: 0x00a3, # LATIN CAPITAL LETTER Z WITH DOT ABOVE
+ 0x017c: 0x00a4, # LATIN SMALL LETTER Z WITH DOT ABOVE
+ 0x017d: 0x00cf, # LATIN CAPITAL LETTER Z WITH CARON
+ 0x017e: 0x00d8, # LATIN SMALL LETTER Z WITH CARON
+ 0x2019: 0x00ef, # RIGHT SINGLE QUOTATION MARK
+ 0x201c: 0x00f2, # LEFT DOUBLE QUOTATION MARK
+ 0x201d: 0x00a6, # RIGHT DOUBLE QUOTATION MARK
+ 0x201e: 0x00f7, # DOUBLE LOW-9 QUOTATION MARK
+ 0x2219: 0x00f9, # BULLET OPERATOR
+ 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL
+ 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x2580: 0x00df, # UPPER HALF BLOCK
+ 0x2584: 0x00dc, # LOWER HALF BLOCK
+ 0x2588: 0x00db, # FULL BLOCK
+ 0x258c: 0x00dd, # LEFT HALF BLOCK
+ 0x2590: 0x00de, # RIGHT HALF BLOCK
+ 0x2591: 0x00b0, # LIGHT SHADE
+ 0x2592: 0x00b1, # MEDIUM SHADE
+ 0x2593: 0x00b2, # DARK SHADE
+ 0x25a0: 0x00fe, # BLACK SQUARE
+}
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
index 0000000000..b110f4ece7
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp850.py
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP850.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp850',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE
+ 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE
+ 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE
+ 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX
+ 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS
+ 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE
+ 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS
+ 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX
+ 0x008d: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE
+ 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE
+ 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE
+ 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE
+ 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE
+ 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX
+ 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE
+ 0x0098: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS
+ 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE
+ 0x009c: 0x00a3, # POUND SIGN
+ 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE
+ 0x009e: 0x00d7, # MULTIPLICATION SIGN
+ 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK
+ 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE
+ 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE
+ 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR
+ 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR
+ 0x00a8: 0x00bf, # INVERTED QUESTION MARK
+ 0x00a9: 0x00ae, # REGISTERED SIGN
+ 0x00aa: 0x00ac, # NOT SIGN
+ 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF
+ 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER
+ 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK
+ 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00b0: 0x2591, # LIGHT SHADE
+ 0x00b1: 0x2592, # MEDIUM SHADE
+ 0x00b2: 0x2593, # DARK SHADE
+ 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL
+ 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x00b5: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE
+ 0x00b6: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ 0x00b7: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE
+ 0x00b8: 0x00a9, # COPYRIGHT SIGN
+ 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x00bd: 0x00a2, # CENT SIGN
+ 0x00be: 0x00a5, # YEN SIGN
+ 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x00c6: 0x00e3, # LATIN SMALL LETTER A WITH TILDE
+ 0x00c7: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE
+ 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x00cf: 0x00a4, # CURRENCY SIGN
+ 0x00d0: 0x00f0, # LATIN SMALL LETTER ETH
+ 0x00d1: 0x00d0, # LATIN CAPITAL LETTER ETH
+ 0x00d2: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ 0x00d3: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS
+ 0x00d4: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE
+ 0x00d5: 0x0131, # LATIN SMALL LETTER DOTLESS I
+ 0x00d6: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE
+ 0x00d7: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ 0x00d8: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS
+ 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x00db: 0x2588, # FULL BLOCK
+ 0x00dc: 0x2584, # LOWER HALF BLOCK
+ 0x00dd: 0x00a6, # BROKEN BAR
+ 0x00de: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE
+ 0x00df: 0x2580, # UPPER HALF BLOCK
+ 0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE
+ 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S
+ 0x00e2: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ 0x00e3: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE
+ 0x00e4: 0x00f5, # LATIN SMALL LETTER O WITH TILDE
+ 0x00e5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE
+ 0x00e6: 0x00b5, # MICRO SIGN
+ 0x00e7: 0x00fe, # LATIN SMALL LETTER THORN
+ 0x00e8: 0x00de, # LATIN CAPITAL LETTER THORN
+ 0x00e9: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE
+ 0x00ea: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ 0x00eb: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE
+ 0x00ec: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE
+ 0x00ed: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE
+ 0x00ee: 0x00af, # MACRON
+ 0x00ef: 0x00b4, # ACUTE ACCENT
+ 0x00f0: 0x00ad, # SOFT HYPHEN
+ 0x00f1: 0x00b1, # PLUS-MINUS SIGN
+ 0x00f2: 0x2017, # DOUBLE LOW LINE
+ 0x00f3: 0x00be, # VULGAR FRACTION THREE QUARTERS
+ 0x00f4: 0x00b6, # PILCROW SIGN
+ 0x00f5: 0x00a7, # SECTION SIGN
+ 0x00f6: 0x00f7, # DIVISION SIGN
+ 0x00f7: 0x00b8, # CEDILLA
+ 0x00f8: 0x00b0, # DEGREE SIGN
+ 0x00f9: 0x00a8, # DIAERESIS
+ 0x00fa: 0x00b7, # MIDDLE DOT
+ 0x00fb: 0x00b9, # SUPERSCRIPT ONE
+ 0x00fc: 0x00b3, # SUPERSCRIPT THREE
+ 0x00fd: 0x00b2, # SUPERSCRIPT TWO
+ 0x00fe: 0x25a0, # BLACK SQUARE
+ 0x00ff: 0x00a0, # NO-BREAK SPACE
+})
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x0000 -> NULL
+ u'\x01' # 0x0001 -> START OF HEADING
+ u'\x02' # 0x0002 -> START OF TEXT
+ u'\x03' # 0x0003 -> END OF TEXT
+ u'\x04' # 0x0004 -> END OF TRANSMISSION
+ u'\x05' # 0x0005 -> ENQUIRY
+ u'\x06' # 0x0006 -> ACKNOWLEDGE
+ u'\x07' # 0x0007 -> BELL
+ u'\x08' # 0x0008 -> BACKSPACE
+ u'\t' # 0x0009 -> HORIZONTAL TABULATION
+ u'\n' # 0x000a -> LINE FEED
+ u'\x0b' # 0x000b -> VERTICAL TABULATION
+ u'\x0c' # 0x000c -> FORM FEED
+ u'\r' # 0x000d -> CARRIAGE RETURN
+ u'\x0e' # 0x000e -> SHIFT OUT
+ u'\x0f' # 0x000f -> SHIFT IN
+ u'\x10' # 0x0010 -> DATA LINK ESCAPE
+ u'\x11' # 0x0011 -> DEVICE CONTROL ONE
+ u'\x12' # 0x0012 -> DEVICE CONTROL TWO
+ u'\x13' # 0x0013 -> DEVICE CONTROL THREE
+ u'\x14' # 0x0014 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x0016 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x0018 -> CANCEL
+ u'\x19' # 0x0019 -> END OF MEDIUM
+ u'\x1a' # 0x001a -> SUBSTITUTE
+ u'\x1b' # 0x001b -> ESCAPE
+ u'\x1c' # 0x001c -> FILE SEPARATOR
+ u'\x1d' # 0x001d -> GROUP SEPARATOR
+ u'\x1e' # 0x001e -> RECORD SEPARATOR
+ u'\x1f' # 0x001f -> UNIT SEPARATOR
+ u' ' # 0x0020 -> SPACE
+ u'!' # 0x0021 -> EXCLAMATION MARK
+ u'"' # 0x0022 -> QUOTATION MARK
+ u'#' # 0x0023 -> NUMBER SIGN
+ u'$' # 0x0024 -> DOLLAR SIGN
+ u'%' # 0x0025 -> PERCENT SIGN
+ u'&' # 0x0026 -> AMPERSAND
+ u"'" # 0x0027 -> APOSTROPHE
+ u'(' # 0x0028 -> LEFT PARENTHESIS
+ u')' # 0x0029 -> RIGHT PARENTHESIS
+ u'*' # 0x002a -> ASTERISK
+ u'+' # 0x002b -> PLUS SIGN
+ u',' # 0x002c -> COMMA
+ u'-' # 0x002d -> HYPHEN-MINUS
+ u'.' # 0x002e -> FULL STOP
+ u'/' # 0x002f -> SOLIDUS
+ u'0' # 0x0030 -> DIGIT ZERO
+ u'1' # 0x0031 -> DIGIT ONE
+ u'2' # 0x0032 -> DIGIT TWO
+ u'3' # 0x0033 -> DIGIT THREE
+ u'4' # 0x0034 -> DIGIT FOUR
+ u'5' # 0x0035 -> DIGIT FIVE
+ u'6' # 0x0036 -> DIGIT SIX
+ u'7' # 0x0037 -> DIGIT SEVEN
+ u'8' # 0x0038 -> DIGIT EIGHT
+ u'9' # 0x0039 -> DIGIT NINE
+ u':' # 0x003a -> COLON
+ u';' # 0x003b -> SEMICOLON
+ u'<' # 0x003c -> LESS-THAN SIGN
+ u'=' # 0x003d -> EQUALS SIGN
+ u'>' # 0x003e -> GREATER-THAN SIGN
+ u'?' # 0x003f -> QUESTION MARK
+ u'@' # 0x0040 -> COMMERCIAL AT
+ u'A' # 0x0041 -> LATIN CAPITAL LETTER A
+ u'B' # 0x0042 -> LATIN CAPITAL LETTER B
+ u'C' # 0x0043 -> LATIN CAPITAL LETTER C
+ u'D' # 0x0044 -> LATIN CAPITAL LETTER D
+ u'E' # 0x0045 -> LATIN CAPITAL LETTER E
+ u'F' # 0x0046 -> LATIN CAPITAL LETTER F
+ u'G' # 0x0047 -> LATIN CAPITAL LETTER G
+ u'H' # 0x0048 -> LATIN CAPITAL LETTER H
+ u'I' # 0x0049 -> LATIN CAPITAL LETTER I
+ u'J' # 0x004a -> LATIN CAPITAL LETTER J
+ u'K' # 0x004b -> LATIN CAPITAL LETTER K
+ u'L' # 0x004c -> LATIN CAPITAL LETTER L
+ u'M' # 0x004d -> LATIN CAPITAL LETTER M
+ u'N' # 0x004e -> LATIN CAPITAL LETTER N
+ u'O' # 0x004f -> LATIN CAPITAL LETTER O
+ u'P' # 0x0050 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x0052 -> LATIN CAPITAL LETTER R
+ u'S' # 0x0053 -> LATIN CAPITAL LETTER S
+ u'T' # 0x0054 -> LATIN CAPITAL LETTER T
+ u'U' # 0x0055 -> LATIN CAPITAL LETTER U
+ u'V' # 0x0056 -> LATIN CAPITAL LETTER V
+ u'W' # 0x0057 -> LATIN CAPITAL LETTER W
+ u'X' # 0x0058 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x005a -> LATIN CAPITAL LETTER Z
+ u'[' # 0x005b -> LEFT SQUARE BRACKET
+ u'\\' # 0x005c -> REVERSE SOLIDUS
+ u']' # 0x005d -> RIGHT SQUARE BRACKET
+ u'^' # 0x005e -> CIRCUMFLEX ACCENT
+ u'_' # 0x005f -> LOW LINE
+ u'`' # 0x0060 -> GRAVE ACCENT
+ u'a' # 0x0061 -> LATIN SMALL LETTER A
+ u'b' # 0x0062 -> LATIN SMALL LETTER B
+ u'c' # 0x0063 -> LATIN SMALL LETTER C
+ u'd' # 0x0064 -> LATIN SMALL LETTER D
+ u'e' # 0x0065 -> LATIN SMALL LETTER E
+ u'f' # 0x0066 -> LATIN SMALL LETTER F
+ u'g' # 0x0067 -> LATIN SMALL LETTER G
+ u'h' # 0x0068 -> LATIN SMALL LETTER H
+ u'i' # 0x0069 -> LATIN SMALL LETTER I
+ u'j' # 0x006a -> LATIN SMALL LETTER J
+ u'k' # 0x006b -> LATIN SMALL LETTER K
+ u'l' # 0x006c -> LATIN SMALL LETTER L
+ u'm' # 0x006d -> LATIN SMALL LETTER M
+ u'n' # 0x006e -> LATIN SMALL LETTER N
+ u'o' # 0x006f -> LATIN SMALL LETTER O
+ u'p' # 0x0070 -> LATIN SMALL LETTER P
+ u'q' # 0x0071 -> LATIN SMALL LETTER Q
+ u'r' # 0x0072 -> LATIN SMALL LETTER R
+ u's' # 0x0073 -> LATIN SMALL LETTER S
+ u't' # 0x0074 -> LATIN SMALL LETTER T
+ u'u' # 0x0075 -> LATIN SMALL LETTER U
+ u'v' # 0x0076 -> LATIN SMALL LETTER V
+ u'w' # 0x0077 -> LATIN SMALL LETTER W
+ u'x' # 0x0078 -> LATIN SMALL LETTER X
+ u'y' # 0x0079 -> LATIN SMALL LETTER Y
+ u'z' # 0x007a -> LATIN SMALL LETTER Z
+ u'{' # 0x007b -> LEFT CURLY BRACKET
+ u'|' # 0x007c -> VERTICAL LINE
+ u'}' # 0x007d -> RIGHT CURLY BRACKET
+ u'~' # 0x007e -> TILDE
+ u'\x7f' # 0x007f -> DELETE
+ u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xec' # 0x008d -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE
+ u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE
+ u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xff' # 0x0098 -> LATIN SMALL LETTER Y WITH DIAERESIS
+ u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE
+ u'\xa3' # 0x009c -> POUND SIGN
+ u'\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\xd7' # 0x009e -> MULTIPLICATION SIGN
+ u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK
+ u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR
+ u'\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR
+ u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK
+ u'\xae' # 0x00a9 -> REGISTERED SIGN
+ u'\xac' # 0x00aa -> NOT SIGN
+ u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF
+ u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER
+ u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK
+ u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2591' # 0x00b0 -> LIGHT SHADE
+ u'\u2592' # 0x00b1 -> MEDIUM SHADE
+ u'\u2593' # 0x00b2 -> DARK SHADE
+ u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL
+ u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ u'\xc1' # 0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc2' # 0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xc0' # 0x00b7 -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xa9' # 0x00b8 -> COPYRIGHT SIGN
+ u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL
+ u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT
+ u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT
+ u'\xa2' # 0x00bd -> CENT SIGN
+ u'\xa5' # 0x00be -> YEN SIGN
+ u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT
+ u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT
+ u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL
+ u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ u'\xe3' # 0x00c6 -> LATIN SMALL LETTER A WITH TILDE
+ u'\xc3' # 0x00c7 -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
+ u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL
+ u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ u'\xa4' # 0x00cf -> CURRENCY SIGN
+ u'\xf0' # 0x00d0 -> LATIN SMALL LETTER ETH
+ u'\xd0' # 0x00d1 -> LATIN CAPITAL LETTER ETH
+ u'\xca' # 0x00d2 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xcb' # 0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xc8' # 0x00d4 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\u0131' # 0x00d5 -> LATIN SMALL LETTER DOTLESS I
+ u'\xcd' # 0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0x00d8 -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT
+ u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT
+ u'\u2588' # 0x00db -> FULL BLOCK
+ u'\u2584' # 0x00dc -> LOWER HALF BLOCK
+ u'\xa6' # 0x00dd -> BROKEN BAR
+ u'\xcc' # 0x00de -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'\u2580' # 0x00df -> UPPER HALF BLOCK
+ u'\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S
+ u'\xd4' # 0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\xd2' # 0x00e3 -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xf5' # 0x00e4 -> LATIN SMALL LETTER O WITH TILDE
+ u'\xd5' # 0x00e5 -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\xb5' # 0x00e6 -> MICRO SIGN
+ u'\xfe' # 0x00e7 -> LATIN SMALL LETTER THORN
+ u'\xde' # 0x00e8 -> LATIN CAPITAL LETTER THORN
+ u'\xda' # 0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xdb' # 0x00ea -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xd9' # 0x00eb -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\xfd' # 0x00ec -> LATIN SMALL LETTER Y WITH ACUTE
+ u'\xdd' # 0x00ed -> LATIN CAPITAL LETTER Y WITH ACUTE
+ u'\xaf' # 0x00ee -> MACRON
+ u'\xb4' # 0x00ef -> ACUTE ACCENT
+ u'\xad' # 0x00f0 -> SOFT HYPHEN
+ u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN
+ u'\u2017' # 0x00f2 -> DOUBLE LOW LINE
+ u'\xbe' # 0x00f3 -> VULGAR FRACTION THREE QUARTERS
+ u'\xb6' # 0x00f4 -> PILCROW SIGN
+ u'\xa7' # 0x00f5 -> SECTION SIGN
+ u'\xf7' # 0x00f6 -> DIVISION SIGN
+ u'\xb8' # 0x00f7 -> CEDILLA
+ u'\xb0' # 0x00f8 -> DEGREE SIGN
+ u'\xa8' # 0x00f9 -> DIAERESIS
+ u'\xb7' # 0x00fa -> MIDDLE DOT
+ u'\xb9' # 0x00fb -> SUPERSCRIPT ONE
+ u'\xb3' # 0x00fc -> SUPERSCRIPT THREE
+ u'\xb2' # 0x00fd -> SUPERSCRIPT TWO
+ u'\u25a0' # 0x00fe -> BLACK SQUARE
+ u'\xa0' # 0x00ff -> NO-BREAK SPACE
+)
+
+### Encoding Map
+
+encoding_map = {
+ 0x0000: 0x0000, # NULL
+ 0x0001: 0x0001, # START OF HEADING
+ 0x0002: 0x0002, # START OF TEXT
+ 0x0003: 0x0003, # END OF TEXT
+ 0x0004: 0x0004, # END OF TRANSMISSION
+ 0x0005: 0x0005, # ENQUIRY
+ 0x0006: 0x0006, # ACKNOWLEDGE
+ 0x0007: 0x0007, # BELL
+ 0x0008: 0x0008, # BACKSPACE
+ 0x0009: 0x0009, # HORIZONTAL TABULATION
+ 0x000a: 0x000a, # LINE FEED
+ 0x000b: 0x000b, # VERTICAL TABULATION
+ 0x000c: 0x000c, # FORM FEED
+ 0x000d: 0x000d, # CARRIAGE RETURN
+ 0x000e: 0x000e, # SHIFT OUT
+ 0x000f: 0x000f, # SHIFT IN
+ 0x0010: 0x0010, # DATA LINK ESCAPE
+ 0x0011: 0x0011, # DEVICE CONTROL ONE
+ 0x0012: 0x0012, # DEVICE CONTROL TWO
+ 0x0013: 0x0013, # DEVICE CONTROL THREE
+ 0x0014: 0x0014, # DEVICE CONTROL FOUR
+ 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE
+ 0x0016: 0x0016, # SYNCHRONOUS IDLE
+ 0x0017: 0x0017, # END OF TRANSMISSION BLOCK
+ 0x0018: 0x0018, # CANCEL
+ 0x0019: 0x0019, # END OF MEDIUM
+ 0x001a: 0x001a, # SUBSTITUTE
+ 0x001b: 0x001b, # ESCAPE
+ 0x001c: 0x001c, # FILE SEPARATOR
+ 0x001d: 0x001d, # GROUP SEPARATOR
+ 0x001e: 0x001e, # RECORD SEPARATOR
+ 0x001f: 0x001f, # UNIT SEPARATOR
+ 0x0020: 0x0020, # SPACE
+ 0x0021: 0x0021, # EXCLAMATION MARK
+ 0x0022: 0x0022, # QUOTATION MARK
+ 0x0023: 0x0023, # NUMBER SIGN
+ 0x0024: 0x0024, # DOLLAR SIGN
+ 0x0025: 0x0025, # PERCENT SIGN
+ 0x0026: 0x0026, # AMPERSAND
+ 0x0027: 0x0027, # APOSTROPHE
+ 0x0028: 0x0028, # LEFT PARENTHESIS
+ 0x0029: 0x0029, # RIGHT PARENTHESIS
+ 0x002a: 0x002a, # ASTERISK
+ 0x002b: 0x002b, # PLUS SIGN
+ 0x002c: 0x002c, # COMMA
+ 0x002d: 0x002d, # HYPHEN-MINUS
+ 0x002e: 0x002e, # FULL STOP
+ 0x002f: 0x002f, # SOLIDUS
+ 0x0030: 0x0030, # DIGIT ZERO
+ 0x0031: 0x0031, # DIGIT ONE
+ 0x0032: 0x0032, # DIGIT TWO
+ 0x0033: 0x0033, # DIGIT THREE
+ 0x0034: 0x0034, # DIGIT FOUR
+ 0x0035: 0x0035, # DIGIT FIVE
+ 0x0036: 0x0036, # DIGIT SIX
+ 0x0037: 0x0037, # DIGIT SEVEN
+ 0x0038: 0x0038, # DIGIT EIGHT
+ 0x0039: 0x0039, # DIGIT NINE
+ 0x003a: 0x003a, # COLON
+ 0x003b: 0x003b, # SEMICOLON
+ 0x003c: 0x003c, # LESS-THAN SIGN
+ 0x003d: 0x003d, # EQUALS SIGN
+ 0x003e: 0x003e, # GREATER-THAN SIGN
+ 0x003f: 0x003f, # QUESTION MARK
+ 0x0040: 0x0040, # COMMERCIAL AT
+ 0x0041: 0x0041, # LATIN CAPITAL LETTER A
+ 0x0042: 0x0042, # LATIN CAPITAL LETTER B
+ 0x0043: 0x0043, # LATIN CAPITAL LETTER C
+ 0x0044: 0x0044, # LATIN CAPITAL LETTER D
+ 0x0045: 0x0045, # LATIN CAPITAL LETTER E
+ 0x0046: 0x0046, # LATIN CAPITAL LETTER F
+ 0x0047: 0x0047, # LATIN CAPITAL LETTER G
+ 0x0048: 0x0048, # LATIN CAPITAL LETTER H
+ 0x0049: 0x0049, # LATIN CAPITAL LETTER I
+ 0x004a: 0x004a, # LATIN CAPITAL LETTER J
+ 0x004b: 0x004b, # LATIN CAPITAL LETTER K
+ 0x004c: 0x004c, # LATIN CAPITAL LETTER L
+ 0x004d: 0x004d, # LATIN CAPITAL LETTER M
+ 0x004e: 0x004e, # LATIN CAPITAL LETTER N
+ 0x004f: 0x004f, # LATIN CAPITAL LETTER O
+ 0x0050: 0x0050, # LATIN CAPITAL LETTER P
+ 0x0051: 0x0051, # LATIN CAPITAL LETTER Q
+ 0x0052: 0x0052, # LATIN CAPITAL LETTER R
+ 0x0053: 0x0053, # LATIN CAPITAL LETTER S
+ 0x0054: 0x0054, # LATIN CAPITAL LETTER T
+ 0x0055: 0x0055, # LATIN CAPITAL LETTER U
+ 0x0056: 0x0056, # LATIN CAPITAL LETTER V
+ 0x0057: 0x0057, # LATIN CAPITAL LETTER W
+ 0x0058: 0x0058, # LATIN CAPITAL LETTER X
+ 0x0059: 0x0059, # LATIN CAPITAL LETTER Y
+ 0x005a: 0x005a, # LATIN CAPITAL LETTER Z
+ 0x005b: 0x005b, # LEFT SQUARE BRACKET
+ 0x005c: 0x005c, # REVERSE SOLIDUS
+ 0x005d: 0x005d, # RIGHT SQUARE BRACKET
+ 0x005e: 0x005e, # CIRCUMFLEX ACCENT
+ 0x005f: 0x005f, # LOW LINE
+ 0x0060: 0x0060, # GRAVE ACCENT
+ 0x0061: 0x0061, # LATIN SMALL LETTER A
+ 0x0062: 0x0062, # LATIN SMALL LETTER B
+ 0x0063: 0x0063, # LATIN SMALL LETTER C
+ 0x0064: 0x0064, # LATIN SMALL LETTER D
+ 0x0065: 0x0065, # LATIN SMALL LETTER E
+ 0x0066: 0x0066, # LATIN SMALL LETTER F
+ 0x0067: 0x0067, # LATIN SMALL LETTER G
+ 0x0068: 0x0068, # LATIN SMALL LETTER H
+ 0x0069: 0x0069, # LATIN SMALL LETTER I
+ 0x006a: 0x006a, # LATIN SMALL LETTER J
+ 0x006b: 0x006b, # LATIN SMALL LETTER K
+ 0x006c: 0x006c, # LATIN SMALL LETTER L
+ 0x006d: 0x006d, # LATIN SMALL LETTER M
+ 0x006e: 0x006e, # LATIN SMALL LETTER N
+ 0x006f: 0x006f, # LATIN SMALL LETTER O
+ 0x0070: 0x0070, # LATIN SMALL LETTER P
+ 0x0071: 0x0071, # LATIN SMALL LETTER Q
+ 0x0072: 0x0072, # LATIN SMALL LETTER R
+ 0x0073: 0x0073, # LATIN SMALL LETTER S
+ 0x0074: 0x0074, # LATIN SMALL LETTER T
+ 0x0075: 0x0075, # LATIN SMALL LETTER U
+ 0x0076: 0x0076, # LATIN SMALL LETTER V
+ 0x0077: 0x0077, # LATIN SMALL LETTER W
+ 0x0078: 0x0078, # LATIN SMALL LETTER X
+ 0x0079: 0x0079, # LATIN SMALL LETTER Y
+ 0x007a: 0x007a, # LATIN SMALL LETTER Z
+ 0x007b: 0x007b, # LEFT CURLY BRACKET
+ 0x007c: 0x007c, # VERTICAL LINE
+ 0x007d: 0x007d, # RIGHT CURLY BRACKET
+ 0x007e: 0x007e, # TILDE
+ 0x007f: 0x007f, # DELETE
+ 0x00a0: 0x00ff, # NO-BREAK SPACE
+ 0x00a1: 0x00ad, # INVERTED EXCLAMATION MARK
+ 0x00a2: 0x00bd, # CENT SIGN
+ 0x00a3: 0x009c, # POUND SIGN
+ 0x00a4: 0x00cf, # CURRENCY SIGN
+ 0x00a5: 0x00be, # YEN SIGN
+ 0x00a6: 0x00dd, # BROKEN BAR
+ 0x00a7: 0x00f5, # SECTION SIGN
+ 0x00a8: 0x00f9, # DIAERESIS
+ 0x00a9: 0x00b8, # COPYRIGHT SIGN
+ 0x00aa: 0x00a6, # FEMININE ORDINAL INDICATOR
+ 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00ac: 0x00aa, # NOT SIGN
+ 0x00ad: 0x00f0, # SOFT HYPHEN
+ 0x00ae: 0x00a9, # REGISTERED SIGN
+ 0x00af: 0x00ee, # MACRON
+ 0x00b0: 0x00f8, # DEGREE SIGN
+ 0x00b1: 0x00f1, # PLUS-MINUS SIGN
+ 0x00b2: 0x00fd, # SUPERSCRIPT TWO
+ 0x00b3: 0x00fc, # SUPERSCRIPT THREE
+ 0x00b4: 0x00ef, # ACUTE ACCENT
+ 0x00b5: 0x00e6, # MICRO SIGN
+ 0x00b6: 0x00f4, # PILCROW SIGN
+ 0x00b7: 0x00fa, # MIDDLE DOT
+ 0x00b8: 0x00f7, # CEDILLA
+ 0x00b9: 0x00fb, # SUPERSCRIPT ONE
+ 0x00ba: 0x00a7, # MASCULINE ORDINAL INDICATOR
+ 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER
+ 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF
+ 0x00be: 0x00f3, # VULGAR FRACTION THREE QUARTERS
+ 0x00bf: 0x00a8, # INVERTED QUESTION MARK
+ 0x00c0: 0x00b7, # LATIN CAPITAL LETTER A WITH GRAVE
+ 0x00c1: 0x00b5, # LATIN CAPITAL LETTER A WITH ACUTE
+ 0x00c2: 0x00b6, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ 0x00c3: 0x00c7, # LATIN CAPITAL LETTER A WITH TILDE
+ 0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x00c5: 0x008f, # LATIN CAPITAL LETTER A WITH RING ABOVE
+ 0x00c6: 0x0092, # LATIN CAPITAL LIGATURE AE
+ 0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x00c8: 0x00d4, # LATIN CAPITAL LETTER E WITH GRAVE
+ 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x00ca: 0x00d2, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ 0x00cb: 0x00d3, # LATIN CAPITAL LETTER E WITH DIAERESIS
+ 0x00cc: 0x00de, # LATIN CAPITAL LETTER I WITH GRAVE
+ 0x00cd: 0x00d6, # LATIN CAPITAL LETTER I WITH ACUTE
+ 0x00ce: 0x00d7, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ 0x00cf: 0x00d8, # LATIN CAPITAL LETTER I WITH DIAERESIS
+ 0x00d0: 0x00d1, # LATIN CAPITAL LETTER ETH
+ 0x00d1: 0x00a5, # LATIN CAPITAL LETTER N WITH TILDE
+ 0x00d2: 0x00e3, # LATIN CAPITAL LETTER O WITH GRAVE
+ 0x00d3: 0x00e0, # LATIN CAPITAL LETTER O WITH ACUTE
+ 0x00d4: 0x00e2, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ 0x00d5: 0x00e5, # LATIN CAPITAL LETTER O WITH TILDE
+ 0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x00d7: 0x009e, # MULTIPLICATION SIGN
+ 0x00d8: 0x009d, # LATIN CAPITAL LETTER O WITH STROKE
+ 0x00d9: 0x00eb, # LATIN CAPITAL LETTER U WITH GRAVE
+ 0x00da: 0x00e9, # LATIN CAPITAL LETTER U WITH ACUTE
+ 0x00db: 0x00ea, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x00dd: 0x00ed, # LATIN CAPITAL LETTER Y WITH ACUTE
+ 0x00de: 0x00e8, # LATIN CAPITAL LETTER THORN
+ 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S
+ 0x00e0: 0x0085, # LATIN SMALL LETTER A WITH GRAVE
+ 0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x00e3: 0x00c6, # LATIN SMALL LETTER A WITH TILDE
+ 0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x00e5: 0x0086, # LATIN SMALL LETTER A WITH RING ABOVE
+ 0x00e6: 0x0091, # LATIN SMALL LIGATURE AE
+ 0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x00e8: 0x008a, # LATIN SMALL LETTER E WITH GRAVE
+ 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE
+ 0x00ea: 0x0088, # LATIN SMALL LETTER E WITH CIRCUMFLEX
+ 0x00eb: 0x0089, # LATIN SMALL LETTER E WITH DIAERESIS
+ 0x00ec: 0x008d, # LATIN SMALL LETTER I WITH GRAVE
+ 0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00ee: 0x008c, # LATIN SMALL LETTER I WITH CIRCUMFLEX
+ 0x00ef: 0x008b, # LATIN SMALL LETTER I WITH DIAERESIS
+ 0x00f0: 0x00d0, # LATIN SMALL LETTER ETH
+ 0x00f1: 0x00a4, # LATIN SMALL LETTER N WITH TILDE
+ 0x00f2: 0x0095, # LATIN SMALL LETTER O WITH GRAVE
+ 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x00f5: 0x00e4, # LATIN SMALL LETTER O WITH TILDE
+ 0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x00f7: 0x00f6, # DIVISION SIGN
+ 0x00f8: 0x009b, # LATIN SMALL LETTER O WITH STROKE
+ 0x00f9: 0x0097, # LATIN SMALL LETTER U WITH GRAVE
+ 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00fb: 0x0096, # LATIN SMALL LETTER U WITH CIRCUMFLEX
+ 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x00fd: 0x00ec, # LATIN SMALL LETTER Y WITH ACUTE
+ 0x00fe: 0x00e7, # LATIN SMALL LETTER THORN
+ 0x00ff: 0x0098, # LATIN SMALL LETTER Y WITH DIAERESIS
+ 0x0131: 0x00d5, # LATIN SMALL LETTER DOTLESS I
+ 0x0192: 0x009f, # LATIN SMALL LETTER F WITH HOOK
+ 0x2017: 0x00f2, # DOUBLE LOW LINE
+ 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL
+ 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x2580: 0x00df, # UPPER HALF BLOCK
+ 0x2584: 0x00dc, # LOWER HALF BLOCK
+ 0x2588: 0x00db, # FULL BLOCK
+ 0x2591: 0x00b0, # LIGHT SHADE
+ 0x2592: 0x00b1, # MEDIUM SHADE
+ 0x2593: 0x00b2, # DARK SHADE
+ 0x25a0: 0x00fe, # BLACK SQUARE
+}
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
index 0000000000..c004282d16
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp852.py
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP852.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp852',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE
+ 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x0085: 0x016f, # LATIN SMALL LETTER U WITH RING ABOVE
+ 0x0086: 0x0107, # LATIN SMALL LETTER C WITH ACUTE
+ 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x0088: 0x0142, # LATIN SMALL LETTER L WITH STROKE
+ 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS
+ 0x008a: 0x0150, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
+ 0x008b: 0x0151, # LATIN SMALL LETTER O WITH DOUBLE ACUTE
+ 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX
+ 0x008d: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE
+ 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x008f: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE
+ 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x0091: 0x0139, # LATIN CAPITAL LETTER L WITH ACUTE
+ 0x0092: 0x013a, # LATIN SMALL LETTER L WITH ACUTE
+ 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x0095: 0x013d, # LATIN CAPITAL LETTER L WITH CARON
+ 0x0096: 0x013e, # LATIN SMALL LETTER L WITH CARON
+ 0x0097: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE
+ 0x0098: 0x015b, # LATIN SMALL LETTER S WITH ACUTE
+ 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x009b: 0x0164, # LATIN CAPITAL LETTER T WITH CARON
+ 0x009c: 0x0165, # LATIN SMALL LETTER T WITH CARON
+ 0x009d: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE
+ 0x009e: 0x00d7, # MULTIPLICATION SIGN
+ 0x009f: 0x010d, # LATIN SMALL LETTER C WITH CARON
+ 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00a4: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK
+ 0x00a5: 0x0105, # LATIN SMALL LETTER A WITH OGONEK
+ 0x00a6: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON
+ 0x00a7: 0x017e, # LATIN SMALL LETTER Z WITH CARON
+ 0x00a8: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK
+ 0x00a9: 0x0119, # LATIN SMALL LETTER E WITH OGONEK
+ 0x00aa: 0x00ac, # NOT SIGN
+ 0x00ab: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE
+ 0x00ac: 0x010c, # LATIN CAPITAL LETTER C WITH CARON
+ 0x00ad: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA
+ 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00b0: 0x2591, # LIGHT SHADE
+ 0x00b1: 0x2592, # MEDIUM SHADE
+ 0x00b2: 0x2593, # DARK SHADE
+ 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL
+ 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x00b5: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE
+ 0x00b6: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ 0x00b7: 0x011a, # LATIN CAPITAL LETTER E WITH CARON
+ 0x00b8: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA
+ 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x00bd: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE
+ 0x00be: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE
+ 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x00c6: 0x0102, # LATIN CAPITAL LETTER A WITH BREVE
+ 0x00c7: 0x0103, # LATIN SMALL LETTER A WITH BREVE
+ 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x00cf: 0x00a4, # CURRENCY SIGN
+ 0x00d0: 0x0111, # LATIN SMALL LETTER D WITH STROKE
+ 0x00d1: 0x0110, # LATIN CAPITAL LETTER D WITH STROKE
+ 0x00d2: 0x010e, # LATIN CAPITAL LETTER D WITH CARON
+ 0x00d3: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS
+ 0x00d4: 0x010f, # LATIN SMALL LETTER D WITH CARON
+ 0x00d5: 0x0147, # LATIN CAPITAL LETTER N WITH CARON
+ 0x00d6: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE
+ 0x00d7: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ 0x00d8: 0x011b, # LATIN SMALL LETTER E WITH CARON
+ 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x00db: 0x2588, # FULL BLOCK
+ 0x00dc: 0x2584, # LOWER HALF BLOCK
+ 0x00dd: 0x0162, # LATIN CAPITAL LETTER T WITH CEDILLA
+ 0x00de: 0x016e, # LATIN CAPITAL LETTER U WITH RING ABOVE
+ 0x00df: 0x2580, # UPPER HALF BLOCK
+ 0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE
+ 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S
+ 0x00e2: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ 0x00e3: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE
+ 0x00e4: 0x0144, # LATIN SMALL LETTER N WITH ACUTE
+ 0x00e5: 0x0148, # LATIN SMALL LETTER N WITH CARON
+ 0x00e6: 0x0160, # LATIN CAPITAL LETTER S WITH CARON
+ 0x00e7: 0x0161, # LATIN SMALL LETTER S WITH CARON
+ 0x00e8: 0x0154, # LATIN CAPITAL LETTER R WITH ACUTE
+ 0x00e9: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE
+ 0x00ea: 0x0155, # LATIN SMALL LETTER R WITH ACUTE
+ 0x00eb: 0x0170, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
+ 0x00ec: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE
+ 0x00ed: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE
+ 0x00ee: 0x0163, # LATIN SMALL LETTER T WITH CEDILLA
+ 0x00ef: 0x00b4, # ACUTE ACCENT
+ 0x00f0: 0x00ad, # SOFT HYPHEN
+ 0x00f1: 0x02dd, # DOUBLE ACUTE ACCENT
+ 0x00f2: 0x02db, # OGONEK
+ 0x00f3: 0x02c7, # CARON
+ 0x00f4: 0x02d8, # BREVE
+ 0x00f5: 0x00a7, # SECTION SIGN
+ 0x00f6: 0x00f7, # DIVISION SIGN
+ 0x00f7: 0x00b8, # CEDILLA
+ 0x00f8: 0x00b0, # DEGREE SIGN
+ 0x00f9: 0x00a8, # DIAERESIS
+ 0x00fa: 0x02d9, # DOT ABOVE
+ 0x00fb: 0x0171, # LATIN SMALL LETTER U WITH DOUBLE ACUTE
+ 0x00fc: 0x0158, # LATIN CAPITAL LETTER R WITH CARON
+ 0x00fd: 0x0159, # LATIN SMALL LETTER R WITH CARON
+ 0x00fe: 0x25a0, # BLACK SQUARE
+ 0x00ff: 0x00a0, # NO-BREAK SPACE
+})
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x0000 -> NULL
+ u'\x01' # 0x0001 -> START OF HEADING
+ u'\x02' # 0x0002 -> START OF TEXT
+ u'\x03' # 0x0003 -> END OF TEXT
+ u'\x04' # 0x0004 -> END OF TRANSMISSION
+ u'\x05' # 0x0005 -> ENQUIRY
+ u'\x06' # 0x0006 -> ACKNOWLEDGE
+ u'\x07' # 0x0007 -> BELL
+ u'\x08' # 0x0008 -> BACKSPACE
+ u'\t' # 0x0009 -> HORIZONTAL TABULATION
+ u'\n' # 0x000a -> LINE FEED
+ u'\x0b' # 0x000b -> VERTICAL TABULATION
+ u'\x0c' # 0x000c -> FORM FEED
+ u'\r' # 0x000d -> CARRIAGE RETURN
+ u'\x0e' # 0x000e -> SHIFT OUT
+ u'\x0f' # 0x000f -> SHIFT IN
+ u'\x10' # 0x0010 -> DATA LINK ESCAPE
+ u'\x11' # 0x0011 -> DEVICE CONTROL ONE
+ u'\x12' # 0x0012 -> DEVICE CONTROL TWO
+ u'\x13' # 0x0013 -> DEVICE CONTROL THREE
+ u'\x14' # 0x0014 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x0016 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x0018 -> CANCEL
+ u'\x19' # 0x0019 -> END OF MEDIUM
+ u'\x1a' # 0x001a -> SUBSTITUTE
+ u'\x1b' # 0x001b -> ESCAPE
+ u'\x1c' # 0x001c -> FILE SEPARATOR
+ u'\x1d' # 0x001d -> GROUP SEPARATOR
+ u'\x1e' # 0x001e -> RECORD SEPARATOR
+ u'\x1f' # 0x001f -> UNIT SEPARATOR
+ u' ' # 0x0020 -> SPACE
+ u'!' # 0x0021 -> EXCLAMATION MARK
+ u'"' # 0x0022 -> QUOTATION MARK
+ u'#' # 0x0023 -> NUMBER SIGN
+ u'$' # 0x0024 -> DOLLAR SIGN
+ u'%' # 0x0025 -> PERCENT SIGN
+ u'&' # 0x0026 -> AMPERSAND
+ u"'" # 0x0027 -> APOSTROPHE
+ u'(' # 0x0028 -> LEFT PARENTHESIS
+ u')' # 0x0029 -> RIGHT PARENTHESIS
+ u'*' # 0x002a -> ASTERISK
+ u'+' # 0x002b -> PLUS SIGN
+ u',' # 0x002c -> COMMA
+ u'-' # 0x002d -> HYPHEN-MINUS
+ u'.' # 0x002e -> FULL STOP
+ u'/' # 0x002f -> SOLIDUS
+ u'0' # 0x0030 -> DIGIT ZERO
+ u'1' # 0x0031 -> DIGIT ONE
+ u'2' # 0x0032 -> DIGIT TWO
+ u'3' # 0x0033 -> DIGIT THREE
+ u'4' # 0x0034 -> DIGIT FOUR
+ u'5' # 0x0035 -> DIGIT FIVE
+ u'6' # 0x0036 -> DIGIT SIX
+ u'7' # 0x0037 -> DIGIT SEVEN
+ u'8' # 0x0038 -> DIGIT EIGHT
+ u'9' # 0x0039 -> DIGIT NINE
+ u':' # 0x003a -> COLON
+ u';' # 0x003b -> SEMICOLON
+ u'<' # 0x003c -> LESS-THAN SIGN
+ u'=' # 0x003d -> EQUALS SIGN
+ u'>' # 0x003e -> GREATER-THAN SIGN
+ u'?' # 0x003f -> QUESTION MARK
+ u'@' # 0x0040 -> COMMERCIAL AT
+ u'A' # 0x0041 -> LATIN CAPITAL LETTER A
+ u'B' # 0x0042 -> LATIN CAPITAL LETTER B
+ u'C' # 0x0043 -> LATIN CAPITAL LETTER C
+ u'D' # 0x0044 -> LATIN CAPITAL LETTER D
+ u'E' # 0x0045 -> LATIN CAPITAL LETTER E
+ u'F' # 0x0046 -> LATIN CAPITAL LETTER F
+ u'G' # 0x0047 -> LATIN CAPITAL LETTER G
+ u'H' # 0x0048 -> LATIN CAPITAL LETTER H
+ u'I' # 0x0049 -> LATIN CAPITAL LETTER I
+ u'J' # 0x004a -> LATIN CAPITAL LETTER J
+ u'K' # 0x004b -> LATIN CAPITAL LETTER K
+ u'L' # 0x004c -> LATIN CAPITAL LETTER L
+ u'M' # 0x004d -> LATIN CAPITAL LETTER M
+ u'N' # 0x004e -> LATIN CAPITAL LETTER N
+ u'O' # 0x004f -> LATIN CAPITAL LETTER O
+ u'P' # 0x0050 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x0052 -> LATIN CAPITAL LETTER R
+ u'S' # 0x0053 -> LATIN CAPITAL LETTER S
+ u'T' # 0x0054 -> LATIN CAPITAL LETTER T
+ u'U' # 0x0055 -> LATIN CAPITAL LETTER U
+ u'V' # 0x0056 -> LATIN CAPITAL LETTER V
+ u'W' # 0x0057 -> LATIN CAPITAL LETTER W
+ u'X' # 0x0058 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x005a -> LATIN CAPITAL LETTER Z
+ u'[' # 0x005b -> LEFT SQUARE BRACKET
+ u'\\' # 0x005c -> REVERSE SOLIDUS
+ u']' # 0x005d -> RIGHT SQUARE BRACKET
+ u'^' # 0x005e -> CIRCUMFLEX ACCENT
+ u'_' # 0x005f -> LOW LINE
+ u'`' # 0x0060 -> GRAVE ACCENT
+ u'a' # 0x0061 -> LATIN SMALL LETTER A
+ u'b' # 0x0062 -> LATIN SMALL LETTER B
+ u'c' # 0x0063 -> LATIN SMALL LETTER C
+ u'd' # 0x0064 -> LATIN SMALL LETTER D
+ u'e' # 0x0065 -> LATIN SMALL LETTER E
+ u'f' # 0x0066 -> LATIN SMALL LETTER F
+ u'g' # 0x0067 -> LATIN SMALL LETTER G
+ u'h' # 0x0068 -> LATIN SMALL LETTER H
+ u'i' # 0x0069 -> LATIN SMALL LETTER I
+ u'j' # 0x006a -> LATIN SMALL LETTER J
+ u'k' # 0x006b -> LATIN SMALL LETTER K
+ u'l' # 0x006c -> LATIN SMALL LETTER L
+ u'm' # 0x006d -> LATIN SMALL LETTER M
+ u'n' # 0x006e -> LATIN SMALL LETTER N
+ u'o' # 0x006f -> LATIN SMALL LETTER O
+ u'p' # 0x0070 -> LATIN SMALL LETTER P
+ u'q' # 0x0071 -> LATIN SMALL LETTER Q
+ u'r' # 0x0072 -> LATIN SMALL LETTER R
+ u's' # 0x0073 -> LATIN SMALL LETTER S
+ u't' # 0x0074 -> LATIN SMALL LETTER T
+ u'u' # 0x0075 -> LATIN SMALL LETTER U
+ u'v' # 0x0076 -> LATIN SMALL LETTER V
+ u'w' # 0x0077 -> LATIN SMALL LETTER W
+ u'x' # 0x0078 -> LATIN SMALL LETTER X
+ u'y' # 0x0079 -> LATIN SMALL LETTER Y
+ u'z' # 0x007a -> LATIN SMALL LETTER Z
+ u'{' # 0x007b -> LEFT CURLY BRACKET
+ u'|' # 0x007c -> VERTICAL LINE
+ u'}' # 0x007d -> RIGHT CURLY BRACKET
+ u'~' # 0x007e -> TILDE
+ u'\x7f' # 0x007f -> DELETE
+ u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\u016f' # 0x0085 -> LATIN SMALL LETTER U WITH RING ABOVE
+ u'\u0107' # 0x0086 -> LATIN SMALL LETTER C WITH ACUTE
+ u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\u0142' # 0x0088 -> LATIN SMALL LETTER L WITH STROKE
+ u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\u0150' # 0x008a -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
+ u'\u0151' # 0x008b -> LATIN SMALL LETTER O WITH DOUBLE ACUTE
+ u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\u0179' # 0x008d -> LATIN CAPITAL LETTER Z WITH ACUTE
+ u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\u0106' # 0x008f -> LATIN CAPITAL LETTER C WITH ACUTE
+ u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\u0139' # 0x0091 -> LATIN CAPITAL LETTER L WITH ACUTE
+ u'\u013a' # 0x0092 -> LATIN SMALL LETTER L WITH ACUTE
+ u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\u013d' # 0x0095 -> LATIN CAPITAL LETTER L WITH CARON
+ u'\u013e' # 0x0096 -> LATIN SMALL LETTER L WITH CARON
+ u'\u015a' # 0x0097 -> LATIN CAPITAL LETTER S WITH ACUTE
+ u'\u015b' # 0x0098 -> LATIN SMALL LETTER S WITH ACUTE
+ u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\u0164' # 0x009b -> LATIN CAPITAL LETTER T WITH CARON
+ u'\u0165' # 0x009c -> LATIN SMALL LETTER T WITH CARON
+ u'\u0141' # 0x009d -> LATIN CAPITAL LETTER L WITH STROKE
+ u'\xd7' # 0x009e -> MULTIPLICATION SIGN
+ u'\u010d' # 0x009f -> LATIN SMALL LETTER C WITH CARON
+ u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE
+ u'\u0104' # 0x00a4 -> LATIN CAPITAL LETTER A WITH OGONEK
+ u'\u0105' # 0x00a5 -> LATIN SMALL LETTER A WITH OGONEK
+ u'\u017d' # 0x00a6 -> LATIN CAPITAL LETTER Z WITH CARON
+ u'\u017e' # 0x00a7 -> LATIN SMALL LETTER Z WITH CARON
+ u'\u0118' # 0x00a8 -> LATIN CAPITAL LETTER E WITH OGONEK
+ u'\u0119' # 0x00a9 -> LATIN SMALL LETTER E WITH OGONEK
+ u'\xac' # 0x00aa -> NOT SIGN
+ u'\u017a' # 0x00ab -> LATIN SMALL LETTER Z WITH ACUTE
+ u'\u010c' # 0x00ac -> LATIN CAPITAL LETTER C WITH CARON
+ u'\u015f' # 0x00ad -> LATIN SMALL LETTER S WITH CEDILLA
+ u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2591' # 0x00b0 -> LIGHT SHADE
+ u'\u2592' # 0x00b1 -> MEDIUM SHADE
+ u'\u2593' # 0x00b2 -> DARK SHADE
+ u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL
+ u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ u'\xc1' # 0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc2' # 0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\u011a' # 0x00b7 -> LATIN CAPITAL LETTER E WITH CARON
+ u'\u015e' # 0x00b8 -> LATIN CAPITAL LETTER S WITH CEDILLA
+ u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL
+ u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT
+ u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT
+ u'\u017b' # 0x00bd -> LATIN CAPITAL LETTER Z WITH DOT ABOVE
+ u'\u017c' # 0x00be -> LATIN SMALL LETTER Z WITH DOT ABOVE
+ u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT
+ u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT
+ u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL
+ u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ u'\u0102' # 0x00c6 -> LATIN CAPITAL LETTER A WITH BREVE
+ u'\u0103' # 0x00c7 -> LATIN SMALL LETTER A WITH BREVE
+ u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
+ u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL
+ u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ u'\xa4' # 0x00cf -> CURRENCY SIGN
+ u'\u0111' # 0x00d0 -> LATIN SMALL LETTER D WITH STROKE
+ u'\u0110' # 0x00d1 -> LATIN CAPITAL LETTER D WITH STROKE
+ u'\u010e' # 0x00d2 -> LATIN CAPITAL LETTER D WITH CARON
+ u'\xcb' # 0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\u010f' # 0x00d4 -> LATIN SMALL LETTER D WITH CARON
+ u'\u0147' # 0x00d5 -> LATIN CAPITAL LETTER N WITH CARON
+ u'\xcd' # 0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\u011b' # 0x00d8 -> LATIN SMALL LETTER E WITH CARON
+ u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT
+ u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT
+ u'\u2588' # 0x00db -> FULL BLOCK
+ u'\u2584' # 0x00dc -> LOWER HALF BLOCK
+ u'\u0162' # 0x00dd -> LATIN CAPITAL LETTER T WITH CEDILLA
+ u'\u016e' # 0x00de -> LATIN CAPITAL LETTER U WITH RING ABOVE
+ u'\u2580' # 0x00df -> UPPER HALF BLOCK
+ u'\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S
+ u'\xd4' # 0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\u0143' # 0x00e3 -> LATIN CAPITAL LETTER N WITH ACUTE
+ u'\u0144' # 0x00e4 -> LATIN SMALL LETTER N WITH ACUTE
+ u'\u0148' # 0x00e5 -> LATIN SMALL LETTER N WITH CARON
+ u'\u0160' # 0x00e6 -> LATIN CAPITAL LETTER S WITH CARON
+ u'\u0161' # 0x00e7 -> LATIN SMALL LETTER S WITH CARON
+ u'\u0154' # 0x00e8 -> LATIN CAPITAL LETTER R WITH ACUTE
+ u'\xda' # 0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\u0155' # 0x00ea -> LATIN SMALL LETTER R WITH ACUTE
+ u'\u0170' # 0x00eb -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
+ u'\xfd' # 0x00ec -> LATIN SMALL LETTER Y WITH ACUTE
+ u'\xdd' # 0x00ed -> LATIN CAPITAL LETTER Y WITH ACUTE
+ u'\u0163' # 0x00ee -> LATIN SMALL LETTER T WITH CEDILLA
+ u'\xb4' # 0x00ef -> ACUTE ACCENT
+ u'\xad' # 0x00f0 -> SOFT HYPHEN
+ u'\u02dd' # 0x00f1 -> DOUBLE ACUTE ACCENT
+ u'\u02db' # 0x00f2 -> OGONEK
+ u'\u02c7' # 0x00f3 -> CARON
+ u'\u02d8' # 0x00f4 -> BREVE
+ u'\xa7' # 0x00f5 -> SECTION SIGN
+ u'\xf7' # 0x00f6 -> DIVISION SIGN
+ u'\xb8' # 0x00f7 -> CEDILLA
+ u'\xb0' # 0x00f8 -> DEGREE SIGN
+ u'\xa8' # 0x00f9 -> DIAERESIS
+ u'\u02d9' # 0x00fa -> DOT ABOVE
+ u'\u0171' # 0x00fb -> LATIN SMALL LETTER U WITH DOUBLE ACUTE
+ u'\u0158' # 0x00fc -> LATIN CAPITAL LETTER R WITH CARON
+ u'\u0159' # 0x00fd -> LATIN SMALL LETTER R WITH CARON
+ u'\u25a0' # 0x00fe -> BLACK SQUARE
+ u'\xa0' # 0x00ff -> NO-BREAK SPACE
+)
+
+### Encoding Map
+
+encoding_map = {
+ 0x0000: 0x0000, # NULL
+ 0x0001: 0x0001, # START OF HEADING
+ 0x0002: 0x0002, # START OF TEXT
+ 0x0003: 0x0003, # END OF TEXT
+ 0x0004: 0x0004, # END OF TRANSMISSION
+ 0x0005: 0x0005, # ENQUIRY
+ 0x0006: 0x0006, # ACKNOWLEDGE
+ 0x0007: 0x0007, # BELL
+ 0x0008: 0x0008, # BACKSPACE
+ 0x0009: 0x0009, # HORIZONTAL TABULATION
+ 0x000a: 0x000a, # LINE FEED
+ 0x000b: 0x000b, # VERTICAL TABULATION
+ 0x000c: 0x000c, # FORM FEED
+ 0x000d: 0x000d, # CARRIAGE RETURN
+ 0x000e: 0x000e, # SHIFT OUT
+ 0x000f: 0x000f, # SHIFT IN
+ 0x0010: 0x0010, # DATA LINK ESCAPE
+ 0x0011: 0x0011, # DEVICE CONTROL ONE
+ 0x0012: 0x0012, # DEVICE CONTROL TWO
+ 0x0013: 0x0013, # DEVICE CONTROL THREE
+ 0x0014: 0x0014, # DEVICE CONTROL FOUR
+ 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE
+ 0x0016: 0x0016, # SYNCHRONOUS IDLE
+ 0x0017: 0x0017, # END OF TRANSMISSION BLOCK
+ 0x0018: 0x0018, # CANCEL
+ 0x0019: 0x0019, # END OF MEDIUM
+ 0x001a: 0x001a, # SUBSTITUTE
+ 0x001b: 0x001b, # ESCAPE
+ 0x001c: 0x001c, # FILE SEPARATOR
+ 0x001d: 0x001d, # GROUP SEPARATOR
+ 0x001e: 0x001e, # RECORD SEPARATOR
+ 0x001f: 0x001f, # UNIT SEPARATOR
+ 0x0020: 0x0020, # SPACE
+ 0x0021: 0x0021, # EXCLAMATION MARK
+ 0x0022: 0x0022, # QUOTATION MARK
+ 0x0023: 0x0023, # NUMBER SIGN
+ 0x0024: 0x0024, # DOLLAR SIGN
+ 0x0025: 0x0025, # PERCENT SIGN
+ 0x0026: 0x0026, # AMPERSAND
+ 0x0027: 0x0027, # APOSTROPHE
+ 0x0028: 0x0028, # LEFT PARENTHESIS
+ 0x0029: 0x0029, # RIGHT PARENTHESIS
+ 0x002a: 0x002a, # ASTERISK
+ 0x002b: 0x002b, # PLUS SIGN
+ 0x002c: 0x002c, # COMMA
+ 0x002d: 0x002d, # HYPHEN-MINUS
+ 0x002e: 0x002e, # FULL STOP
+ 0x002f: 0x002f, # SOLIDUS
+ 0x0030: 0x0030, # DIGIT ZERO
+ 0x0031: 0x0031, # DIGIT ONE
+ 0x0032: 0x0032, # DIGIT TWO
+ 0x0033: 0x0033, # DIGIT THREE
+ 0x0034: 0x0034, # DIGIT FOUR
+ 0x0035: 0x0035, # DIGIT FIVE
+ 0x0036: 0x0036, # DIGIT SIX
+ 0x0037: 0x0037, # DIGIT SEVEN
+ 0x0038: 0x0038, # DIGIT EIGHT
+ 0x0039: 0x0039, # DIGIT NINE
+ 0x003a: 0x003a, # COLON
+ 0x003b: 0x003b, # SEMICOLON
+ 0x003c: 0x003c, # LESS-THAN SIGN
+ 0x003d: 0x003d, # EQUALS SIGN
+ 0x003e: 0x003e, # GREATER-THAN SIGN
+ 0x003f: 0x003f, # QUESTION MARK
+ 0x0040: 0x0040, # COMMERCIAL AT
+ 0x0041: 0x0041, # LATIN CAPITAL LETTER A
+ 0x0042: 0x0042, # LATIN CAPITAL LETTER B
+ 0x0043: 0x0043, # LATIN CAPITAL LETTER C
+ 0x0044: 0x0044, # LATIN CAPITAL LETTER D
+ 0x0045: 0x0045, # LATIN CAPITAL LETTER E
+ 0x0046: 0x0046, # LATIN CAPITAL LETTER F
+ 0x0047: 0x0047, # LATIN CAPITAL LETTER G
+ 0x0048: 0x0048, # LATIN CAPITAL LETTER H
+ 0x0049: 0x0049, # LATIN CAPITAL LETTER I
+ 0x004a: 0x004a, # LATIN CAPITAL LETTER J
+ 0x004b: 0x004b, # LATIN CAPITAL LETTER K
+ 0x004c: 0x004c, # LATIN CAPITAL LETTER L
+ 0x004d: 0x004d, # LATIN CAPITAL LETTER M
+ 0x004e: 0x004e, # LATIN CAPITAL LETTER N
+ 0x004f: 0x004f, # LATIN CAPITAL LETTER O
+ 0x0050: 0x0050, # LATIN CAPITAL LETTER P
+ 0x0051: 0x0051, # LATIN CAPITAL LETTER Q
+ 0x0052: 0x0052, # LATIN CAPITAL LETTER R
+ 0x0053: 0x0053, # LATIN CAPITAL LETTER S
+ 0x0054: 0x0054, # LATIN CAPITAL LETTER T
+ 0x0055: 0x0055, # LATIN CAPITAL LETTER U
+ 0x0056: 0x0056, # LATIN CAPITAL LETTER V
+ 0x0057: 0x0057, # LATIN CAPITAL LETTER W
+ 0x0058: 0x0058, # LATIN CAPITAL LETTER X
+ 0x0059: 0x0059, # LATIN CAPITAL LETTER Y
+ 0x005a: 0x005a, # LATIN CAPITAL LETTER Z
+ 0x005b: 0x005b, # LEFT SQUARE BRACKET
+ 0x005c: 0x005c, # REVERSE SOLIDUS
+ 0x005d: 0x005d, # RIGHT SQUARE BRACKET
+ 0x005e: 0x005e, # CIRCUMFLEX ACCENT
+ 0x005f: 0x005f, # LOW LINE
+ 0x0060: 0x0060, # GRAVE ACCENT
+ 0x0061: 0x0061, # LATIN SMALL LETTER A
+ 0x0062: 0x0062, # LATIN SMALL LETTER B
+ 0x0063: 0x0063, # LATIN SMALL LETTER C
+ 0x0064: 0x0064, # LATIN SMALL LETTER D
+ 0x0065: 0x0065, # LATIN SMALL LETTER E
+ 0x0066: 0x0066, # LATIN SMALL LETTER F
+ 0x0067: 0x0067, # LATIN SMALL LETTER G
+ 0x0068: 0x0068, # LATIN SMALL LETTER H
+ 0x0069: 0x0069, # LATIN SMALL LETTER I
+ 0x006a: 0x006a, # LATIN SMALL LETTER J
+ 0x006b: 0x006b, # LATIN SMALL LETTER K
+ 0x006c: 0x006c, # LATIN SMALL LETTER L
+ 0x006d: 0x006d, # LATIN SMALL LETTER M
+ 0x006e: 0x006e, # LATIN SMALL LETTER N
+ 0x006f: 0x006f, # LATIN SMALL LETTER O
+ 0x0070: 0x0070, # LATIN SMALL LETTER P
+ 0x0071: 0x0071, # LATIN SMALL LETTER Q
+ 0x0072: 0x0072, # LATIN SMALL LETTER R
+ 0x0073: 0x0073, # LATIN SMALL LETTER S
+ 0x0074: 0x0074, # LATIN SMALL LETTER T
+ 0x0075: 0x0075, # LATIN SMALL LETTER U
+ 0x0076: 0x0076, # LATIN SMALL LETTER V
+ 0x0077: 0x0077, # LATIN SMALL LETTER W
+ 0x0078: 0x0078, # LATIN SMALL LETTER X
+ 0x0079: 0x0079, # LATIN SMALL LETTER Y
+ 0x007a: 0x007a, # LATIN SMALL LETTER Z
+ 0x007b: 0x007b, # LEFT CURLY BRACKET
+ 0x007c: 0x007c, # VERTICAL LINE
+ 0x007d: 0x007d, # RIGHT CURLY BRACKET
+ 0x007e: 0x007e, # TILDE
+ 0x007f: 0x007f, # DELETE
+ 0x00a0: 0x00ff, # NO-BREAK SPACE
+ 0x00a4: 0x00cf, # CURRENCY SIGN
+ 0x00a7: 0x00f5, # SECTION SIGN
+ 0x00a8: 0x00f9, # DIAERESIS
+ 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00ac: 0x00aa, # NOT SIGN
+ 0x00ad: 0x00f0, # SOFT HYPHEN
+ 0x00b0: 0x00f8, # DEGREE SIGN
+ 0x00b4: 0x00ef, # ACUTE ACCENT
+ 0x00b8: 0x00f7, # CEDILLA
+ 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00c1: 0x00b5, # LATIN CAPITAL LETTER A WITH ACUTE
+ 0x00c2: 0x00b6, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ 0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x00cb: 0x00d3, # LATIN CAPITAL LETTER E WITH DIAERESIS
+ 0x00cd: 0x00d6, # LATIN CAPITAL LETTER I WITH ACUTE
+ 0x00ce: 0x00d7, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ 0x00d3: 0x00e0, # LATIN CAPITAL LETTER O WITH ACUTE
+ 0x00d4: 0x00e2, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ 0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x00d7: 0x009e, # MULTIPLICATION SIGN
+ 0x00da: 0x00e9, # LATIN CAPITAL LETTER U WITH ACUTE
+ 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x00dd: 0x00ed, # LATIN CAPITAL LETTER Y WITH ACUTE
+ 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S
+ 0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE
+ 0x00eb: 0x0089, # LATIN SMALL LETTER E WITH DIAERESIS
+ 0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00ee: 0x008c, # LATIN SMALL LETTER I WITH CIRCUMFLEX
+ 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x00f7: 0x00f6, # DIVISION SIGN
+ 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x00fd: 0x00ec, # LATIN SMALL LETTER Y WITH ACUTE
+ 0x0102: 0x00c6, # LATIN CAPITAL LETTER A WITH BREVE
+ 0x0103: 0x00c7, # LATIN SMALL LETTER A WITH BREVE
+ 0x0104: 0x00a4, # LATIN CAPITAL LETTER A WITH OGONEK
+ 0x0105: 0x00a5, # LATIN SMALL LETTER A WITH OGONEK
+ 0x0106: 0x008f, # LATIN CAPITAL LETTER C WITH ACUTE
+ 0x0107: 0x0086, # LATIN SMALL LETTER C WITH ACUTE
+ 0x010c: 0x00ac, # LATIN CAPITAL LETTER C WITH CARON
+ 0x010d: 0x009f, # LATIN SMALL LETTER C WITH CARON
+ 0x010e: 0x00d2, # LATIN CAPITAL LETTER D WITH CARON
+ 0x010f: 0x00d4, # LATIN SMALL LETTER D WITH CARON
+ 0x0110: 0x00d1, # LATIN CAPITAL LETTER D WITH STROKE
+ 0x0111: 0x00d0, # LATIN SMALL LETTER D WITH STROKE
+ 0x0118: 0x00a8, # LATIN CAPITAL LETTER E WITH OGONEK
+ 0x0119: 0x00a9, # LATIN SMALL LETTER E WITH OGONEK
+ 0x011a: 0x00b7, # LATIN CAPITAL LETTER E WITH CARON
+ 0x011b: 0x00d8, # LATIN SMALL LETTER E WITH CARON
+ 0x0139: 0x0091, # LATIN CAPITAL LETTER L WITH ACUTE
+ 0x013a: 0x0092, # LATIN SMALL LETTER L WITH ACUTE
+ 0x013d: 0x0095, # LATIN CAPITAL LETTER L WITH CARON
+ 0x013e: 0x0096, # LATIN SMALL LETTER L WITH CARON
+ 0x0141: 0x009d, # LATIN CAPITAL LETTER L WITH STROKE
+ 0x0142: 0x0088, # LATIN SMALL LETTER L WITH STROKE
+ 0x0143: 0x00e3, # LATIN CAPITAL LETTER N WITH ACUTE
+ 0x0144: 0x00e4, # LATIN SMALL LETTER N WITH ACUTE
+ 0x0147: 0x00d5, # LATIN CAPITAL LETTER N WITH CARON
+ 0x0148: 0x00e5, # LATIN SMALL LETTER N WITH CARON
+ 0x0150: 0x008a, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
+ 0x0151: 0x008b, # LATIN SMALL LETTER O WITH DOUBLE ACUTE
+ 0x0154: 0x00e8, # LATIN CAPITAL LETTER R WITH ACUTE
+ 0x0155: 0x00ea, # LATIN SMALL LETTER R WITH ACUTE
+ 0x0158: 0x00fc, # LATIN CAPITAL LETTER R WITH CARON
+ 0x0159: 0x00fd, # LATIN SMALL LETTER R WITH CARON
+ 0x015a: 0x0097, # LATIN CAPITAL LETTER S WITH ACUTE
+ 0x015b: 0x0098, # LATIN SMALL LETTER S WITH ACUTE
+ 0x015e: 0x00b8, # LATIN CAPITAL LETTER S WITH CEDILLA
+ 0x015f: 0x00ad, # LATIN SMALL LETTER S WITH CEDILLA
+ 0x0160: 0x00e6, # LATIN CAPITAL LETTER S WITH CARON
+ 0x0161: 0x00e7, # LATIN SMALL LETTER S WITH CARON
+ 0x0162: 0x00dd, # LATIN CAPITAL LETTER T WITH CEDILLA
+ 0x0163: 0x00ee, # LATIN SMALL LETTER T WITH CEDILLA
+ 0x0164: 0x009b, # LATIN CAPITAL LETTER T WITH CARON
+ 0x0165: 0x009c, # LATIN SMALL LETTER T WITH CARON
+ 0x016e: 0x00de, # LATIN CAPITAL LETTER U WITH RING ABOVE
+ 0x016f: 0x0085, # LATIN SMALL LETTER U WITH RING ABOVE
+ 0x0170: 0x00eb, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
+ 0x0171: 0x00fb, # LATIN SMALL LETTER U WITH DOUBLE ACUTE
+ 0x0179: 0x008d, # LATIN CAPITAL LETTER Z WITH ACUTE
+ 0x017a: 0x00ab, # LATIN SMALL LETTER Z WITH ACUTE
+ 0x017b: 0x00bd, # LATIN CAPITAL LETTER Z WITH DOT ABOVE
+ 0x017c: 0x00be, # LATIN SMALL LETTER Z WITH DOT ABOVE
+ 0x017d: 0x00a6, # LATIN CAPITAL LETTER Z WITH CARON
+ 0x017e: 0x00a7, # LATIN SMALL LETTER Z WITH CARON
+ 0x02c7: 0x00f3, # CARON
+ 0x02d8: 0x00f4, # BREVE
+ 0x02d9: 0x00fa, # DOT ABOVE
+ 0x02db: 0x00f2, # OGONEK
+ 0x02dd: 0x00f1, # DOUBLE ACUTE ACCENT
+ 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL
+ 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x2580: 0x00df, # UPPER HALF BLOCK
+ 0x2584: 0x00dc, # LOWER HALF BLOCK
+ 0x2588: 0x00db, # FULL BLOCK
+ 0x2591: 0x00b0, # LIGHT SHADE
+ 0x2592: 0x00b1, # MEDIUM SHADE
+ 0x2593: 0x00b2, # DARK SHADE
+ 0x25a0: 0x00fe, # BLACK SQUARE
+}
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
index 0000000000..f72e8cc5d6
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp855.py
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP855.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp855',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0080: 0x0452, # CYRILLIC SMALL LETTER DJE
+ 0x0081: 0x0402, # CYRILLIC CAPITAL LETTER DJE
+ 0x0082: 0x0453, # CYRILLIC SMALL LETTER GJE
+ 0x0083: 0x0403, # CYRILLIC CAPITAL LETTER GJE
+ 0x0084: 0x0451, # CYRILLIC SMALL LETTER IO
+ 0x0085: 0x0401, # CYRILLIC CAPITAL LETTER IO
+ 0x0086: 0x0454, # CYRILLIC SMALL LETTER UKRAINIAN IE
+ 0x0087: 0x0404, # CYRILLIC CAPITAL LETTER UKRAINIAN IE
+ 0x0088: 0x0455, # CYRILLIC SMALL LETTER DZE
+ 0x0089: 0x0405, # CYRILLIC CAPITAL LETTER DZE
+ 0x008a: 0x0456, # CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
+ 0x008b: 0x0406, # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
+ 0x008c: 0x0457, # CYRILLIC SMALL LETTER YI
+ 0x008d: 0x0407, # CYRILLIC CAPITAL LETTER YI
+ 0x008e: 0x0458, # CYRILLIC SMALL LETTER JE
+ 0x008f: 0x0408, # CYRILLIC CAPITAL LETTER JE
+ 0x0090: 0x0459, # CYRILLIC SMALL LETTER LJE
+ 0x0091: 0x0409, # CYRILLIC CAPITAL LETTER LJE
+ 0x0092: 0x045a, # CYRILLIC SMALL LETTER NJE
+ 0x0093: 0x040a, # CYRILLIC CAPITAL LETTER NJE
+ 0x0094: 0x045b, # CYRILLIC SMALL LETTER TSHE
+ 0x0095: 0x040b, # CYRILLIC CAPITAL LETTER TSHE
+ 0x0096: 0x045c, # CYRILLIC SMALL LETTER KJE
+ 0x0097: 0x040c, # CYRILLIC CAPITAL LETTER KJE
+ 0x0098: 0x045e, # CYRILLIC SMALL LETTER SHORT U
+ 0x0099: 0x040e, # CYRILLIC CAPITAL LETTER SHORT U
+ 0x009a: 0x045f, # CYRILLIC SMALL LETTER DZHE
+ 0x009b: 0x040f, # CYRILLIC CAPITAL LETTER DZHE
+ 0x009c: 0x044e, # CYRILLIC SMALL LETTER YU
+ 0x009d: 0x042e, # CYRILLIC CAPITAL LETTER YU
+ 0x009e: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN
+ 0x009f: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN
+ 0x00a0: 0x0430, # CYRILLIC SMALL LETTER A
+ 0x00a1: 0x0410, # CYRILLIC CAPITAL LETTER A
+ 0x00a2: 0x0431, # CYRILLIC SMALL LETTER BE
+ 0x00a3: 0x0411, # CYRILLIC CAPITAL LETTER BE
+ 0x00a4: 0x0446, # CYRILLIC SMALL LETTER TSE
+ 0x00a5: 0x0426, # CYRILLIC CAPITAL LETTER TSE
+ 0x00a6: 0x0434, # CYRILLIC SMALL LETTER DE
+ 0x00a7: 0x0414, # CYRILLIC CAPITAL LETTER DE
+ 0x00a8: 0x0435, # CYRILLIC SMALL LETTER IE
+ 0x00a9: 0x0415, # CYRILLIC CAPITAL LETTER IE
+ 0x00aa: 0x0444, # CYRILLIC SMALL LETTER EF
+ 0x00ab: 0x0424, # CYRILLIC CAPITAL LETTER EF
+ 0x00ac: 0x0433, # CYRILLIC SMALL LETTER GHE
+ 0x00ad: 0x0413, # CYRILLIC CAPITAL LETTER GHE
+ 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00b0: 0x2591, # LIGHT SHADE
+ 0x00b1: 0x2592, # MEDIUM SHADE
+ 0x00b2: 0x2593, # DARK SHADE
+ 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL
+ 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x00b5: 0x0445, # CYRILLIC SMALL LETTER HA
+ 0x00b6: 0x0425, # CYRILLIC CAPITAL LETTER HA
+ 0x00b7: 0x0438, # CYRILLIC SMALL LETTER I
+ 0x00b8: 0x0418, # CYRILLIC CAPITAL LETTER I
+ 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x00bd: 0x0439, # CYRILLIC SMALL LETTER SHORT I
+ 0x00be: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I
+ 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x00c6: 0x043a, # CYRILLIC SMALL LETTER KA
+ 0x00c7: 0x041a, # CYRILLIC CAPITAL LETTER KA
+ 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x00cf: 0x00a4, # CURRENCY SIGN
+ 0x00d0: 0x043b, # CYRILLIC SMALL LETTER EL
+ 0x00d1: 0x041b, # CYRILLIC CAPITAL LETTER EL
+ 0x00d2: 0x043c, # CYRILLIC SMALL LETTER EM
+ 0x00d3: 0x041c, # CYRILLIC CAPITAL LETTER EM
+ 0x00d4: 0x043d, # CYRILLIC SMALL LETTER EN
+ 0x00d5: 0x041d, # CYRILLIC CAPITAL LETTER EN
+ 0x00d6: 0x043e, # CYRILLIC SMALL LETTER O
+ 0x00d7: 0x041e, # CYRILLIC CAPITAL LETTER O
+ 0x00d8: 0x043f, # CYRILLIC SMALL LETTER PE
+ 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x00db: 0x2588, # FULL BLOCK
+ 0x00dc: 0x2584, # LOWER HALF BLOCK
+ 0x00dd: 0x041f, # CYRILLIC CAPITAL LETTER PE
+ 0x00de: 0x044f, # CYRILLIC SMALL LETTER YA
+ 0x00df: 0x2580, # UPPER HALF BLOCK
+ 0x00e0: 0x042f, # CYRILLIC CAPITAL LETTER YA
+ 0x00e1: 0x0440, # CYRILLIC SMALL LETTER ER
+ 0x00e2: 0x0420, # CYRILLIC CAPITAL LETTER ER
+ 0x00e3: 0x0441, # CYRILLIC SMALL LETTER ES
+ 0x00e4: 0x0421, # CYRILLIC CAPITAL LETTER ES
+ 0x00e5: 0x0442, # CYRILLIC SMALL LETTER TE
+ 0x00e6: 0x0422, # CYRILLIC CAPITAL LETTER TE
+ 0x00e7: 0x0443, # CYRILLIC SMALL LETTER U
+ 0x00e8: 0x0423, # CYRILLIC CAPITAL LETTER U
+ 0x00e9: 0x0436, # CYRILLIC SMALL LETTER ZHE
+ 0x00ea: 0x0416, # CYRILLIC CAPITAL LETTER ZHE
+ 0x00eb: 0x0432, # CYRILLIC SMALL LETTER VE
+ 0x00ec: 0x0412, # CYRILLIC CAPITAL LETTER VE
+ 0x00ed: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN
+ 0x00ee: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN
+ 0x00ef: 0x2116, # NUMERO SIGN
+ 0x00f0: 0x00ad, # SOFT HYPHEN
+ 0x00f1: 0x044b, # CYRILLIC SMALL LETTER YERU
+ 0x00f2: 0x042b, # CYRILLIC CAPITAL LETTER YERU
+ 0x00f3: 0x0437, # CYRILLIC SMALL LETTER ZE
+ 0x00f4: 0x0417, # CYRILLIC CAPITAL LETTER ZE
+ 0x00f5: 0x0448, # CYRILLIC SMALL LETTER SHA
+ 0x00f6: 0x0428, # CYRILLIC CAPITAL LETTER SHA
+ 0x00f7: 0x044d, # CYRILLIC SMALL LETTER E
+ 0x00f8: 0x042d, # CYRILLIC CAPITAL LETTER E
+ 0x00f9: 0x0449, # CYRILLIC SMALL LETTER SHCHA
+ 0x00fa: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA
+ 0x00fb: 0x0447, # CYRILLIC SMALL LETTER CHE
+ 0x00fc: 0x0427, # CYRILLIC CAPITAL LETTER CHE
+ 0x00fd: 0x00a7, # SECTION SIGN
+ 0x00fe: 0x25a0, # BLACK SQUARE
+ 0x00ff: 0x00a0, # NO-BREAK SPACE
+})
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x0000 -> NULL
+ u'\x01' # 0x0001 -> START OF HEADING
+ u'\x02' # 0x0002 -> START OF TEXT
+ u'\x03' # 0x0003 -> END OF TEXT
+ u'\x04' # 0x0004 -> END OF TRANSMISSION
+ u'\x05' # 0x0005 -> ENQUIRY
+ u'\x06' # 0x0006 -> ACKNOWLEDGE
+ u'\x07' # 0x0007 -> BELL
+ u'\x08' # 0x0008 -> BACKSPACE
+ u'\t' # 0x0009 -> HORIZONTAL TABULATION
+ u'\n' # 0x000a -> LINE FEED
+ u'\x0b' # 0x000b -> VERTICAL TABULATION
+ u'\x0c' # 0x000c -> FORM FEED
+ u'\r' # 0x000d -> CARRIAGE RETURN
+ u'\x0e' # 0x000e -> SHIFT OUT
+ u'\x0f' # 0x000f -> SHIFT IN
+ u'\x10' # 0x0010 -> DATA LINK ESCAPE
+ u'\x11' # 0x0011 -> DEVICE CONTROL ONE
+ u'\x12' # 0x0012 -> DEVICE CONTROL TWO
+ u'\x13' # 0x0013 -> DEVICE CONTROL THREE
+ u'\x14' # 0x0014 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x0016 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x0018 -> CANCEL
+ u'\x19' # 0x0019 -> END OF MEDIUM
+ u'\x1a' # 0x001a -> SUBSTITUTE
+ u'\x1b' # 0x001b -> ESCAPE
+ u'\x1c' # 0x001c -> FILE SEPARATOR
+ u'\x1d' # 0x001d -> GROUP SEPARATOR
+ u'\x1e' # 0x001e -> RECORD SEPARATOR
+ u'\x1f' # 0x001f -> UNIT SEPARATOR
+ u' ' # 0x0020 -> SPACE
+ u'!' # 0x0021 -> EXCLAMATION MARK
+ u'"' # 0x0022 -> QUOTATION MARK
+ u'#' # 0x0023 -> NUMBER SIGN
+ u'$' # 0x0024 -> DOLLAR SIGN
+ u'%' # 0x0025 -> PERCENT SIGN
+ u'&' # 0x0026 -> AMPERSAND
+ u"'" # 0x0027 -> APOSTROPHE
+ u'(' # 0x0028 -> LEFT PARENTHESIS
+ u')' # 0x0029 -> RIGHT PARENTHESIS
+ u'*' # 0x002a -> ASTERISK
+ u'+' # 0x002b -> PLUS SIGN
+ u',' # 0x002c -> COMMA
+ u'-' # 0x002d -> HYPHEN-MINUS
+ u'.' # 0x002e -> FULL STOP
+ u'/' # 0x002f -> SOLIDUS
+ u'0' # 0x0030 -> DIGIT ZERO
+ u'1' # 0x0031 -> DIGIT ONE
+ u'2' # 0x0032 -> DIGIT TWO
+ u'3' # 0x0033 -> DIGIT THREE
+ u'4' # 0x0034 -> DIGIT FOUR
+ u'5' # 0x0035 -> DIGIT FIVE
+ u'6' # 0x0036 -> DIGIT SIX
+ u'7' # 0x0037 -> DIGIT SEVEN
+ u'8' # 0x0038 -> DIGIT EIGHT
+ u'9' # 0x0039 -> DIGIT NINE
+ u':' # 0x003a -> COLON
+ u';' # 0x003b -> SEMICOLON
+ u'<' # 0x003c -> LESS-THAN SIGN
+ u'=' # 0x003d -> EQUALS SIGN
+ u'>' # 0x003e -> GREATER-THAN SIGN
+ u'?' # 0x003f -> QUESTION MARK
+ u'@' # 0x0040 -> COMMERCIAL AT
+ u'A' # 0x0041 -> LATIN CAPITAL LETTER A
+ u'B' # 0x0042 -> LATIN CAPITAL LETTER B
+ u'C' # 0x0043 -> LATIN CAPITAL LETTER C
+ u'D' # 0x0044 -> LATIN CAPITAL LETTER D
+ u'E' # 0x0045 -> LATIN CAPITAL LETTER E
+ u'F' # 0x0046 -> LATIN CAPITAL LETTER F
+ u'G' # 0x0047 -> LATIN CAPITAL LETTER G
+ u'H' # 0x0048 -> LATIN CAPITAL LETTER H
+ u'I' # 0x0049 -> LATIN CAPITAL LETTER I
+ u'J' # 0x004a -> LATIN CAPITAL LETTER J
+ u'K' # 0x004b -> LATIN CAPITAL LETTER K
+ u'L' # 0x004c -> LATIN CAPITAL LETTER L
+ u'M' # 0x004d -> LATIN CAPITAL LETTER M
+ u'N' # 0x004e -> LATIN CAPITAL LETTER N
+ u'O' # 0x004f -> LATIN CAPITAL LETTER O
+ u'P' # 0x0050 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x0052 -> LATIN CAPITAL LETTER R
+ u'S' # 0x0053 -> LATIN CAPITAL LETTER S
+ u'T' # 0x0054 -> LATIN CAPITAL LETTER T
+ u'U' # 0x0055 -> LATIN CAPITAL LETTER U
+ u'V' # 0x0056 -> LATIN CAPITAL LETTER V
+ u'W' # 0x0057 -> LATIN CAPITAL LETTER W
+ u'X' # 0x0058 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x005a -> LATIN CAPITAL LETTER Z
+ u'[' # 0x005b -> LEFT SQUARE BRACKET
+ u'\\' # 0x005c -> REVERSE SOLIDUS
+ u']' # 0x005d -> RIGHT SQUARE BRACKET
+ u'^' # 0x005e -> CIRCUMFLEX ACCENT
+ u'_' # 0x005f -> LOW LINE
+ u'`' # 0x0060 -> GRAVE ACCENT
+ u'a' # 0x0061 -> LATIN SMALL LETTER A
+ u'b' # 0x0062 -> LATIN SMALL LETTER B
+ u'c' # 0x0063 -> LATIN SMALL LETTER C
+ u'd' # 0x0064 -> LATIN SMALL LETTER D
+ u'e' # 0x0065 -> LATIN SMALL LETTER E
+ u'f' # 0x0066 -> LATIN SMALL LETTER F
+ u'g' # 0x0067 -> LATIN SMALL LETTER G
+ u'h' # 0x0068 -> LATIN SMALL LETTER H
+ u'i' # 0x0069 -> LATIN SMALL LETTER I
+ u'j' # 0x006a -> LATIN SMALL LETTER J
+ u'k' # 0x006b -> LATIN SMALL LETTER K
+ u'l' # 0x006c -> LATIN SMALL LETTER L
+ u'm' # 0x006d -> LATIN SMALL LETTER M
+ u'n' # 0x006e -> LATIN SMALL LETTER N
+ u'o' # 0x006f -> LATIN SMALL LETTER O
+ u'p' # 0x0070 -> LATIN SMALL LETTER P
+ u'q' # 0x0071 -> LATIN SMALL LETTER Q
+ u'r' # 0x0072 -> LATIN SMALL LETTER R
+ u's' # 0x0073 -> LATIN SMALL LETTER S
+ u't' # 0x0074 -> LATIN SMALL LETTER T
+ u'u' # 0x0075 -> LATIN SMALL LETTER U
+ u'v' # 0x0076 -> LATIN SMALL LETTER V
+ u'w' # 0x0077 -> LATIN SMALL LETTER W
+ u'x' # 0x0078 -> LATIN SMALL LETTER X
+ u'y' # 0x0079 -> LATIN SMALL LETTER Y
+ u'z' # 0x007a -> LATIN SMALL LETTER Z
+ u'{' # 0x007b -> LEFT CURLY BRACKET
+ u'|' # 0x007c -> VERTICAL LINE
+ u'}' # 0x007d -> RIGHT CURLY BRACKET
+ u'~' # 0x007e -> TILDE
+ u'\x7f' # 0x007f -> DELETE
+ u'\u0452' # 0x0080 -> CYRILLIC SMALL LETTER DJE
+ u'\u0402' # 0x0081 -> CYRILLIC CAPITAL LETTER DJE
+ u'\u0453' # 0x0082 -> CYRILLIC SMALL LETTER GJE
+ u'\u0403' # 0x0083 -> CYRILLIC CAPITAL LETTER GJE
+ u'\u0451' # 0x0084 -> CYRILLIC SMALL LETTER IO
+ u'\u0401' # 0x0085 -> CYRILLIC CAPITAL LETTER IO
+ u'\u0454' # 0x0086 -> CYRILLIC SMALL LETTER UKRAINIAN IE
+ u'\u0404' # 0x0087 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE
+ u'\u0455' # 0x0088 -> CYRILLIC SMALL LETTER DZE
+ u'\u0405' # 0x0089 -> CYRILLIC CAPITAL LETTER DZE
+ u'\u0456' # 0x008a -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
+ u'\u0406' # 0x008b -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
+ u'\u0457' # 0x008c -> CYRILLIC SMALL LETTER YI
+ u'\u0407' # 0x008d -> CYRILLIC CAPITAL LETTER YI
+ u'\u0458' # 0x008e -> CYRILLIC SMALL LETTER JE
+ u'\u0408' # 0x008f -> CYRILLIC CAPITAL LETTER JE
+ u'\u0459' # 0x0090 -> CYRILLIC SMALL LETTER LJE
+ u'\u0409' # 0x0091 -> CYRILLIC CAPITAL LETTER LJE
+ u'\u045a' # 0x0092 -> CYRILLIC SMALL LETTER NJE
+ u'\u040a' # 0x0093 -> CYRILLIC CAPITAL LETTER NJE
+ u'\u045b' # 0x0094 -> CYRILLIC SMALL LETTER TSHE
+ u'\u040b' # 0x0095 -> CYRILLIC CAPITAL LETTER TSHE
+ u'\u045c' # 0x0096 -> CYRILLIC SMALL LETTER KJE
+ u'\u040c' # 0x0097 -> CYRILLIC CAPITAL LETTER KJE
+ u'\u045e' # 0x0098 -> CYRILLIC SMALL LETTER SHORT U
+ u'\u040e' # 0x0099 -> CYRILLIC CAPITAL LETTER SHORT U
+ u'\u045f' # 0x009a -> CYRILLIC SMALL LETTER DZHE
+ u'\u040f' # 0x009b -> CYRILLIC CAPITAL LETTER DZHE
+ u'\u044e' # 0x009c -> CYRILLIC SMALL LETTER YU
+ u'\u042e' # 0x009d -> CYRILLIC CAPITAL LETTER YU
+ u'\u044a' # 0x009e -> CYRILLIC SMALL LETTER HARD SIGN
+ u'\u042a' # 0x009f -> CYRILLIC CAPITAL LETTER HARD SIGN
+ u'\u0430' # 0x00a0 -> CYRILLIC SMALL LETTER A
+ u'\u0410' # 0x00a1 -> CYRILLIC CAPITAL LETTER A
+ u'\u0431' # 0x00a2 -> CYRILLIC SMALL LETTER BE
+ u'\u0411' # 0x00a3 -> CYRILLIC CAPITAL LETTER BE
+ u'\u0446' # 0x00a4 -> CYRILLIC SMALL LETTER TSE
+ u'\u0426' # 0x00a5 -> CYRILLIC CAPITAL LETTER TSE
+ u'\u0434' # 0x00a6 -> CYRILLIC SMALL LETTER DE
+ u'\u0414' # 0x00a7 -> CYRILLIC CAPITAL LETTER DE
+ u'\u0435' # 0x00a8 -> CYRILLIC SMALL LETTER IE
+ u'\u0415' # 0x00a9 -> CYRILLIC CAPITAL LETTER IE
+ u'\u0444' # 0x00aa -> CYRILLIC SMALL LETTER EF
+ u'\u0424' # 0x00ab -> CYRILLIC CAPITAL LETTER EF
+ u'\u0433' # 0x00ac -> CYRILLIC SMALL LETTER GHE
+ u'\u0413' # 0x00ad -> CYRILLIC CAPITAL LETTER GHE
+ u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2591' # 0x00b0 -> LIGHT SHADE
+ u'\u2592' # 0x00b1 -> MEDIUM SHADE
+ u'\u2593' # 0x00b2 -> DARK SHADE
+ u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL
+ u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ u'\u0445' # 0x00b5 -> CYRILLIC SMALL LETTER HA
+ u'\u0425' # 0x00b6 -> CYRILLIC CAPITAL LETTER HA
+ u'\u0438' # 0x00b7 -> CYRILLIC SMALL LETTER I
+ u'\u0418' # 0x00b8 -> CYRILLIC CAPITAL LETTER I
+ u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL
+ u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT
+ u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT
+ u'\u0439' # 0x00bd -> CYRILLIC SMALL LETTER SHORT I
+ u'\u0419' # 0x00be -> CYRILLIC CAPITAL LETTER SHORT I
+ u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT
+ u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT
+ u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL
+ u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ u'\u043a' # 0x00c6 -> CYRILLIC SMALL LETTER KA
+ u'\u041a' # 0x00c7 -> CYRILLIC CAPITAL LETTER KA
+ u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
+ u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL
+ u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ u'\xa4' # 0x00cf -> CURRENCY SIGN
+ u'\u043b' # 0x00d0 -> CYRILLIC SMALL LETTER EL
+ u'\u041b' # 0x00d1 -> CYRILLIC CAPITAL LETTER EL
+ u'\u043c' # 0x00d2 -> CYRILLIC SMALL LETTER EM
+ u'\u041c' # 0x00d3 -> CYRILLIC CAPITAL LETTER EM
+ u'\u043d' # 0x00d4 -> CYRILLIC SMALL LETTER EN
+ u'\u041d' # 0x00d5 -> CYRILLIC CAPITAL LETTER EN
+ u'\u043e' # 0x00d6 -> CYRILLIC SMALL LETTER O
+ u'\u041e' # 0x00d7 -> CYRILLIC CAPITAL LETTER O
+ u'\u043f' # 0x00d8 -> CYRILLIC SMALL LETTER PE
+ u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT
+ u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT
+ u'\u2588' # 0x00db -> FULL BLOCK
+ u'\u2584' # 0x00dc -> LOWER HALF BLOCK
+ u'\u041f' # 0x00dd -> CYRILLIC CAPITAL LETTER PE
+ u'\u044f' # 0x00de -> CYRILLIC SMALL LETTER YA
+ u'\u2580' # 0x00df -> UPPER HALF BLOCK
+ u'\u042f' # 0x00e0 -> CYRILLIC CAPITAL LETTER YA
+ u'\u0440' # 0x00e1 -> CYRILLIC SMALL LETTER ER
+ u'\u0420' # 0x00e2 -> CYRILLIC CAPITAL LETTER ER
+ u'\u0441' # 0x00e3 -> CYRILLIC SMALL LETTER ES
+ u'\u0421' # 0x00e4 -> CYRILLIC CAPITAL LETTER ES
+ u'\u0442' # 0x00e5 -> CYRILLIC SMALL LETTER TE
+ u'\u0422' # 0x00e6 -> CYRILLIC CAPITAL LETTER TE
+ u'\u0443' # 0x00e7 -> CYRILLIC SMALL LETTER U
+ u'\u0423' # 0x00e8 -> CYRILLIC CAPITAL LETTER U
+ u'\u0436' # 0x00e9 -> CYRILLIC SMALL LETTER ZHE
+ u'\u0416' # 0x00ea -> CYRILLIC CAPITAL LETTER ZHE
+ u'\u0432' # 0x00eb -> CYRILLIC SMALL LETTER VE
+ u'\u0412' # 0x00ec -> CYRILLIC CAPITAL LETTER VE
+ u'\u044c' # 0x00ed -> CYRILLIC SMALL LETTER SOFT SIGN
+ u'\u042c' # 0x00ee -> CYRILLIC CAPITAL LETTER SOFT SIGN
+ u'\u2116' # 0x00ef -> NUMERO SIGN
+ u'\xad' # 0x00f0 -> SOFT HYPHEN
+ u'\u044b' # 0x00f1 -> CYRILLIC SMALL LETTER YERU
+ u'\u042b' # 0x00f2 -> CYRILLIC CAPITAL LETTER YERU
+ u'\u0437' # 0x00f3 -> CYRILLIC SMALL LETTER ZE
+ u'\u0417' # 0x00f4 -> CYRILLIC CAPITAL LETTER ZE
+ u'\u0448' # 0x00f5 -> CYRILLIC SMALL LETTER SHA
+ u'\u0428' # 0x00f6 -> CYRILLIC CAPITAL LETTER SHA
+ u'\u044d' # 0x00f7 -> CYRILLIC SMALL LETTER E
+ u'\u042d' # 0x00f8 -> CYRILLIC CAPITAL LETTER E
+ u'\u0449' # 0x00f9 -> CYRILLIC SMALL LETTER SHCHA
+ u'\u0429' # 0x00fa -> CYRILLIC CAPITAL LETTER SHCHA
+ u'\u0447' # 0x00fb -> CYRILLIC SMALL LETTER CHE
+ u'\u0427' # 0x00fc -> CYRILLIC CAPITAL LETTER CHE
+ u'\xa7' # 0x00fd -> SECTION SIGN
+ u'\u25a0' # 0x00fe -> BLACK SQUARE
+ u'\xa0' # 0x00ff -> NO-BREAK SPACE
+)
+
+### Encoding Map
+
+encoding_map = {
+ 0x0000: 0x0000, # NULL
+ 0x0001: 0x0001, # START OF HEADING
+ 0x0002: 0x0002, # START OF TEXT
+ 0x0003: 0x0003, # END OF TEXT
+ 0x0004: 0x0004, # END OF TRANSMISSION
+ 0x0005: 0x0005, # ENQUIRY
+ 0x0006: 0x0006, # ACKNOWLEDGE
+ 0x0007: 0x0007, # BELL
+ 0x0008: 0x0008, # BACKSPACE
+ 0x0009: 0x0009, # HORIZONTAL TABULATION
+ 0x000a: 0x000a, # LINE FEED
+ 0x000b: 0x000b, # VERTICAL TABULATION
+ 0x000c: 0x000c, # FORM FEED
+ 0x000d: 0x000d, # CARRIAGE RETURN
+ 0x000e: 0x000e, # SHIFT OUT
+ 0x000f: 0x000f, # SHIFT IN
+ 0x0010: 0x0010, # DATA LINK ESCAPE
+ 0x0011: 0x0011, # DEVICE CONTROL ONE
+ 0x0012: 0x0012, # DEVICE CONTROL TWO
+ 0x0013: 0x0013, # DEVICE CONTROL THREE
+ 0x0014: 0x0014, # DEVICE CONTROL FOUR
+ 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE
+ 0x0016: 0x0016, # SYNCHRONOUS IDLE
+ 0x0017: 0x0017, # END OF TRANSMISSION BLOCK
+ 0x0018: 0x0018, # CANCEL
+ 0x0019: 0x0019, # END OF MEDIUM
+ 0x001a: 0x001a, # SUBSTITUTE
+ 0x001b: 0x001b, # ESCAPE
+ 0x001c: 0x001c, # FILE SEPARATOR
+ 0x001d: 0x001d, # GROUP SEPARATOR
+ 0x001e: 0x001e, # RECORD SEPARATOR
+ 0x001f: 0x001f, # UNIT SEPARATOR
+ 0x0020: 0x0020, # SPACE
+ 0x0021: 0x0021, # EXCLAMATION MARK
+ 0x0022: 0x0022, # QUOTATION MARK
+ 0x0023: 0x0023, # NUMBER SIGN
+ 0x0024: 0x0024, # DOLLAR SIGN
+ 0x0025: 0x0025, # PERCENT SIGN
+ 0x0026: 0x0026, # AMPERSAND
+ 0x0027: 0x0027, # APOSTROPHE
+ 0x0028: 0x0028, # LEFT PARENTHESIS
+ 0x0029: 0x0029, # RIGHT PARENTHESIS
+ 0x002a: 0x002a, # ASTERISK
+ 0x002b: 0x002b, # PLUS SIGN
+ 0x002c: 0x002c, # COMMA
+ 0x002d: 0x002d, # HYPHEN-MINUS
+ 0x002e: 0x002e, # FULL STOP
+ 0x002f: 0x002f, # SOLIDUS
+ 0x0030: 0x0030, # DIGIT ZERO
+ 0x0031: 0x0031, # DIGIT ONE
+ 0x0032: 0x0032, # DIGIT TWO
+ 0x0033: 0x0033, # DIGIT THREE
+ 0x0034: 0x0034, # DIGIT FOUR
+ 0x0035: 0x0035, # DIGIT FIVE
+ 0x0036: 0x0036, # DIGIT SIX
+ 0x0037: 0x0037, # DIGIT SEVEN
+ 0x0038: 0x0038, # DIGIT EIGHT
+ 0x0039: 0x0039, # DIGIT NINE
+ 0x003a: 0x003a, # COLON
+ 0x003b: 0x003b, # SEMICOLON
+ 0x003c: 0x003c, # LESS-THAN SIGN
+ 0x003d: 0x003d, # EQUALS SIGN
+ 0x003e: 0x003e, # GREATER-THAN SIGN
+ 0x003f: 0x003f, # QUESTION MARK
+ 0x0040: 0x0040, # COMMERCIAL AT
+ 0x0041: 0x0041, # LATIN CAPITAL LETTER A
+ 0x0042: 0x0042, # LATIN CAPITAL LETTER B
+ 0x0043: 0x0043, # LATIN CAPITAL LETTER C
+ 0x0044: 0x0044, # LATIN CAPITAL LETTER D
+ 0x0045: 0x0045, # LATIN CAPITAL LETTER E
+ 0x0046: 0x0046, # LATIN CAPITAL LETTER F
+ 0x0047: 0x0047, # LATIN CAPITAL LETTER G
+ 0x0048: 0x0048, # LATIN CAPITAL LETTER H
+ 0x0049: 0x0049, # LATIN CAPITAL LETTER I
+ 0x004a: 0x004a, # LATIN CAPITAL LETTER J
+ 0x004b: 0x004b, # LATIN CAPITAL LETTER K
+ 0x004c: 0x004c, # LATIN CAPITAL LETTER L
+ 0x004d: 0x004d, # LATIN CAPITAL LETTER M
+ 0x004e: 0x004e, # LATIN CAPITAL LETTER N
+ 0x004f: 0x004f, # LATIN CAPITAL LETTER O
+ 0x0050: 0x0050, # LATIN CAPITAL LETTER P
+ 0x0051: 0x0051, # LATIN CAPITAL LETTER Q
+ 0x0052: 0x0052, # LATIN CAPITAL LETTER R
+ 0x0053: 0x0053, # LATIN CAPITAL LETTER S
+ 0x0054: 0x0054, # LATIN CAPITAL LETTER T
+ 0x0055: 0x0055, # LATIN CAPITAL LETTER U
+ 0x0056: 0x0056, # LATIN CAPITAL LETTER V
+ 0x0057: 0x0057, # LATIN CAPITAL LETTER W
+ 0x0058: 0x0058, # LATIN CAPITAL LETTER X
+ 0x0059: 0x0059, # LATIN CAPITAL LETTER Y
+ 0x005a: 0x005a, # LATIN CAPITAL LETTER Z
+ 0x005b: 0x005b, # LEFT SQUARE BRACKET
+ 0x005c: 0x005c, # REVERSE SOLIDUS
+ 0x005d: 0x005d, # RIGHT SQUARE BRACKET
+ 0x005e: 0x005e, # CIRCUMFLEX ACCENT
+ 0x005f: 0x005f, # LOW LINE
+ 0x0060: 0x0060, # GRAVE ACCENT
+ 0x0061: 0x0061, # LATIN SMALL LETTER A
+ 0x0062: 0x0062, # LATIN SMALL LETTER B
+ 0x0063: 0x0063, # LATIN SMALL LETTER C
+ 0x0064: 0x0064, # LATIN SMALL LETTER D
+ 0x0065: 0x0065, # LATIN SMALL LETTER E
+ 0x0066: 0x0066, # LATIN SMALL LETTER F
+ 0x0067: 0x0067, # LATIN SMALL LETTER G
+ 0x0068: 0x0068, # LATIN SMALL LETTER H
+ 0x0069: 0x0069, # LATIN SMALL LETTER I
+ 0x006a: 0x006a, # LATIN SMALL LETTER J
+ 0x006b: 0x006b, # LATIN SMALL LETTER K
+ 0x006c: 0x006c, # LATIN SMALL LETTER L
+ 0x006d: 0x006d, # LATIN SMALL LETTER M
+ 0x006e: 0x006e, # LATIN SMALL LETTER N
+ 0x006f: 0x006f, # LATIN SMALL LETTER O
+ 0x0070: 0x0070, # LATIN SMALL LETTER P
+ 0x0071: 0x0071, # LATIN SMALL LETTER Q
+ 0x0072: 0x0072, # LATIN SMALL LETTER R
+ 0x0073: 0x0073, # LATIN SMALL LETTER S
+ 0x0074: 0x0074, # LATIN SMALL LETTER T
+ 0x0075: 0x0075, # LATIN SMALL LETTER U
+ 0x0076: 0x0076, # LATIN SMALL LETTER V
+ 0x0077: 0x0077, # LATIN SMALL LETTER W
+ 0x0078: 0x0078, # LATIN SMALL LETTER X
+ 0x0079: 0x0079, # LATIN SMALL LETTER Y
+ 0x007a: 0x007a, # LATIN SMALL LETTER Z
+ 0x007b: 0x007b, # LEFT CURLY BRACKET
+ 0x007c: 0x007c, # VERTICAL LINE
+ 0x007d: 0x007d, # RIGHT CURLY BRACKET
+ 0x007e: 0x007e, # TILDE
+ 0x007f: 0x007f, # DELETE
+ 0x00a0: 0x00ff, # NO-BREAK SPACE
+ 0x00a4: 0x00cf, # CURRENCY SIGN
+ 0x00a7: 0x00fd, # SECTION SIGN
+ 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00ad: 0x00f0, # SOFT HYPHEN
+ 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x0401: 0x0085, # CYRILLIC CAPITAL LETTER IO
+ 0x0402: 0x0081, # CYRILLIC CAPITAL LETTER DJE
+ 0x0403: 0x0083, # CYRILLIC CAPITAL LETTER GJE
+ 0x0404: 0x0087, # CYRILLIC CAPITAL LETTER UKRAINIAN IE
+ 0x0405: 0x0089, # CYRILLIC CAPITAL LETTER DZE
+ 0x0406: 0x008b, # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
+ 0x0407: 0x008d, # CYRILLIC CAPITAL LETTER YI
+ 0x0408: 0x008f, # CYRILLIC CAPITAL LETTER JE
+ 0x0409: 0x0091, # CYRILLIC CAPITAL LETTER LJE
+ 0x040a: 0x0093, # CYRILLIC CAPITAL LETTER NJE
+ 0x040b: 0x0095, # CYRILLIC CAPITAL LETTER TSHE
+ 0x040c: 0x0097, # CYRILLIC CAPITAL LETTER KJE
+ 0x040e: 0x0099, # CYRILLIC CAPITAL LETTER SHORT U
+ 0x040f: 0x009b, # CYRILLIC CAPITAL LETTER DZHE
+ 0x0410: 0x00a1, # CYRILLIC CAPITAL LETTER A
+ 0x0411: 0x00a3, # CYRILLIC CAPITAL LETTER BE
+ 0x0412: 0x00ec, # CYRILLIC CAPITAL LETTER VE
+ 0x0413: 0x00ad, # CYRILLIC CAPITAL LETTER GHE
+ 0x0414: 0x00a7, # CYRILLIC CAPITAL LETTER DE
+ 0x0415: 0x00a9, # CYRILLIC CAPITAL LETTER IE
+ 0x0416: 0x00ea, # CYRILLIC CAPITAL LETTER ZHE
+ 0x0417: 0x00f4, # CYRILLIC CAPITAL LETTER ZE
+ 0x0418: 0x00b8, # CYRILLIC CAPITAL LETTER I
+ 0x0419: 0x00be, # CYRILLIC CAPITAL LETTER SHORT I
+ 0x041a: 0x00c7, # CYRILLIC CAPITAL LETTER KA
+ 0x041b: 0x00d1, # CYRILLIC CAPITAL LETTER EL
+ 0x041c: 0x00d3, # CYRILLIC CAPITAL LETTER EM
+ 0x041d: 0x00d5, # CYRILLIC CAPITAL LETTER EN
+ 0x041e: 0x00d7, # CYRILLIC CAPITAL LETTER O
+ 0x041f: 0x00dd, # CYRILLIC CAPITAL LETTER PE
+ 0x0420: 0x00e2, # CYRILLIC CAPITAL LETTER ER
+ 0x0421: 0x00e4, # CYRILLIC CAPITAL LETTER ES
+ 0x0422: 0x00e6, # CYRILLIC CAPITAL LETTER TE
+ 0x0423: 0x00e8, # CYRILLIC CAPITAL LETTER U
+ 0x0424: 0x00ab, # CYRILLIC CAPITAL LETTER EF
+ 0x0425: 0x00b6, # CYRILLIC CAPITAL LETTER HA
+ 0x0426: 0x00a5, # CYRILLIC CAPITAL LETTER TSE
+ 0x0427: 0x00fc, # CYRILLIC CAPITAL LETTER CHE
+ 0x0428: 0x00f6, # CYRILLIC CAPITAL LETTER SHA
+ 0x0429: 0x00fa, # CYRILLIC CAPITAL LETTER SHCHA
+ 0x042a: 0x009f, # CYRILLIC CAPITAL LETTER HARD SIGN
+ 0x042b: 0x00f2, # CYRILLIC CAPITAL LETTER YERU
+ 0x042c: 0x00ee, # CYRILLIC CAPITAL LETTER SOFT SIGN
+ 0x042d: 0x00f8, # CYRILLIC CAPITAL LETTER E
+ 0x042e: 0x009d, # CYRILLIC CAPITAL LETTER YU
+ 0x042f: 0x00e0, # CYRILLIC CAPITAL LETTER YA
+ 0x0430: 0x00a0, # CYRILLIC SMALL LETTER A
+ 0x0431: 0x00a2, # CYRILLIC SMALL LETTER BE
+ 0x0432: 0x00eb, # CYRILLIC SMALL LETTER VE
+ 0x0433: 0x00ac, # CYRILLIC SMALL LETTER GHE
+ 0x0434: 0x00a6, # CYRILLIC SMALL LETTER DE
+ 0x0435: 0x00a8, # CYRILLIC SMALL LETTER IE
+ 0x0436: 0x00e9, # CYRILLIC SMALL LETTER ZHE
+ 0x0437: 0x00f3, # CYRILLIC SMALL LETTER ZE
+ 0x0438: 0x00b7, # CYRILLIC SMALL LETTER I
+ 0x0439: 0x00bd, # CYRILLIC SMALL LETTER SHORT I
+ 0x043a: 0x00c6, # CYRILLIC SMALL LETTER KA
+ 0x043b: 0x00d0, # CYRILLIC SMALL LETTER EL
+ 0x043c: 0x00d2, # CYRILLIC SMALL LETTER EM
+ 0x043d: 0x00d4, # CYRILLIC SMALL LETTER EN
+ 0x043e: 0x00d6, # CYRILLIC SMALL LETTER O
+ 0x043f: 0x00d8, # CYRILLIC SMALL LETTER PE
+ 0x0440: 0x00e1, # CYRILLIC SMALL LETTER ER
+ 0x0441: 0x00e3, # CYRILLIC SMALL LETTER ES
+ 0x0442: 0x00e5, # CYRILLIC SMALL LETTER TE
+ 0x0443: 0x00e7, # CYRILLIC SMALL LETTER U
+ 0x0444: 0x00aa, # CYRILLIC SMALL LETTER EF
+ 0x0445: 0x00b5, # CYRILLIC SMALL LETTER HA
+ 0x0446: 0x00a4, # CYRILLIC SMALL LETTER TSE
+ 0x0447: 0x00fb, # CYRILLIC SMALL LETTER CHE
+ 0x0448: 0x00f5, # CYRILLIC SMALL LETTER SHA
+ 0x0449: 0x00f9, # CYRILLIC SMALL LETTER SHCHA
+ 0x044a: 0x009e, # CYRILLIC SMALL LETTER HARD SIGN
+ 0x044b: 0x00f1, # CYRILLIC SMALL LETTER YERU
+ 0x044c: 0x00ed, # CYRILLIC SMALL LETTER SOFT SIGN
+ 0x044d: 0x00f7, # CYRILLIC SMALL LETTER E
+ 0x044e: 0x009c, # CYRILLIC SMALL LETTER YU
+ 0x044f: 0x00de, # CYRILLIC SMALL LETTER YA
+ 0x0451: 0x0084, # CYRILLIC SMALL LETTER IO
+ 0x0452: 0x0080, # CYRILLIC SMALL LETTER DJE
+ 0x0453: 0x0082, # CYRILLIC SMALL LETTER GJE
+ 0x0454: 0x0086, # CYRILLIC SMALL LETTER UKRAINIAN IE
+ 0x0455: 0x0088, # CYRILLIC SMALL LETTER DZE
+ 0x0456: 0x008a, # CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
+ 0x0457: 0x008c, # CYRILLIC SMALL LETTER YI
+ 0x0458: 0x008e, # CYRILLIC SMALL LETTER JE
+ 0x0459: 0x0090, # CYRILLIC SMALL LETTER LJE
+ 0x045a: 0x0092, # CYRILLIC SMALL LETTER NJE
+ 0x045b: 0x0094, # CYRILLIC SMALL LETTER TSHE
+ 0x045c: 0x0096, # CYRILLIC SMALL LETTER KJE
+ 0x045e: 0x0098, # CYRILLIC SMALL LETTER SHORT U
+ 0x045f: 0x009a, # CYRILLIC SMALL LETTER DZHE
+ 0x2116: 0x00ef, # NUMERO SIGN
+ 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL
+ 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x2580: 0x00df, # UPPER HALF BLOCK
+ 0x2584: 0x00dc, # LOWER HALF BLOCK
+ 0x2588: 0x00db, # FULL BLOCK
+ 0x2591: 0x00b0, # LIGHT SHADE
+ 0x2592: 0x00b1, # MEDIUM SHADE
+ 0x2593: 0x00b2, # DARK SHADE
+ 0x25a0: 0x00fe, # BLACK SQUARE
+}
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
index 0000000000..e26af0bbfe
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp856.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp856 generated from 'MAPPINGS/VENDORS/MISC/CP856.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp856',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\u05d0' # 0x80 -> HEBREW LETTER ALEF
+ u'\u05d1' # 0x81 -> HEBREW LETTER BET
+ u'\u05d2' # 0x82 -> HEBREW LETTER GIMEL
+ u'\u05d3' # 0x83 -> HEBREW LETTER DALET
+ u'\u05d4' # 0x84 -> HEBREW LETTER HE
+ u'\u05d5' # 0x85 -> HEBREW LETTER VAV
+ u'\u05d6' # 0x86 -> HEBREW LETTER ZAYIN
+ u'\u05d7' # 0x87 -> HEBREW LETTER HET
+ u'\u05d8' # 0x88 -> HEBREW LETTER TET
+ u'\u05d9' # 0x89 -> HEBREW LETTER YOD
+ u'\u05da' # 0x8A -> HEBREW LETTER FINAL KAF
+ u'\u05db' # 0x8B -> HEBREW LETTER KAF
+ u'\u05dc' # 0x8C -> HEBREW LETTER LAMED
+ u'\u05dd' # 0x8D -> HEBREW LETTER FINAL MEM
+ u'\u05de' # 0x8E -> HEBREW LETTER MEM
+ u'\u05df' # 0x8F -> HEBREW LETTER FINAL NUN
+ u'\u05e0' # 0x90 -> HEBREW LETTER NUN
+ u'\u05e1' # 0x91 -> HEBREW LETTER SAMEKH
+ u'\u05e2' # 0x92 -> HEBREW LETTER AYIN
+ u'\u05e3' # 0x93 -> HEBREW LETTER FINAL PE
+ u'\u05e4' # 0x94 -> HEBREW LETTER PE
+ u'\u05e5' # 0x95 -> HEBREW LETTER FINAL TSADI
+ u'\u05e6' # 0x96 -> HEBREW LETTER TSADI
+ u'\u05e7' # 0x97 -> HEBREW LETTER QOF
+ u'\u05e8' # 0x98 -> HEBREW LETTER RESH
+ u'\u05e9' # 0x99 -> HEBREW LETTER SHIN
+ u'\u05ea' # 0x9A -> HEBREW LETTER TAV
+ u'\ufffe' # 0x9B -> UNDEFINED
+ u'\xa3' # 0x9C -> POUND SIGN
+ u'\ufffe' # 0x9D -> UNDEFINED
+ u'\xd7' # 0x9E -> MULTIPLICATION SIGN
+ u'\ufffe' # 0x9F -> UNDEFINED
+ u'\ufffe' # 0xA0 -> UNDEFINED
+ u'\ufffe' # 0xA1 -> UNDEFINED
+ u'\ufffe' # 0xA2 -> UNDEFINED
+ u'\ufffe' # 0xA3 -> UNDEFINED
+ u'\ufffe' # 0xA4 -> UNDEFINED
+ u'\ufffe' # 0xA5 -> UNDEFINED
+ u'\ufffe' # 0xA6 -> UNDEFINED
+ u'\ufffe' # 0xA7 -> UNDEFINED
+ u'\ufffe' # 0xA8 -> UNDEFINED
+ u'\xae' # 0xA9 -> REGISTERED SIGN
+ u'\xac' # 0xAA -> NOT SIGN
+ u'\xbd' # 0xAB -> VULGAR FRACTION ONE HALF
+ u'\xbc' # 0xAC -> VULGAR FRACTION ONE QUARTER
+ u'\ufffe' # 0xAD -> UNDEFINED
+ u'\xab' # 0xAE -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0xAF -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2591' # 0xB0 -> LIGHT SHADE
+ u'\u2592' # 0xB1 -> MEDIUM SHADE
+ u'\u2593' # 0xB2 -> DARK SHADE
+ u'\u2502' # 0xB3 -> BOX DRAWINGS LIGHT VERTICAL
+ u'\u2524' # 0xB4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ u'\ufffe' # 0xB5 -> UNDEFINED
+ u'\ufffe' # 0xB6 -> UNDEFINED
+ u'\ufffe' # 0xB7 -> UNDEFINED
+ u'\xa9' # 0xB8 -> COPYRIGHT SIGN
+ u'\u2563' # 0xB9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ u'\u2551' # 0xBA -> BOX DRAWINGS DOUBLE VERTICAL
+ u'\u2557' # 0xBB -> BOX DRAWINGS DOUBLE DOWN AND LEFT
+ u'\u255d' # 0xBC -> BOX DRAWINGS DOUBLE UP AND LEFT
+ u'\xa2' # 0xBD -> CENT SIGN
+ u'\xa5' # 0xBE -> YEN SIGN
+ u'\u2510' # 0xBF -> BOX DRAWINGS LIGHT DOWN AND LEFT
+ u'\u2514' # 0xC0 -> BOX DRAWINGS LIGHT UP AND RIGHT
+ u'\u2534' # 0xC1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ u'\u252c' # 0xC2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ u'\u251c' # 0xC3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ u'\u2500' # 0xC4 -> BOX DRAWINGS LIGHT HORIZONTAL
+ u'\u253c' # 0xC5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ u'\ufffe' # 0xC6 -> UNDEFINED
+ u'\ufffe' # 0xC7 -> UNDEFINED
+ u'\u255a' # 0xC8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
+ u'\u2554' # 0xC9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ u'\u2569' # 0xCA -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ u'\u2566' # 0xCB -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ u'\u2560' # 0xCC -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ u'\u2550' # 0xCD -> BOX DRAWINGS DOUBLE HORIZONTAL
+ u'\u256c' # 0xCE -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ u'\xa4' # 0xCF -> CURRENCY SIGN
+ u'\ufffe' # 0xD0 -> UNDEFINED
+ u'\ufffe' # 0xD1 -> UNDEFINED
+ u'\ufffe' # 0xD2 -> UNDEFINED
+ u'\ufffe' # 0xD3 -> UNDEFINEDS
+ u'\ufffe' # 0xD4 -> UNDEFINED
+ u'\ufffe' # 0xD5 -> UNDEFINED
+ u'\ufffe' # 0xD6 -> UNDEFINEDE
+ u'\ufffe' # 0xD7 -> UNDEFINED
+ u'\ufffe' # 0xD8 -> UNDEFINED
+ u'\u2518' # 0xD9 -> BOX DRAWINGS LIGHT UP AND LEFT
+ u'\u250c' # 0xDA -> BOX DRAWINGS LIGHT DOWN AND RIGHT
+ u'\u2588' # 0xDB -> FULL BLOCK
+ u'\u2584' # 0xDC -> LOWER HALF BLOCK
+ u'\xa6' # 0xDD -> BROKEN BAR
+ u'\ufffe' # 0xDE -> UNDEFINED
+ u'\u2580' # 0xDF -> UPPER HALF BLOCK
+ u'\ufffe' # 0xE0 -> UNDEFINED
+ u'\ufffe' # 0xE1 -> UNDEFINED
+ u'\ufffe' # 0xE2 -> UNDEFINED
+ u'\ufffe' # 0xE3 -> UNDEFINED
+ u'\ufffe' # 0xE4 -> UNDEFINED
+ u'\ufffe' # 0xE5 -> UNDEFINED
+ u'\xb5' # 0xE6 -> MICRO SIGN
+ u'\ufffe' # 0xE7 -> UNDEFINED
+ u'\ufffe' # 0xE8 -> UNDEFINED
+ u'\ufffe' # 0xE9 -> UNDEFINED
+ u'\ufffe' # 0xEA -> UNDEFINED
+ u'\ufffe' # 0xEB -> UNDEFINED
+ u'\ufffe' # 0xEC -> UNDEFINED
+ u'\ufffe' # 0xED -> UNDEFINED
+ u'\xaf' # 0xEE -> MACRON
+ u'\xb4' # 0xEF -> ACUTE ACCENT
+ u'\xad' # 0xF0 -> SOFT HYPHEN
+ u'\xb1' # 0xF1 -> PLUS-MINUS SIGN
+ u'\u2017' # 0xF2 -> DOUBLE LOW LINE
+ u'\xbe' # 0xF3 -> VULGAR FRACTION THREE QUARTERS
+ u'\xb6' # 0xF4 -> PILCROW SIGN
+ u'\xa7' # 0xF5 -> SECTION SIGN
+ u'\xf7' # 0xF6 -> DIVISION SIGN
+ u'\xb8' # 0xF7 -> CEDILLA
+ u'\xb0' # 0xF8 -> DEGREE SIGN
+ u'\xa8' # 0xF9 -> DIAERESIS
+ u'\xb7' # 0xFA -> MIDDLE DOT
+ u'\xb9' # 0xFB -> SUPERSCRIPT ONE
+ u'\xb3' # 0xFC -> SUPERSCRIPT THREE
+ u'\xb2' # 0xFD -> SUPERSCRIPT TWO
+ u'\u25a0' # 0xFE -> BLACK SQUARE
+ u'\xa0' # 0xFF -> NO-BREAK SPACE
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..d337e5be1a
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp857.py
@@ -0,0 +1,694 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP857.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp857',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE
+ 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE
+ 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE
+ 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX
+ 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS
+ 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE
+ 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS
+ 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX
+ 0x008d: 0x0131, # LATIN SMALL LETTER DOTLESS I
+ 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE
+ 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE
+ 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE
+ 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE
+ 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX
+ 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE
+ 0x0098: 0x0130, # LATIN CAPITAL LETTER I WITH DOT ABOVE
+ 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE
+ 0x009c: 0x00a3, # POUND SIGN
+ 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE
+ 0x009e: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA
+ 0x009f: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA
+ 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE
+ 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE
+ 0x00a6: 0x011e, # LATIN CAPITAL LETTER G WITH BREVE
+ 0x00a7: 0x011f, # LATIN SMALL LETTER G WITH BREVE
+ 0x00a8: 0x00bf, # INVERTED QUESTION MARK
+ 0x00a9: 0x00ae, # REGISTERED SIGN
+ 0x00aa: 0x00ac, # NOT SIGN
+ 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF
+ 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER
+ 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK
+ 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00b0: 0x2591, # LIGHT SHADE
+ 0x00b1: 0x2592, # MEDIUM SHADE
+ 0x00b2: 0x2593, # DARK SHADE
+ 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL
+ 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x00b5: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE
+ 0x00b6: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ 0x00b7: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE
+ 0x00b8: 0x00a9, # COPYRIGHT SIGN
+ 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x00bd: 0x00a2, # CENT SIGN
+ 0x00be: 0x00a5, # YEN SIGN
+ 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x00c6: 0x00e3, # LATIN SMALL LETTER A WITH TILDE
+ 0x00c7: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE
+ 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x00cf: 0x00a4, # CURRENCY SIGN
+ 0x00d0: 0x00ba, # MASCULINE ORDINAL INDICATOR
+ 0x00d1: 0x00aa, # FEMININE ORDINAL INDICATOR
+ 0x00d2: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ 0x00d3: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS
+ 0x00d4: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE
+ 0x00d5: None, # UNDEFINED
+ 0x00d6: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE
+ 0x00d7: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ 0x00d8: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS
+ 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x00db: 0x2588, # FULL BLOCK
+ 0x00dc: 0x2584, # LOWER HALF BLOCK
+ 0x00dd: 0x00a6, # BROKEN BAR
+ 0x00de: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE
+ 0x00df: 0x2580, # UPPER HALF BLOCK
+ 0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE
+ 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S
+ 0x00e2: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ 0x00e3: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE
+ 0x00e4: 0x00f5, # LATIN SMALL LETTER O WITH TILDE
+ 0x00e5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE
+ 0x00e6: 0x00b5, # MICRO SIGN
+ 0x00e7: None, # UNDEFINED
+ 0x00e8: 0x00d7, # MULTIPLICATION SIGN
+ 0x00e9: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE
+ 0x00ea: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ 0x00eb: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE
+ 0x00ed: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS
+ 0x00ee: 0x00af, # MACRON
+ 0x00ef: 0x00b4, # ACUTE ACCENT
+ 0x00f0: 0x00ad, # SOFT HYPHEN
+ 0x00f1: 0x00b1, # PLUS-MINUS SIGN
+ 0x00f2: None, # UNDEFINED
+ 0x00f3: 0x00be, # VULGAR FRACTION THREE QUARTERS
+ 0x00f4: 0x00b6, # PILCROW SIGN
+ 0x00f5: 0x00a7, # SECTION SIGN
+ 0x00f6: 0x00f7, # DIVISION SIGN
+ 0x00f7: 0x00b8, # CEDILLA
+ 0x00f8: 0x00b0, # DEGREE SIGN
+ 0x00f9: 0x00a8, # DIAERESIS
+ 0x00fa: 0x00b7, # MIDDLE DOT
+ 0x00fb: 0x00b9, # SUPERSCRIPT ONE
+ 0x00fc: 0x00b3, # SUPERSCRIPT THREE
+ 0x00fd: 0x00b2, # SUPERSCRIPT TWO
+ 0x00fe: 0x25a0, # BLACK SQUARE
+ 0x00ff: 0x00a0, # NO-BREAK SPACE
+})
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x0000 -> NULL
+ u'\x01' # 0x0001 -> START OF HEADING
+ u'\x02' # 0x0002 -> START OF TEXT
+ u'\x03' # 0x0003 -> END OF TEXT
+ u'\x04' # 0x0004 -> END OF TRANSMISSION
+ u'\x05' # 0x0005 -> ENQUIRY
+ u'\x06' # 0x0006 -> ACKNOWLEDGE
+ u'\x07' # 0x0007 -> BELL
+ u'\x08' # 0x0008 -> BACKSPACE
+ u'\t' # 0x0009 -> HORIZONTAL TABULATION
+ u'\n' # 0x000a -> LINE FEED
+ u'\x0b' # 0x000b -> VERTICAL TABULATION
+ u'\x0c' # 0x000c -> FORM FEED
+ u'\r' # 0x000d -> CARRIAGE RETURN
+ u'\x0e' # 0x000e -> SHIFT OUT
+ u'\x0f' # 0x000f -> SHIFT IN
+ u'\x10' # 0x0010 -> DATA LINK ESCAPE
+ u'\x11' # 0x0011 -> DEVICE CONTROL ONE
+ u'\x12' # 0x0012 -> DEVICE CONTROL TWO
+ u'\x13' # 0x0013 -> DEVICE CONTROL THREE
+ u'\x14' # 0x0014 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x0016 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x0018 -> CANCEL
+ u'\x19' # 0x0019 -> END OF MEDIUM
+ u'\x1a' # 0x001a -> SUBSTITUTE
+ u'\x1b' # 0x001b -> ESCAPE
+ u'\x1c' # 0x001c -> FILE SEPARATOR
+ u'\x1d' # 0x001d -> GROUP SEPARATOR
+ u'\x1e' # 0x001e -> RECORD SEPARATOR
+ u'\x1f' # 0x001f -> UNIT SEPARATOR
+ u' ' # 0x0020 -> SPACE
+ u'!' # 0x0021 -> EXCLAMATION MARK
+ u'"' # 0x0022 -> QUOTATION MARK
+ u'#' # 0x0023 -> NUMBER SIGN
+ u'$' # 0x0024 -> DOLLAR SIGN
+ u'%' # 0x0025 -> PERCENT SIGN
+ u'&' # 0x0026 -> AMPERSAND
+ u"'" # 0x0027 -> APOSTROPHE
+ u'(' # 0x0028 -> LEFT PARENTHESIS
+ u')' # 0x0029 -> RIGHT PARENTHESIS
+ u'*' # 0x002a -> ASTERISK
+ u'+' # 0x002b -> PLUS SIGN
+ u',' # 0x002c -> COMMA
+ u'-' # 0x002d -> HYPHEN-MINUS
+ u'.' # 0x002e -> FULL STOP
+ u'/' # 0x002f -> SOLIDUS
+ u'0' # 0x0030 -> DIGIT ZERO
+ u'1' # 0x0031 -> DIGIT ONE
+ u'2' # 0x0032 -> DIGIT TWO
+ u'3' # 0x0033 -> DIGIT THREE
+ u'4' # 0x0034 -> DIGIT FOUR
+ u'5' # 0x0035 -> DIGIT FIVE
+ u'6' # 0x0036 -> DIGIT SIX
+ u'7' # 0x0037 -> DIGIT SEVEN
+ u'8' # 0x0038 -> DIGIT EIGHT
+ u'9' # 0x0039 -> DIGIT NINE
+ u':' # 0x003a -> COLON
+ u';' # 0x003b -> SEMICOLON
+ u'<' # 0x003c -> LESS-THAN SIGN
+ u'=' # 0x003d -> EQUALS SIGN
+ u'>' # 0x003e -> GREATER-THAN SIGN
+ u'?' # 0x003f -> QUESTION MARK
+ u'@' # 0x0040 -> COMMERCIAL AT
+ u'A' # 0x0041 -> LATIN CAPITAL LETTER A
+ u'B' # 0x0042 -> LATIN CAPITAL LETTER B
+ u'C' # 0x0043 -> LATIN CAPITAL LETTER C
+ u'D' # 0x0044 -> LATIN CAPITAL LETTER D
+ u'E' # 0x0045 -> LATIN CAPITAL LETTER E
+ u'F' # 0x0046 -> LATIN CAPITAL LETTER F
+ u'G' # 0x0047 -> LATIN CAPITAL LETTER G
+ u'H' # 0x0048 -> LATIN CAPITAL LETTER H
+ u'I' # 0x0049 -> LATIN CAPITAL LETTER I
+ u'J' # 0x004a -> LATIN CAPITAL LETTER J
+ u'K' # 0x004b -> LATIN CAPITAL LETTER K
+ u'L' # 0x004c -> LATIN CAPITAL LETTER L
+ u'M' # 0x004d -> LATIN CAPITAL LETTER M
+ u'N' # 0x004e -> LATIN CAPITAL LETTER N
+ u'O' # 0x004f -> LATIN CAPITAL LETTER O
+ u'P' # 0x0050 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x0052 -> LATIN CAPITAL LETTER R
+ u'S' # 0x0053 -> LATIN CAPITAL LETTER S
+ u'T' # 0x0054 -> LATIN CAPITAL LETTER T
+ u'U' # 0x0055 -> LATIN CAPITAL LETTER U
+ u'V' # 0x0056 -> LATIN CAPITAL LETTER V
+ u'W' # 0x0057 -> LATIN CAPITAL LETTER W
+ u'X' # 0x0058 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x005a -> LATIN CAPITAL LETTER Z
+ u'[' # 0x005b -> LEFT SQUARE BRACKET
+ u'\\' # 0x005c -> REVERSE SOLIDUS
+ u']' # 0x005d -> RIGHT SQUARE BRACKET
+ u'^' # 0x005e -> CIRCUMFLEX ACCENT
+ u'_' # 0x005f -> LOW LINE
+ u'`' # 0x0060 -> GRAVE ACCENT
+ u'a' # 0x0061 -> LATIN SMALL LETTER A
+ u'b' # 0x0062 -> LATIN SMALL LETTER B
+ u'c' # 0x0063 -> LATIN SMALL LETTER C
+ u'd' # 0x0064 -> LATIN SMALL LETTER D
+ u'e' # 0x0065 -> LATIN SMALL LETTER E
+ u'f' # 0x0066 -> LATIN SMALL LETTER F
+ u'g' # 0x0067 -> LATIN SMALL LETTER G
+ u'h' # 0x0068 -> LATIN SMALL LETTER H
+ u'i' # 0x0069 -> LATIN SMALL LETTER I
+ u'j' # 0x006a -> LATIN SMALL LETTER J
+ u'k' # 0x006b -> LATIN SMALL LETTER K
+ u'l' # 0x006c -> LATIN SMALL LETTER L
+ u'm' # 0x006d -> LATIN SMALL LETTER M
+ u'n' # 0x006e -> LATIN SMALL LETTER N
+ u'o' # 0x006f -> LATIN SMALL LETTER O
+ u'p' # 0x0070 -> LATIN SMALL LETTER P
+ u'q' # 0x0071 -> LATIN SMALL LETTER Q
+ u'r' # 0x0072 -> LATIN SMALL LETTER R
+ u's' # 0x0073 -> LATIN SMALL LETTER S
+ u't' # 0x0074 -> LATIN SMALL LETTER T
+ u'u' # 0x0075 -> LATIN SMALL LETTER U
+ u'v' # 0x0076 -> LATIN SMALL LETTER V
+ u'w' # 0x0077 -> LATIN SMALL LETTER W
+ u'x' # 0x0078 -> LATIN SMALL LETTER X
+ u'y' # 0x0079 -> LATIN SMALL LETTER Y
+ u'z' # 0x007a -> LATIN SMALL LETTER Z
+ u'{' # 0x007b -> LEFT CURLY BRACKET
+ u'|' # 0x007c -> VERTICAL LINE
+ u'}' # 0x007d -> RIGHT CURLY BRACKET
+ u'~' # 0x007e -> TILDE
+ u'\x7f' # 0x007f -> DELETE
+ u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\u0131' # 0x008d -> LATIN SMALL LETTER DOTLESS I
+ u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE
+ u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE
+ u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE
+ u'\u0130' # 0x0098 -> LATIN CAPITAL LETTER I WITH DOT ABOVE
+ u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE
+ u'\xa3' # 0x009c -> POUND SIGN
+ u'\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\u015e' # 0x009e -> LATIN CAPITAL LETTER S WITH CEDILLA
+ u'\u015f' # 0x009f -> LATIN SMALL LETTER S WITH CEDILLA
+ u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\u011e' # 0x00a6 -> LATIN CAPITAL LETTER G WITH BREVE
+ u'\u011f' # 0x00a7 -> LATIN SMALL LETTER G WITH BREVE
+ u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK
+ u'\xae' # 0x00a9 -> REGISTERED SIGN
+ u'\xac' # 0x00aa -> NOT SIGN
+ u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF
+ u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER
+ u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK
+ u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2591' # 0x00b0 -> LIGHT SHADE
+ u'\u2592' # 0x00b1 -> MEDIUM SHADE
+ u'\u2593' # 0x00b2 -> DARK SHADE
+ u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL
+ u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ u'\xc1' # 0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc2' # 0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xc0' # 0x00b7 -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xa9' # 0x00b8 -> COPYRIGHT SIGN
+ u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL
+ u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT
+ u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT
+ u'\xa2' # 0x00bd -> CENT SIGN
+ u'\xa5' # 0x00be -> YEN SIGN
+ u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT
+ u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT
+ u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL
+ u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ u'\xe3' # 0x00c6 -> LATIN SMALL LETTER A WITH TILDE
+ u'\xc3' # 0x00c7 -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
+ u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL
+ u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ u'\xa4' # 0x00cf -> CURRENCY SIGN
+ u'\xba' # 0x00d0 -> MASCULINE ORDINAL INDICATOR
+ u'\xaa' # 0x00d1 -> FEMININE ORDINAL INDICATOR
+ u'\xca' # 0x00d2 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xcb' # 0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xc8' # 0x00d4 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\ufffe' # 0x00d5 -> UNDEFINED
+ u'\xcd' # 0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0x00d8 -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT
+ u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT
+ u'\u2588' # 0x00db -> FULL BLOCK
+ u'\u2584' # 0x00dc -> LOWER HALF BLOCK
+ u'\xa6' # 0x00dd -> BROKEN BAR
+ u'\xcc' # 0x00de -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'\u2580' # 0x00df -> UPPER HALF BLOCK
+ u'\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S
+ u'\xd4' # 0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\xd2' # 0x00e3 -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xf5' # 0x00e4 -> LATIN SMALL LETTER O WITH TILDE
+ u'\xd5' # 0x00e5 -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\xb5' # 0x00e6 -> MICRO SIGN
+ u'\ufffe' # 0x00e7 -> UNDEFINED
+ u'\xd7' # 0x00e8 -> MULTIPLICATION SIGN
+ u'\xda' # 0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xdb' # 0x00ea -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xd9' # 0x00eb -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\xec' # 0x00ec -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xff' # 0x00ed -> LATIN SMALL LETTER Y WITH DIAERESIS
+ u'\xaf' # 0x00ee -> MACRON
+ u'\xb4' # 0x00ef -> ACUTE ACCENT
+ u'\xad' # 0x00f0 -> SOFT HYPHEN
+ u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN
+ u'\ufffe' # 0x00f2 -> UNDEFINED
+ u'\xbe' # 0x00f3 -> VULGAR FRACTION THREE QUARTERS
+ u'\xb6' # 0x00f4 -> PILCROW SIGN
+ u'\xa7' # 0x00f5 -> SECTION SIGN
+ u'\xf7' # 0x00f6 -> DIVISION SIGN
+ u'\xb8' # 0x00f7 -> CEDILLA
+ u'\xb0' # 0x00f8 -> DEGREE SIGN
+ u'\xa8' # 0x00f9 -> DIAERESIS
+ u'\xb7' # 0x00fa -> MIDDLE DOT
+ u'\xb9' # 0x00fb -> SUPERSCRIPT ONE
+ u'\xb3' # 0x00fc -> SUPERSCRIPT THREE
+ u'\xb2' # 0x00fd -> SUPERSCRIPT TWO
+ u'\u25a0' # 0x00fe -> BLACK SQUARE
+ u'\xa0' # 0x00ff -> NO-BREAK SPACE
+)
+
+### Encoding Map
+
+encoding_map = {
+ 0x0000: 0x0000, # NULL
+ 0x0001: 0x0001, # START OF HEADING
+ 0x0002: 0x0002, # START OF TEXT
+ 0x0003: 0x0003, # END OF TEXT
+ 0x0004: 0x0004, # END OF TRANSMISSION
+ 0x0005: 0x0005, # ENQUIRY
+ 0x0006: 0x0006, # ACKNOWLEDGE
+ 0x0007: 0x0007, # BELL
+ 0x0008: 0x0008, # BACKSPACE
+ 0x0009: 0x0009, # HORIZONTAL TABULATION
+ 0x000a: 0x000a, # LINE FEED
+ 0x000b: 0x000b, # VERTICAL TABULATION
+ 0x000c: 0x000c, # FORM FEED
+ 0x000d: 0x000d, # CARRIAGE RETURN
+ 0x000e: 0x000e, # SHIFT OUT
+ 0x000f: 0x000f, # SHIFT IN
+ 0x0010: 0x0010, # DATA LINK ESCAPE
+ 0x0011: 0x0011, # DEVICE CONTROL ONE
+ 0x0012: 0x0012, # DEVICE CONTROL TWO
+ 0x0013: 0x0013, # DEVICE CONTROL THREE
+ 0x0014: 0x0014, # DEVICE CONTROL FOUR
+ 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE
+ 0x0016: 0x0016, # SYNCHRONOUS IDLE
+ 0x0017: 0x0017, # END OF TRANSMISSION BLOCK
+ 0x0018: 0x0018, # CANCEL
+ 0x0019: 0x0019, # END OF MEDIUM
+ 0x001a: 0x001a, # SUBSTITUTE
+ 0x001b: 0x001b, # ESCAPE
+ 0x001c: 0x001c, # FILE SEPARATOR
+ 0x001d: 0x001d, # GROUP SEPARATOR
+ 0x001e: 0x001e, # RECORD SEPARATOR
+ 0x001f: 0x001f, # UNIT SEPARATOR
+ 0x0020: 0x0020, # SPACE
+ 0x0021: 0x0021, # EXCLAMATION MARK
+ 0x0022: 0x0022, # QUOTATION MARK
+ 0x0023: 0x0023, # NUMBER SIGN
+ 0x0024: 0x0024, # DOLLAR SIGN
+ 0x0025: 0x0025, # PERCENT SIGN
+ 0x0026: 0x0026, # AMPERSAND
+ 0x0027: 0x0027, # APOSTROPHE
+ 0x0028: 0x0028, # LEFT PARENTHESIS
+ 0x0029: 0x0029, # RIGHT PARENTHESIS
+ 0x002a: 0x002a, # ASTERISK
+ 0x002b: 0x002b, # PLUS SIGN
+ 0x002c: 0x002c, # COMMA
+ 0x002d: 0x002d, # HYPHEN-MINUS
+ 0x002e: 0x002e, # FULL STOP
+ 0x002f: 0x002f, # SOLIDUS
+ 0x0030: 0x0030, # DIGIT ZERO
+ 0x0031: 0x0031, # DIGIT ONE
+ 0x0032: 0x0032, # DIGIT TWO
+ 0x0033: 0x0033, # DIGIT THREE
+ 0x0034: 0x0034, # DIGIT FOUR
+ 0x0035: 0x0035, # DIGIT FIVE
+ 0x0036: 0x0036, # DIGIT SIX
+ 0x0037: 0x0037, # DIGIT SEVEN
+ 0x0038: 0x0038, # DIGIT EIGHT
+ 0x0039: 0x0039, # DIGIT NINE
+ 0x003a: 0x003a, # COLON
+ 0x003b: 0x003b, # SEMICOLON
+ 0x003c: 0x003c, # LESS-THAN SIGN
+ 0x003d: 0x003d, # EQUALS SIGN
+ 0x003e: 0x003e, # GREATER-THAN SIGN
+ 0x003f: 0x003f, # QUESTION MARK
+ 0x0040: 0x0040, # COMMERCIAL AT
+ 0x0041: 0x0041, # LATIN CAPITAL LETTER A
+ 0x0042: 0x0042, # LATIN CAPITAL LETTER B
+ 0x0043: 0x0043, # LATIN CAPITAL LETTER C
+ 0x0044: 0x0044, # LATIN CAPITAL LETTER D
+ 0x0045: 0x0045, # LATIN CAPITAL LETTER E
+ 0x0046: 0x0046, # LATIN CAPITAL LETTER F
+ 0x0047: 0x0047, # LATIN CAPITAL LETTER G
+ 0x0048: 0x0048, # LATIN CAPITAL LETTER H
+ 0x0049: 0x0049, # LATIN CAPITAL LETTER I
+ 0x004a: 0x004a, # LATIN CAPITAL LETTER J
+ 0x004b: 0x004b, # LATIN CAPITAL LETTER K
+ 0x004c: 0x004c, # LATIN CAPITAL LETTER L
+ 0x004d: 0x004d, # LATIN CAPITAL LETTER M
+ 0x004e: 0x004e, # LATIN CAPITAL LETTER N
+ 0x004f: 0x004f, # LATIN CAPITAL LETTER O
+ 0x0050: 0x0050, # LATIN CAPITAL LETTER P
+ 0x0051: 0x0051, # LATIN CAPITAL LETTER Q
+ 0x0052: 0x0052, # LATIN CAPITAL LETTER R
+ 0x0053: 0x0053, # LATIN CAPITAL LETTER S
+ 0x0054: 0x0054, # LATIN CAPITAL LETTER T
+ 0x0055: 0x0055, # LATIN CAPITAL LETTER U
+ 0x0056: 0x0056, # LATIN CAPITAL LETTER V
+ 0x0057: 0x0057, # LATIN CAPITAL LETTER W
+ 0x0058: 0x0058, # LATIN CAPITAL LETTER X
+ 0x0059: 0x0059, # LATIN CAPITAL LETTER Y
+ 0x005a: 0x005a, # LATIN CAPITAL LETTER Z
+ 0x005b: 0x005b, # LEFT SQUARE BRACKET
+ 0x005c: 0x005c, # REVERSE SOLIDUS
+ 0x005d: 0x005d, # RIGHT SQUARE BRACKET
+ 0x005e: 0x005e, # CIRCUMFLEX ACCENT
+ 0x005f: 0x005f, # LOW LINE
+ 0x0060: 0x0060, # GRAVE ACCENT
+ 0x0061: 0x0061, # LATIN SMALL LETTER A
+ 0x0062: 0x0062, # LATIN SMALL LETTER B
+ 0x0063: 0x0063, # LATIN SMALL LETTER C
+ 0x0064: 0x0064, # LATIN SMALL LETTER D
+ 0x0065: 0x0065, # LATIN SMALL LETTER E
+ 0x0066: 0x0066, # LATIN SMALL LETTER F
+ 0x0067: 0x0067, # LATIN SMALL LETTER G
+ 0x0068: 0x0068, # LATIN SMALL LETTER H
+ 0x0069: 0x0069, # LATIN SMALL LETTER I
+ 0x006a: 0x006a, # LATIN SMALL LETTER J
+ 0x006b: 0x006b, # LATIN SMALL LETTER K
+ 0x006c: 0x006c, # LATIN SMALL LETTER L
+ 0x006d: 0x006d, # LATIN SMALL LETTER M
+ 0x006e: 0x006e, # LATIN SMALL LETTER N
+ 0x006f: 0x006f, # LATIN SMALL LETTER O
+ 0x0070: 0x0070, # LATIN SMALL LETTER P
+ 0x0071: 0x0071, # LATIN SMALL LETTER Q
+ 0x0072: 0x0072, # LATIN SMALL LETTER R
+ 0x0073: 0x0073, # LATIN SMALL LETTER S
+ 0x0074: 0x0074, # LATIN SMALL LETTER T
+ 0x0075: 0x0075, # LATIN SMALL LETTER U
+ 0x0076: 0x0076, # LATIN SMALL LETTER V
+ 0x0077: 0x0077, # LATIN SMALL LETTER W
+ 0x0078: 0x0078, # LATIN SMALL LETTER X
+ 0x0079: 0x0079, # LATIN SMALL LETTER Y
+ 0x007a: 0x007a, # LATIN SMALL LETTER Z
+ 0x007b: 0x007b, # LEFT CURLY BRACKET
+ 0x007c: 0x007c, # VERTICAL LINE
+ 0x007d: 0x007d, # RIGHT CURLY BRACKET
+ 0x007e: 0x007e, # TILDE
+ 0x007f: 0x007f, # DELETE
+ 0x00a0: 0x00ff, # NO-BREAK SPACE
+ 0x00a1: 0x00ad, # INVERTED EXCLAMATION MARK
+ 0x00a2: 0x00bd, # CENT SIGN
+ 0x00a3: 0x009c, # POUND SIGN
+ 0x00a4: 0x00cf, # CURRENCY SIGN
+ 0x00a5: 0x00be, # YEN SIGN
+ 0x00a6: 0x00dd, # BROKEN BAR
+ 0x00a7: 0x00f5, # SECTION SIGN
+ 0x00a8: 0x00f9, # DIAERESIS
+ 0x00a9: 0x00b8, # COPYRIGHT SIGN
+ 0x00aa: 0x00d1, # FEMININE ORDINAL INDICATOR
+ 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00ac: 0x00aa, # NOT SIGN
+ 0x00ad: 0x00f0, # SOFT HYPHEN
+ 0x00ae: 0x00a9, # REGISTERED SIGN
+ 0x00af: 0x00ee, # MACRON
+ 0x00b0: 0x00f8, # DEGREE SIGN
+ 0x00b1: 0x00f1, # PLUS-MINUS SIGN
+ 0x00b2: 0x00fd, # SUPERSCRIPT TWO
+ 0x00b3: 0x00fc, # SUPERSCRIPT THREE
+ 0x00b4: 0x00ef, # ACUTE ACCENT
+ 0x00b5: 0x00e6, # MICRO SIGN
+ 0x00b6: 0x00f4, # PILCROW SIGN
+ 0x00b7: 0x00fa, # MIDDLE DOT
+ 0x00b8: 0x00f7, # CEDILLA
+ 0x00b9: 0x00fb, # SUPERSCRIPT ONE
+ 0x00ba: 0x00d0, # MASCULINE ORDINAL INDICATOR
+ 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER
+ 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF
+ 0x00be: 0x00f3, # VULGAR FRACTION THREE QUARTERS
+ 0x00bf: 0x00a8, # INVERTED QUESTION MARK
+ 0x00c0: 0x00b7, # LATIN CAPITAL LETTER A WITH GRAVE
+ 0x00c1: 0x00b5, # LATIN CAPITAL LETTER A WITH ACUTE
+ 0x00c2: 0x00b6, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ 0x00c3: 0x00c7, # LATIN CAPITAL LETTER A WITH TILDE
+ 0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x00c5: 0x008f, # LATIN CAPITAL LETTER A WITH RING ABOVE
+ 0x00c6: 0x0092, # LATIN CAPITAL LIGATURE AE
+ 0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x00c8: 0x00d4, # LATIN CAPITAL LETTER E WITH GRAVE
+ 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x00ca: 0x00d2, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ 0x00cb: 0x00d3, # LATIN CAPITAL LETTER E WITH DIAERESIS
+ 0x00cc: 0x00de, # LATIN CAPITAL LETTER I WITH GRAVE
+ 0x00cd: 0x00d6, # LATIN CAPITAL LETTER I WITH ACUTE
+ 0x00ce: 0x00d7, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ 0x00cf: 0x00d8, # LATIN CAPITAL LETTER I WITH DIAERESIS
+ 0x00d1: 0x00a5, # LATIN CAPITAL LETTER N WITH TILDE
+ 0x00d2: 0x00e3, # LATIN CAPITAL LETTER O WITH GRAVE
+ 0x00d3: 0x00e0, # LATIN CAPITAL LETTER O WITH ACUTE
+ 0x00d4: 0x00e2, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ 0x00d5: 0x00e5, # LATIN CAPITAL LETTER O WITH TILDE
+ 0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x00d7: 0x00e8, # MULTIPLICATION SIGN
+ 0x00d8: 0x009d, # LATIN CAPITAL LETTER O WITH STROKE
+ 0x00d9: 0x00eb, # LATIN CAPITAL LETTER U WITH GRAVE
+ 0x00da: 0x00e9, # LATIN CAPITAL LETTER U WITH ACUTE
+ 0x00db: 0x00ea, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S
+ 0x00e0: 0x0085, # LATIN SMALL LETTER A WITH GRAVE
+ 0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x00e3: 0x00c6, # LATIN SMALL LETTER A WITH TILDE
+ 0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x00e5: 0x0086, # LATIN SMALL LETTER A WITH RING ABOVE
+ 0x00e6: 0x0091, # LATIN SMALL LIGATURE AE
+ 0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x00e8: 0x008a, # LATIN SMALL LETTER E WITH GRAVE
+ 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE
+ 0x00ea: 0x0088, # LATIN SMALL LETTER E WITH CIRCUMFLEX
+ 0x00eb: 0x0089, # LATIN SMALL LETTER E WITH DIAERESIS
+ 0x00ec: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE
+ 0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00ee: 0x008c, # LATIN SMALL LETTER I WITH CIRCUMFLEX
+ 0x00ef: 0x008b, # LATIN SMALL LETTER I WITH DIAERESIS
+ 0x00f1: 0x00a4, # LATIN SMALL LETTER N WITH TILDE
+ 0x00f2: 0x0095, # LATIN SMALL LETTER O WITH GRAVE
+ 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x00f5: 0x00e4, # LATIN SMALL LETTER O WITH TILDE
+ 0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x00f7: 0x00f6, # DIVISION SIGN
+ 0x00f8: 0x009b, # LATIN SMALL LETTER O WITH STROKE
+ 0x00f9: 0x0097, # LATIN SMALL LETTER U WITH GRAVE
+ 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00fb: 0x0096, # LATIN SMALL LETTER U WITH CIRCUMFLEX
+ 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x00ff: 0x00ed, # LATIN SMALL LETTER Y WITH DIAERESIS
+ 0x011e: 0x00a6, # LATIN CAPITAL LETTER G WITH BREVE
+ 0x011f: 0x00a7, # LATIN SMALL LETTER G WITH BREVE
+ 0x0130: 0x0098, # LATIN CAPITAL LETTER I WITH DOT ABOVE
+ 0x0131: 0x008d, # LATIN SMALL LETTER DOTLESS I
+ 0x015e: 0x009e, # LATIN CAPITAL LETTER S WITH CEDILLA
+ 0x015f: 0x009f, # LATIN SMALL LETTER S WITH CEDILLA
+ 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL
+ 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x2580: 0x00df, # UPPER HALF BLOCK
+ 0x2584: 0x00dc, # LOWER HALF BLOCK
+ 0x2588: 0x00db, # FULL BLOCK
+ 0x2591: 0x00b0, # LIGHT SHADE
+ 0x2592: 0x00b1, # MEDIUM SHADE
+ 0x2593: 0x00b2, # DARK SHADE
+ 0x25a0: 0x00fe, # BLACK SQUARE
+}
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
index 0000000000..427a20d7da
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp858.py
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec for CP858, modified from cp850.
+
+"""
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp858',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE
+ 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE
+ 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE
+ 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX
+ 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS
+ 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE
+ 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS
+ 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX
+ 0x008d: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE
+ 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE
+ 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE
+ 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE
+ 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE
+ 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX
+ 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE
+ 0x0098: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS
+ 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE
+ 0x009c: 0x00a3, # POUND SIGN
+ 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE
+ 0x009e: 0x00d7, # MULTIPLICATION SIGN
+ 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK
+ 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE
+ 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE
+ 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR
+ 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR
+ 0x00a8: 0x00bf, # INVERTED QUESTION MARK
+ 0x00a9: 0x00ae, # REGISTERED SIGN
+ 0x00aa: 0x00ac, # NOT SIGN
+ 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF
+ 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER
+ 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK
+ 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00b0: 0x2591, # LIGHT SHADE
+ 0x00b1: 0x2592, # MEDIUM SHADE
+ 0x00b2: 0x2593, # DARK SHADE
+ 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL
+ 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x00b5: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE
+ 0x00b6: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ 0x00b7: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE
+ 0x00b8: 0x00a9, # COPYRIGHT SIGN
+ 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x00bd: 0x00a2, # CENT SIGN
+ 0x00be: 0x00a5, # YEN SIGN
+ 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x00c6: 0x00e3, # LATIN SMALL LETTER A WITH TILDE
+ 0x00c7: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE
+ 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x00cf: 0x00a4, # CURRENCY SIGN
+ 0x00d0: 0x00f0, # LATIN SMALL LETTER ETH
+ 0x00d1: 0x00d0, # LATIN CAPITAL LETTER ETH
+ 0x00d2: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ 0x00d3: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS
+ 0x00d4: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE
+ 0x00d5: 0x20ac, # EURO SIGN
+ 0x00d6: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE
+ 0x00d7: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ 0x00d8: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS
+ 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x00db: 0x2588, # FULL BLOCK
+ 0x00dc: 0x2584, # LOWER HALF BLOCK
+ 0x00dd: 0x00a6, # BROKEN BAR
+ 0x00de: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE
+ 0x00df: 0x2580, # UPPER HALF BLOCK
+ 0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE
+ 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S
+ 0x00e2: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ 0x00e3: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE
+ 0x00e4: 0x00f5, # LATIN SMALL LETTER O WITH TILDE
+ 0x00e5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE
+ 0x00e6: 0x00b5, # MICRO SIGN
+ 0x00e7: 0x00fe, # LATIN SMALL LETTER THORN
+ 0x00e8: 0x00de, # LATIN CAPITAL LETTER THORN
+ 0x00e9: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE
+ 0x00ea: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ 0x00eb: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE
+ 0x00ec: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE
+ 0x00ed: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE
+ 0x00ee: 0x00af, # MACRON
+ 0x00ef: 0x00b4, # ACUTE ACCENT
+ 0x00f0: 0x00ad, # SOFT HYPHEN
+ 0x00f1: 0x00b1, # PLUS-MINUS SIGN
+ 0x00f2: 0x2017, # DOUBLE LOW LINE
+ 0x00f3: 0x00be, # VULGAR FRACTION THREE QUARTERS
+ 0x00f4: 0x00b6, # PILCROW SIGN
+ 0x00f5: 0x00a7, # SECTION SIGN
+ 0x00f6: 0x00f7, # DIVISION SIGN
+ 0x00f7: 0x00b8, # CEDILLA
+ 0x00f8: 0x00b0, # DEGREE SIGN
+ 0x00f9: 0x00a8, # DIAERESIS
+ 0x00fa: 0x00b7, # MIDDLE DOT
+ 0x00fb: 0x00b9, # SUPERSCRIPT ONE
+ 0x00fc: 0x00b3, # SUPERSCRIPT THREE
+ 0x00fd: 0x00b2, # SUPERSCRIPT TWO
+ 0x00fe: 0x25a0, # BLACK SQUARE
+ 0x00ff: 0x00a0, # NO-BREAK SPACE
+})
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x0000 -> NULL
+ u'\x01' # 0x0001 -> START OF HEADING
+ u'\x02' # 0x0002 -> START OF TEXT
+ u'\x03' # 0x0003 -> END OF TEXT
+ u'\x04' # 0x0004 -> END OF TRANSMISSION
+ u'\x05' # 0x0005 -> ENQUIRY
+ u'\x06' # 0x0006 -> ACKNOWLEDGE
+ u'\x07' # 0x0007 -> BELL
+ u'\x08' # 0x0008 -> BACKSPACE
+ u'\t' # 0x0009 -> HORIZONTAL TABULATION
+ u'\n' # 0x000a -> LINE FEED
+ u'\x0b' # 0x000b -> VERTICAL TABULATION
+ u'\x0c' # 0x000c -> FORM FEED
+ u'\r' # 0x000d -> CARRIAGE RETURN
+ u'\x0e' # 0x000e -> SHIFT OUT
+ u'\x0f' # 0x000f -> SHIFT IN
+ u'\x10' # 0x0010 -> DATA LINK ESCAPE
+ u'\x11' # 0x0011 -> DEVICE CONTROL ONE
+ u'\x12' # 0x0012 -> DEVICE CONTROL TWO
+ u'\x13' # 0x0013 -> DEVICE CONTROL THREE
+ u'\x14' # 0x0014 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x0016 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x0018 -> CANCEL
+ u'\x19' # 0x0019 -> END OF MEDIUM
+ u'\x1a' # 0x001a -> SUBSTITUTE
+ u'\x1b' # 0x001b -> ESCAPE
+ u'\x1c' # 0x001c -> FILE SEPARATOR
+ u'\x1d' # 0x001d -> GROUP SEPARATOR
+ u'\x1e' # 0x001e -> RECORD SEPARATOR
+ u'\x1f' # 0x001f -> UNIT SEPARATOR
+ u' ' # 0x0020 -> SPACE
+ u'!' # 0x0021 -> EXCLAMATION MARK
+ u'"' # 0x0022 -> QUOTATION MARK
+ u'#' # 0x0023 -> NUMBER SIGN
+ u'$' # 0x0024 -> DOLLAR SIGN
+ u'%' # 0x0025 -> PERCENT SIGN
+ u'&' # 0x0026 -> AMPERSAND
+ u"'" # 0x0027 -> APOSTROPHE
+ u'(' # 0x0028 -> LEFT PARENTHESIS
+ u')' # 0x0029 -> RIGHT PARENTHESIS
+ u'*' # 0x002a -> ASTERISK
+ u'+' # 0x002b -> PLUS SIGN
+ u',' # 0x002c -> COMMA
+ u'-' # 0x002d -> HYPHEN-MINUS
+ u'.' # 0x002e -> FULL STOP
+ u'/' # 0x002f -> SOLIDUS
+ u'0' # 0x0030 -> DIGIT ZERO
+ u'1' # 0x0031 -> DIGIT ONE
+ u'2' # 0x0032 -> DIGIT TWO
+ u'3' # 0x0033 -> DIGIT THREE
+ u'4' # 0x0034 -> DIGIT FOUR
+ u'5' # 0x0035 -> DIGIT FIVE
+ u'6' # 0x0036 -> DIGIT SIX
+ u'7' # 0x0037 -> DIGIT SEVEN
+ u'8' # 0x0038 -> DIGIT EIGHT
+ u'9' # 0x0039 -> DIGIT NINE
+ u':' # 0x003a -> COLON
+ u';' # 0x003b -> SEMICOLON
+ u'<' # 0x003c -> LESS-THAN SIGN
+ u'=' # 0x003d -> EQUALS SIGN
+ u'>' # 0x003e -> GREATER-THAN SIGN
+ u'?' # 0x003f -> QUESTION MARK
+ u'@' # 0x0040 -> COMMERCIAL AT
+ u'A' # 0x0041 -> LATIN CAPITAL LETTER A
+ u'B' # 0x0042 -> LATIN CAPITAL LETTER B
+ u'C' # 0x0043 -> LATIN CAPITAL LETTER C
+ u'D' # 0x0044 -> LATIN CAPITAL LETTER D
+ u'E' # 0x0045 -> LATIN CAPITAL LETTER E
+ u'F' # 0x0046 -> LATIN CAPITAL LETTER F
+ u'G' # 0x0047 -> LATIN CAPITAL LETTER G
+ u'H' # 0x0048 -> LATIN CAPITAL LETTER H
+ u'I' # 0x0049 -> LATIN CAPITAL LETTER I
+ u'J' # 0x004a -> LATIN CAPITAL LETTER J
+ u'K' # 0x004b -> LATIN CAPITAL LETTER K
+ u'L' # 0x004c -> LATIN CAPITAL LETTER L
+ u'M' # 0x004d -> LATIN CAPITAL LETTER M
+ u'N' # 0x004e -> LATIN CAPITAL LETTER N
+ u'O' # 0x004f -> LATIN CAPITAL LETTER O
+ u'P' # 0x0050 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x0052 -> LATIN CAPITAL LETTER R
+ u'S' # 0x0053 -> LATIN CAPITAL LETTER S
+ u'T' # 0x0054 -> LATIN CAPITAL LETTER T
+ u'U' # 0x0055 -> LATIN CAPITAL LETTER U
+ u'V' # 0x0056 -> LATIN CAPITAL LETTER V
+ u'W' # 0x0057 -> LATIN CAPITAL LETTER W
+ u'X' # 0x0058 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x005a -> LATIN CAPITAL LETTER Z
+ u'[' # 0x005b -> LEFT SQUARE BRACKET
+ u'\\' # 0x005c -> REVERSE SOLIDUS
+ u']' # 0x005d -> RIGHT SQUARE BRACKET
+ u'^' # 0x005e -> CIRCUMFLEX ACCENT
+ u'_' # 0x005f -> LOW LINE
+ u'`' # 0x0060 -> GRAVE ACCENT
+ u'a' # 0x0061 -> LATIN SMALL LETTER A
+ u'b' # 0x0062 -> LATIN SMALL LETTER B
+ u'c' # 0x0063 -> LATIN SMALL LETTER C
+ u'd' # 0x0064 -> LATIN SMALL LETTER D
+ u'e' # 0x0065 -> LATIN SMALL LETTER E
+ u'f' # 0x0066 -> LATIN SMALL LETTER F
+ u'g' # 0x0067 -> LATIN SMALL LETTER G
+ u'h' # 0x0068 -> LATIN SMALL LETTER H
+ u'i' # 0x0069 -> LATIN SMALL LETTER I
+ u'j' # 0x006a -> LATIN SMALL LETTER J
+ u'k' # 0x006b -> LATIN SMALL LETTER K
+ u'l' # 0x006c -> LATIN SMALL LETTER L
+ u'm' # 0x006d -> LATIN SMALL LETTER M
+ u'n' # 0x006e -> LATIN SMALL LETTER N
+ u'o' # 0x006f -> LATIN SMALL LETTER O
+ u'p' # 0x0070 -> LATIN SMALL LETTER P
+ u'q' # 0x0071 -> LATIN SMALL LETTER Q
+ u'r' # 0x0072 -> LATIN SMALL LETTER R
+ u's' # 0x0073 -> LATIN SMALL LETTER S
+ u't' # 0x0074 -> LATIN SMALL LETTER T
+ u'u' # 0x0075 -> LATIN SMALL LETTER U
+ u'v' # 0x0076 -> LATIN SMALL LETTER V
+ u'w' # 0x0077 -> LATIN SMALL LETTER W
+ u'x' # 0x0078 -> LATIN SMALL LETTER X
+ u'y' # 0x0079 -> LATIN SMALL LETTER Y
+ u'z' # 0x007a -> LATIN SMALL LETTER Z
+ u'{' # 0x007b -> LEFT CURLY BRACKET
+ u'|' # 0x007c -> VERTICAL LINE
+ u'}' # 0x007d -> RIGHT CURLY BRACKET
+ u'~' # 0x007e -> TILDE
+ u'\x7f' # 0x007f -> DELETE
+ u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xec' # 0x008d -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE
+ u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE
+ u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xff' # 0x0098 -> LATIN SMALL LETTER Y WITH DIAERESIS
+ u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE
+ u'\xa3' # 0x009c -> POUND SIGN
+ u'\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\xd7' # 0x009e -> MULTIPLICATION SIGN
+ u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK
+ u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR
+ u'\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR
+ u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK
+ u'\xae' # 0x00a9 -> REGISTERED SIGN
+ u'\xac' # 0x00aa -> NOT SIGN
+ u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF
+ u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER
+ u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK
+ u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2591' # 0x00b0 -> LIGHT SHADE
+ u'\u2592' # 0x00b1 -> MEDIUM SHADE
+ u'\u2593' # 0x00b2 -> DARK SHADE
+ u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL
+ u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ u'\xc1' # 0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc2' # 0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xc0' # 0x00b7 -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xa9' # 0x00b8 -> COPYRIGHT SIGN
+ u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL
+ u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT
+ u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT
+ u'\xa2' # 0x00bd -> CENT SIGN
+ u'\xa5' # 0x00be -> YEN SIGN
+ u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT
+ u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT
+ u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL
+ u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ u'\xe3' # 0x00c6 -> LATIN SMALL LETTER A WITH TILDE
+ u'\xc3' # 0x00c7 -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
+ u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL
+ u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ u'\xa4' # 0x00cf -> CURRENCY SIGN
+ u'\xf0' # 0x00d0 -> LATIN SMALL LETTER ETH
+ u'\xd0' # 0x00d1 -> LATIN CAPITAL LETTER ETH
+ u'\xca' # 0x00d2 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xcb' # 0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xc8' # 0x00d4 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\u20ac' # 0x00d5 -> EURO SIGN
+ u'\xcd' # 0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0x00d8 -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT
+ u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT
+ u'\u2588' # 0x00db -> FULL BLOCK
+ u'\u2584' # 0x00dc -> LOWER HALF BLOCK
+ u'\xa6' # 0x00dd -> BROKEN BAR
+ u'\xcc' # 0x00de -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'\u2580' # 0x00df -> UPPER HALF BLOCK
+ u'\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S
+ u'\xd4' # 0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\xd2' # 0x00e3 -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xf5' # 0x00e4 -> LATIN SMALL LETTER O WITH TILDE
+ u'\xd5' # 0x00e5 -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\xb5' # 0x00e6 -> MICRO SIGN
+ u'\xfe' # 0x00e7 -> LATIN SMALL LETTER THORN
+ u'\xde' # 0x00e8 -> LATIN CAPITAL LETTER THORN
+ u'\xda' # 0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xdb' # 0x00ea -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xd9' # 0x00eb -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\xfd' # 0x00ec -> LATIN SMALL LETTER Y WITH ACUTE
+ u'\xdd' # 0x00ed -> LATIN CAPITAL LETTER Y WITH ACUTE
+ u'\xaf' # 0x00ee -> MACRON
+ u'\xb4' # 0x00ef -> ACUTE ACCENT
+ u'\xad' # 0x00f0 -> SOFT HYPHEN
+ u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN
+ u'\u2017' # 0x00f2 -> DOUBLE LOW LINE
+ u'\xbe' # 0x00f3 -> VULGAR FRACTION THREE QUARTERS
+ u'\xb6' # 0x00f4 -> PILCROW SIGN
+ u'\xa7' # 0x00f5 -> SECTION SIGN
+ u'\xf7' # 0x00f6 -> DIVISION SIGN
+ u'\xb8' # 0x00f7 -> CEDILLA
+ u'\xb0' # 0x00f8 -> DEGREE SIGN
+ u'\xa8' # 0x00f9 -> DIAERESIS
+ u'\xb7' # 0x00fa -> MIDDLE DOT
+ u'\xb9' # 0x00fb -> SUPERSCRIPT ONE
+ u'\xb3' # 0x00fc -> SUPERSCRIPT THREE
+ u'\xb2' # 0x00fd -> SUPERSCRIPT TWO
+ u'\u25a0' # 0x00fe -> BLACK SQUARE
+ u'\xa0' # 0x00ff -> NO-BREAK SPACE
+)
+
+### Encoding Map
+
+encoding_map = {
+ 0x0000: 0x0000, # NULL
+ 0x0001: 0x0001, # START OF HEADING
+ 0x0002: 0x0002, # START OF TEXT
+ 0x0003: 0x0003, # END OF TEXT
+ 0x0004: 0x0004, # END OF TRANSMISSION
+ 0x0005: 0x0005, # ENQUIRY
+ 0x0006: 0x0006, # ACKNOWLEDGE
+ 0x0007: 0x0007, # BELL
+ 0x0008: 0x0008, # BACKSPACE
+ 0x0009: 0x0009, # HORIZONTAL TABULATION
+ 0x000a: 0x000a, # LINE FEED
+ 0x000b: 0x000b, # VERTICAL TABULATION
+ 0x000c: 0x000c, # FORM FEED
+ 0x000d: 0x000d, # CARRIAGE RETURN
+ 0x000e: 0x000e, # SHIFT OUT
+ 0x000f: 0x000f, # SHIFT IN
+ 0x0010: 0x0010, # DATA LINK ESCAPE
+ 0x0011: 0x0011, # DEVICE CONTROL ONE
+ 0x0012: 0x0012, # DEVICE CONTROL TWO
+ 0x0013: 0x0013, # DEVICE CONTROL THREE
+ 0x0014: 0x0014, # DEVICE CONTROL FOUR
+ 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE
+ 0x0016: 0x0016, # SYNCHRONOUS IDLE
+ 0x0017: 0x0017, # END OF TRANSMISSION BLOCK
+ 0x0018: 0x0018, # CANCEL
+ 0x0019: 0x0019, # END OF MEDIUM
+ 0x001a: 0x001a, # SUBSTITUTE
+ 0x001b: 0x001b, # ESCAPE
+ 0x001c: 0x001c, # FILE SEPARATOR
+ 0x001d: 0x001d, # GROUP SEPARATOR
+ 0x001e: 0x001e, # RECORD SEPARATOR
+ 0x001f: 0x001f, # UNIT SEPARATOR
+ 0x0020: 0x0020, # SPACE
+ 0x0021: 0x0021, # EXCLAMATION MARK
+ 0x0022: 0x0022, # QUOTATION MARK
+ 0x0023: 0x0023, # NUMBER SIGN
+ 0x0024: 0x0024, # DOLLAR SIGN
+ 0x0025: 0x0025, # PERCENT SIGN
+ 0x0026: 0x0026, # AMPERSAND
+ 0x0027: 0x0027, # APOSTROPHE
+ 0x0028: 0x0028, # LEFT PARENTHESIS
+ 0x0029: 0x0029, # RIGHT PARENTHESIS
+ 0x002a: 0x002a, # ASTERISK
+ 0x002b: 0x002b, # PLUS SIGN
+ 0x002c: 0x002c, # COMMA
+ 0x002d: 0x002d, # HYPHEN-MINUS
+ 0x002e: 0x002e, # FULL STOP
+ 0x002f: 0x002f, # SOLIDUS
+ 0x0030: 0x0030, # DIGIT ZERO
+ 0x0031: 0x0031, # DIGIT ONE
+ 0x0032: 0x0032, # DIGIT TWO
+ 0x0033: 0x0033, # DIGIT THREE
+ 0x0034: 0x0034, # DIGIT FOUR
+ 0x0035: 0x0035, # DIGIT FIVE
+ 0x0036: 0x0036, # DIGIT SIX
+ 0x0037: 0x0037, # DIGIT SEVEN
+ 0x0038: 0x0038, # DIGIT EIGHT
+ 0x0039: 0x0039, # DIGIT NINE
+ 0x003a: 0x003a, # COLON
+ 0x003b: 0x003b, # SEMICOLON
+ 0x003c: 0x003c, # LESS-THAN SIGN
+ 0x003d: 0x003d, # EQUALS SIGN
+ 0x003e: 0x003e, # GREATER-THAN SIGN
+ 0x003f: 0x003f, # QUESTION MARK
+ 0x0040: 0x0040, # COMMERCIAL AT
+ 0x0041: 0x0041, # LATIN CAPITAL LETTER A
+ 0x0042: 0x0042, # LATIN CAPITAL LETTER B
+ 0x0043: 0x0043, # LATIN CAPITAL LETTER C
+ 0x0044: 0x0044, # LATIN CAPITAL LETTER D
+ 0x0045: 0x0045, # LATIN CAPITAL LETTER E
+ 0x0046: 0x0046, # LATIN CAPITAL LETTER F
+ 0x0047: 0x0047, # LATIN CAPITAL LETTER G
+ 0x0048: 0x0048, # LATIN CAPITAL LETTER H
+ 0x0049: 0x0049, # LATIN CAPITAL LETTER I
+ 0x004a: 0x004a, # LATIN CAPITAL LETTER J
+ 0x004b: 0x004b, # LATIN CAPITAL LETTER K
+ 0x004c: 0x004c, # LATIN CAPITAL LETTER L
+ 0x004d: 0x004d, # LATIN CAPITAL LETTER M
+ 0x004e: 0x004e, # LATIN CAPITAL LETTER N
+ 0x004f: 0x004f, # LATIN CAPITAL LETTER O
+ 0x0050: 0x0050, # LATIN CAPITAL LETTER P
+ 0x0051: 0x0051, # LATIN CAPITAL LETTER Q
+ 0x0052: 0x0052, # LATIN CAPITAL LETTER R
+ 0x0053: 0x0053, # LATIN CAPITAL LETTER S
+ 0x0054: 0x0054, # LATIN CAPITAL LETTER T
+ 0x0055: 0x0055, # LATIN CAPITAL LETTER U
+ 0x0056: 0x0056, # LATIN CAPITAL LETTER V
+ 0x0057: 0x0057, # LATIN CAPITAL LETTER W
+ 0x0058: 0x0058, # LATIN CAPITAL LETTER X
+ 0x0059: 0x0059, # LATIN CAPITAL LETTER Y
+ 0x005a: 0x005a, # LATIN CAPITAL LETTER Z
+ 0x005b: 0x005b, # LEFT SQUARE BRACKET
+ 0x005c: 0x005c, # REVERSE SOLIDUS
+ 0x005d: 0x005d, # RIGHT SQUARE BRACKET
+ 0x005e: 0x005e, # CIRCUMFLEX ACCENT
+ 0x005f: 0x005f, # LOW LINE
+ 0x0060: 0x0060, # GRAVE ACCENT
+ 0x0061: 0x0061, # LATIN SMALL LETTER A
+ 0x0062: 0x0062, # LATIN SMALL LETTER B
+ 0x0063: 0x0063, # LATIN SMALL LETTER C
+ 0x0064: 0x0064, # LATIN SMALL LETTER D
+ 0x0065: 0x0065, # LATIN SMALL LETTER E
+ 0x0066: 0x0066, # LATIN SMALL LETTER F
+ 0x0067: 0x0067, # LATIN SMALL LETTER G
+ 0x0068: 0x0068, # LATIN SMALL LETTER H
+ 0x0069: 0x0069, # LATIN SMALL LETTER I
+ 0x006a: 0x006a, # LATIN SMALL LETTER J
+ 0x006b: 0x006b, # LATIN SMALL LETTER K
+ 0x006c: 0x006c, # LATIN SMALL LETTER L
+ 0x006d: 0x006d, # LATIN SMALL LETTER M
+ 0x006e: 0x006e, # LATIN SMALL LETTER N
+ 0x006f: 0x006f, # LATIN SMALL LETTER O
+ 0x0070: 0x0070, # LATIN SMALL LETTER P
+ 0x0071: 0x0071, # LATIN SMALL LETTER Q
+ 0x0072: 0x0072, # LATIN SMALL LETTER R
+ 0x0073: 0x0073, # LATIN SMALL LETTER S
+ 0x0074: 0x0074, # LATIN SMALL LETTER T
+ 0x0075: 0x0075, # LATIN SMALL LETTER U
+ 0x0076: 0x0076, # LATIN SMALL LETTER V
+ 0x0077: 0x0077, # LATIN SMALL LETTER W
+ 0x0078: 0x0078, # LATIN SMALL LETTER X
+ 0x0079: 0x0079, # LATIN SMALL LETTER Y
+ 0x007a: 0x007a, # LATIN SMALL LETTER Z
+ 0x007b: 0x007b, # LEFT CURLY BRACKET
+ 0x007c: 0x007c, # VERTICAL LINE
+ 0x007d: 0x007d, # RIGHT CURLY BRACKET
+ 0x007e: 0x007e, # TILDE
+ 0x007f: 0x007f, # DELETE
+ 0x00a0: 0x00ff, # NO-BREAK SPACE
+ 0x00a1: 0x00ad, # INVERTED EXCLAMATION MARK
+ 0x00a2: 0x00bd, # CENT SIGN
+ 0x00a3: 0x009c, # POUND SIGN
+ 0x00a4: 0x00cf, # CURRENCY SIGN
+ 0x00a5: 0x00be, # YEN SIGN
+ 0x00a6: 0x00dd, # BROKEN BAR
+ 0x00a7: 0x00f5, # SECTION SIGN
+ 0x00a8: 0x00f9, # DIAERESIS
+ 0x00a9: 0x00b8, # COPYRIGHT SIGN
+ 0x00aa: 0x00a6, # FEMININE ORDINAL INDICATOR
+ 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00ac: 0x00aa, # NOT SIGN
+ 0x00ad: 0x00f0, # SOFT HYPHEN
+ 0x00ae: 0x00a9, # REGISTERED SIGN
+ 0x00af: 0x00ee, # MACRON
+ 0x00b0: 0x00f8, # DEGREE SIGN
+ 0x00b1: 0x00f1, # PLUS-MINUS SIGN
+ 0x00b2: 0x00fd, # SUPERSCRIPT TWO
+ 0x00b3: 0x00fc, # SUPERSCRIPT THREE
+ 0x00b4: 0x00ef, # ACUTE ACCENT
+ 0x00b5: 0x00e6, # MICRO SIGN
+ 0x00b6: 0x00f4, # PILCROW SIGN
+ 0x00b7: 0x00fa, # MIDDLE DOT
+ 0x00b8: 0x00f7, # CEDILLA
+ 0x00b9: 0x00fb, # SUPERSCRIPT ONE
+ 0x00ba: 0x00a7, # MASCULINE ORDINAL INDICATOR
+ 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER
+ 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF
+ 0x00be: 0x00f3, # VULGAR FRACTION THREE QUARTERS
+ 0x00bf: 0x00a8, # INVERTED QUESTION MARK
+ 0x00c0: 0x00b7, # LATIN CAPITAL LETTER A WITH GRAVE
+ 0x00c1: 0x00b5, # LATIN CAPITAL LETTER A WITH ACUTE
+ 0x00c2: 0x00b6, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ 0x00c3: 0x00c7, # LATIN CAPITAL LETTER A WITH TILDE
+ 0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x00c5: 0x008f, # LATIN CAPITAL LETTER A WITH RING ABOVE
+ 0x00c6: 0x0092, # LATIN CAPITAL LIGATURE AE
+ 0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x00c8: 0x00d4, # LATIN CAPITAL LETTER E WITH GRAVE
+ 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x00ca: 0x00d2, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ 0x00cb: 0x00d3, # LATIN CAPITAL LETTER E WITH DIAERESIS
+ 0x00cc: 0x00de, # LATIN CAPITAL LETTER I WITH GRAVE
+ 0x00cd: 0x00d6, # LATIN CAPITAL LETTER I WITH ACUTE
+ 0x00ce: 0x00d7, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ 0x00cf: 0x00d8, # LATIN CAPITAL LETTER I WITH DIAERESIS
+ 0x00d0: 0x00d1, # LATIN CAPITAL LETTER ETH
+ 0x00d1: 0x00a5, # LATIN CAPITAL LETTER N WITH TILDE
+ 0x00d2: 0x00e3, # LATIN CAPITAL LETTER O WITH GRAVE
+ 0x00d3: 0x00e0, # LATIN CAPITAL LETTER O WITH ACUTE
+ 0x00d4: 0x00e2, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ 0x00d5: 0x00e5, # LATIN CAPITAL LETTER O WITH TILDE
+ 0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x00d7: 0x009e, # MULTIPLICATION SIGN
+ 0x00d8: 0x009d, # LATIN CAPITAL LETTER O WITH STROKE
+ 0x00d9: 0x00eb, # LATIN CAPITAL LETTER U WITH GRAVE
+ 0x00da: 0x00e9, # LATIN CAPITAL LETTER U WITH ACUTE
+ 0x00db: 0x00ea, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x00dd: 0x00ed, # LATIN CAPITAL LETTER Y WITH ACUTE
+ 0x00de: 0x00e8, # LATIN CAPITAL LETTER THORN
+ 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S
+ 0x00e0: 0x0085, # LATIN SMALL LETTER A WITH GRAVE
+ 0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x00e3: 0x00c6, # LATIN SMALL LETTER A WITH TILDE
+ 0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x00e5: 0x0086, # LATIN SMALL LETTER A WITH RING ABOVE
+ 0x00e6: 0x0091, # LATIN SMALL LIGATURE AE
+ 0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x00e8: 0x008a, # LATIN SMALL LETTER E WITH GRAVE
+ 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE
+ 0x00ea: 0x0088, # LATIN SMALL LETTER E WITH CIRCUMFLEX
+ 0x00eb: 0x0089, # LATIN SMALL LETTER E WITH DIAERESIS
+ 0x00ec: 0x008d, # LATIN SMALL LETTER I WITH GRAVE
+ 0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00ee: 0x008c, # LATIN SMALL LETTER I WITH CIRCUMFLEX
+ 0x00ef: 0x008b, # LATIN SMALL LETTER I WITH DIAERESIS
+ 0x00f0: 0x00d0, # LATIN SMALL LETTER ETH
+ 0x00f1: 0x00a4, # LATIN SMALL LETTER N WITH TILDE
+ 0x00f2: 0x0095, # LATIN SMALL LETTER O WITH GRAVE
+ 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x00f5: 0x00e4, # LATIN SMALL LETTER O WITH TILDE
+ 0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x00f7: 0x00f6, # DIVISION SIGN
+ 0x00f8: 0x009b, # LATIN SMALL LETTER O WITH STROKE
+ 0x00f9: 0x0097, # LATIN SMALL LETTER U WITH GRAVE
+ 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00fb: 0x0096, # LATIN SMALL LETTER U WITH CIRCUMFLEX
+ 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x00fd: 0x00ec, # LATIN SMALL LETTER Y WITH ACUTE
+ 0x00fe: 0x00e7, # LATIN SMALL LETTER THORN
+ 0x00ff: 0x0098, # LATIN SMALL LETTER Y WITH DIAERESIS
+ 0x20ac: 0x00d5, # EURO SIGN
+ 0x0192: 0x009f, # LATIN SMALL LETTER F WITH HOOK
+ 0x2017: 0x00f2, # DOUBLE LOW LINE
+ 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL
+ 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x2580: 0x00df, # UPPER HALF BLOCK
+ 0x2584: 0x00dc, # LOWER HALF BLOCK
+ 0x2588: 0x00db, # FULL BLOCK
+ 0x2591: 0x00b0, # LIGHT SHADE
+ 0x2592: 0x00b1, # MEDIUM SHADE
+ 0x2593: 0x00b2, # DARK SHADE
+ 0x25a0: 0x00fe, # BLACK SQUARE
+}
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
index 0000000000..ca96653ad8
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp860.py
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP860.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp860',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE
+ 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x0084: 0x00e3, # LATIN SMALL LETTER A WITH TILDE
+ 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE
+ 0x0086: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE
+ 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX
+ 0x0089: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE
+ 0x008b: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE
+ 0x008c: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ 0x008d: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE
+ 0x008e: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE
+ 0x008f: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x0091: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE
+ 0x0092: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE
+ 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x0094: 0x00f5, # LATIN SMALL LETTER O WITH TILDE
+ 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE
+ 0x0096: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE
+ 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE
+ 0x0098: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE
+ 0x0099: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE
+ 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x009b: 0x00a2, # CENT SIGN
+ 0x009c: 0x00a3, # POUND SIGN
+ 0x009d: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE
+ 0x009e: 0x20a7, # PESETA SIGN
+ 0x009f: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE
+ 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE
+ 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE
+ 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR
+ 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR
+ 0x00a8: 0x00bf, # INVERTED QUESTION MARK
+ 0x00a9: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE
+ 0x00aa: 0x00ac, # NOT SIGN
+ 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF
+ 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER
+ 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK
+ 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00b0: 0x2591, # LIGHT SHADE
+ 0x00b1: 0x2592, # MEDIUM SHADE
+ 0x00b2: 0x2593, # DARK SHADE
+ 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL
+ 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x00db: 0x2588, # FULL BLOCK
+ 0x00dc: 0x2584, # LOWER HALF BLOCK
+ 0x00dd: 0x258c, # LEFT HALF BLOCK
+ 0x00de: 0x2590, # RIGHT HALF BLOCK
+ 0x00df: 0x2580, # UPPER HALF BLOCK
+ 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA
+ 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S
+ 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA
+ 0x00e3: 0x03c0, # GREEK SMALL LETTER PI
+ 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA
+ 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA
+ 0x00e6: 0x00b5, # MICRO SIGN
+ 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU
+ 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI
+ 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA
+ 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA
+ 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA
+ 0x00ec: 0x221e, # INFINITY
+ 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI
+ 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON
+ 0x00ef: 0x2229, # INTERSECTION
+ 0x00f0: 0x2261, # IDENTICAL TO
+ 0x00f1: 0x00b1, # PLUS-MINUS SIGN
+ 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO
+ 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO
+ 0x00f4: 0x2320, # TOP HALF INTEGRAL
+ 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL
+ 0x00f6: 0x00f7, # DIVISION SIGN
+ 0x00f7: 0x2248, # ALMOST EQUAL TO
+ 0x00f8: 0x00b0, # DEGREE SIGN
+ 0x00f9: 0x2219, # BULLET OPERATOR
+ 0x00fa: 0x00b7, # MIDDLE DOT
+ 0x00fb: 0x221a, # SQUARE ROOT
+ 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N
+ 0x00fd: 0x00b2, # SUPERSCRIPT TWO
+ 0x00fe: 0x25a0, # BLACK SQUARE
+ 0x00ff: 0x00a0, # NO-BREAK SPACE
+})
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x0000 -> NULL
+ u'\x01' # 0x0001 -> START OF HEADING
+ u'\x02' # 0x0002 -> START OF TEXT
+ u'\x03' # 0x0003 -> END OF TEXT
+ u'\x04' # 0x0004 -> END OF TRANSMISSION
+ u'\x05' # 0x0005 -> ENQUIRY
+ u'\x06' # 0x0006 -> ACKNOWLEDGE
+ u'\x07' # 0x0007 -> BELL
+ u'\x08' # 0x0008 -> BACKSPACE
+ u'\t' # 0x0009 -> HORIZONTAL TABULATION
+ u'\n' # 0x000a -> LINE FEED
+ u'\x0b' # 0x000b -> VERTICAL TABULATION
+ u'\x0c' # 0x000c -> FORM FEED
+ u'\r' # 0x000d -> CARRIAGE RETURN
+ u'\x0e' # 0x000e -> SHIFT OUT
+ u'\x0f' # 0x000f -> SHIFT IN
+ u'\x10' # 0x0010 -> DATA LINK ESCAPE
+ u'\x11' # 0x0011 -> DEVICE CONTROL ONE
+ u'\x12' # 0x0012 -> DEVICE CONTROL TWO
+ u'\x13' # 0x0013 -> DEVICE CONTROL THREE
+ u'\x14' # 0x0014 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x0016 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x0018 -> CANCEL
+ u'\x19' # 0x0019 -> END OF MEDIUM
+ u'\x1a' # 0x001a -> SUBSTITUTE
+ u'\x1b' # 0x001b -> ESCAPE
+ u'\x1c' # 0x001c -> FILE SEPARATOR
+ u'\x1d' # 0x001d -> GROUP SEPARATOR
+ u'\x1e' # 0x001e -> RECORD SEPARATOR
+ u'\x1f' # 0x001f -> UNIT SEPARATOR
+ u' ' # 0x0020 -> SPACE
+ u'!' # 0x0021 -> EXCLAMATION MARK
+ u'"' # 0x0022 -> QUOTATION MARK
+ u'#' # 0x0023 -> NUMBER SIGN
+ u'$' # 0x0024 -> DOLLAR SIGN
+ u'%' # 0x0025 -> PERCENT SIGN
+ u'&' # 0x0026 -> AMPERSAND
+ u"'" # 0x0027 -> APOSTROPHE
+ u'(' # 0x0028 -> LEFT PARENTHESIS
+ u')' # 0x0029 -> RIGHT PARENTHESIS
+ u'*' # 0x002a -> ASTERISK
+ u'+' # 0x002b -> PLUS SIGN
+ u',' # 0x002c -> COMMA
+ u'-' # 0x002d -> HYPHEN-MINUS
+ u'.' # 0x002e -> FULL STOP
+ u'/' # 0x002f -> SOLIDUS
+ u'0' # 0x0030 -> DIGIT ZERO
+ u'1' # 0x0031 -> DIGIT ONE
+ u'2' # 0x0032 -> DIGIT TWO
+ u'3' # 0x0033 -> DIGIT THREE
+ u'4' # 0x0034 -> DIGIT FOUR
+ u'5' # 0x0035 -> DIGIT FIVE
+ u'6' # 0x0036 -> DIGIT SIX
+ u'7' # 0x0037 -> DIGIT SEVEN
+ u'8' # 0x0038 -> DIGIT EIGHT
+ u'9' # 0x0039 -> DIGIT NINE
+ u':' # 0x003a -> COLON
+ u';' # 0x003b -> SEMICOLON
+ u'<' # 0x003c -> LESS-THAN SIGN
+ u'=' # 0x003d -> EQUALS SIGN
+ u'>' # 0x003e -> GREATER-THAN SIGN
+ u'?' # 0x003f -> QUESTION MARK
+ u'@' # 0x0040 -> COMMERCIAL AT
+ u'A' # 0x0041 -> LATIN CAPITAL LETTER A
+ u'B' # 0x0042 -> LATIN CAPITAL LETTER B
+ u'C' # 0x0043 -> LATIN CAPITAL LETTER C
+ u'D' # 0x0044 -> LATIN CAPITAL LETTER D
+ u'E' # 0x0045 -> LATIN CAPITAL LETTER E
+ u'F' # 0x0046 -> LATIN CAPITAL LETTER F
+ u'G' # 0x0047 -> LATIN CAPITAL LETTER G
+ u'H' # 0x0048 -> LATIN CAPITAL LETTER H
+ u'I' # 0x0049 -> LATIN CAPITAL LETTER I
+ u'J' # 0x004a -> LATIN CAPITAL LETTER J
+ u'K' # 0x004b -> LATIN CAPITAL LETTER K
+ u'L' # 0x004c -> LATIN CAPITAL LETTER L
+ u'M' # 0x004d -> LATIN CAPITAL LETTER M
+ u'N' # 0x004e -> LATIN CAPITAL LETTER N
+ u'O' # 0x004f -> LATIN CAPITAL LETTER O
+ u'P' # 0x0050 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x0052 -> LATIN CAPITAL LETTER R
+ u'S' # 0x0053 -> LATIN CAPITAL LETTER S
+ u'T' # 0x0054 -> LATIN CAPITAL LETTER T
+ u'U' # 0x0055 -> LATIN CAPITAL LETTER U
+ u'V' # 0x0056 -> LATIN CAPITAL LETTER V
+ u'W' # 0x0057 -> LATIN CAPITAL LETTER W
+ u'X' # 0x0058 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x005a -> LATIN CAPITAL LETTER Z
+ u'[' # 0x005b -> LEFT SQUARE BRACKET
+ u'\\' # 0x005c -> REVERSE SOLIDUS
+ u']' # 0x005d -> RIGHT SQUARE BRACKET
+ u'^' # 0x005e -> CIRCUMFLEX ACCENT
+ u'_' # 0x005f -> LOW LINE
+ u'`' # 0x0060 -> GRAVE ACCENT
+ u'a' # 0x0061 -> LATIN SMALL LETTER A
+ u'b' # 0x0062 -> LATIN SMALL LETTER B
+ u'c' # 0x0063 -> LATIN SMALL LETTER C
+ u'd' # 0x0064 -> LATIN SMALL LETTER D
+ u'e' # 0x0065 -> LATIN SMALL LETTER E
+ u'f' # 0x0066 -> LATIN SMALL LETTER F
+ u'g' # 0x0067 -> LATIN SMALL LETTER G
+ u'h' # 0x0068 -> LATIN SMALL LETTER H
+ u'i' # 0x0069 -> LATIN SMALL LETTER I
+ u'j' # 0x006a -> LATIN SMALL LETTER J
+ u'k' # 0x006b -> LATIN SMALL LETTER K
+ u'l' # 0x006c -> LATIN SMALL LETTER L
+ u'm' # 0x006d -> LATIN SMALL LETTER M
+ u'n' # 0x006e -> LATIN SMALL LETTER N
+ u'o' # 0x006f -> LATIN SMALL LETTER O
+ u'p' # 0x0070 -> LATIN SMALL LETTER P
+ u'q' # 0x0071 -> LATIN SMALL LETTER Q
+ u'r' # 0x0072 -> LATIN SMALL LETTER R
+ u's' # 0x0073 -> LATIN SMALL LETTER S
+ u't' # 0x0074 -> LATIN SMALL LETTER T
+ u'u' # 0x0075 -> LATIN SMALL LETTER U
+ u'v' # 0x0076 -> LATIN SMALL LETTER V
+ u'w' # 0x0077 -> LATIN SMALL LETTER W
+ u'x' # 0x0078 -> LATIN SMALL LETTER X
+ u'y' # 0x0079 -> LATIN SMALL LETTER Y
+ u'z' # 0x007a -> LATIN SMALL LETTER Z
+ u'{' # 0x007b -> LEFT CURLY BRACKET
+ u'|' # 0x007c -> VERTICAL LINE
+ u'}' # 0x007d -> RIGHT CURLY BRACKET
+ u'~' # 0x007e -> TILDE
+ u'\x7f' # 0x007f -> DELETE
+ u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe3' # 0x0084 -> LATIN SMALL LETTER A WITH TILDE
+ u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xc1' # 0x0086 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xca' # 0x0089 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xcd' # 0x008b -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xd4' # 0x008c -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\xec' # 0x008d -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xc3' # 0x008e -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\xc2' # 0x008f -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xc0' # 0x0091 -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xc8' # 0x0092 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf5' # 0x0094 -> LATIN SMALL LETTER O WITH TILDE
+ u'\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xda' # 0x0096 -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xcc' # 0x0098 -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'\xd5' # 0x0099 -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xa2' # 0x009b -> CENT SIGN
+ u'\xa3' # 0x009c -> POUND SIGN
+ u'\xd9' # 0x009d -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\u20a7' # 0x009e -> PESETA SIGN
+ u'\xd3' # 0x009f -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR
+ u'\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR
+ u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK
+ u'\xd2' # 0x00a9 -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xac' # 0x00aa -> NOT SIGN
+ u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF
+ u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER
+ u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK
+ u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2591' # 0x00b0 -> LIGHT SHADE
+ u'\u2592' # 0x00b1 -> MEDIUM SHADE
+ u'\u2593' # 0x00b2 -> DARK SHADE
+ u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL
+ u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL
+ u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT
+ u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT
+ u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT
+ u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT
+ u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL
+ u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
+ u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL
+ u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT
+ u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT
+ u'\u2588' # 0x00db -> FULL BLOCK
+ u'\u2584' # 0x00dc -> LOWER HALF BLOCK
+ u'\u258c' # 0x00dd -> LEFT HALF BLOCK
+ u'\u2590' # 0x00de -> RIGHT HALF BLOCK
+ u'\u2580' # 0x00df -> UPPER HALF BLOCK
+ u'\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA
+ u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S
+ u'\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA
+ u'\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI
+ u'\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA
+ u'\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA
+ u'\xb5' # 0x00e6 -> MICRO SIGN
+ u'\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU
+ u'\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI
+ u'\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA
+ u'\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA
+ u'\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA
+ u'\u221e' # 0x00ec -> INFINITY
+ u'\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI
+ u'\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON
+ u'\u2229' # 0x00ef -> INTERSECTION
+ u'\u2261' # 0x00f0 -> IDENTICAL TO
+ u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN
+ u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO
+ u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO
+ u'\u2320' # 0x00f4 -> TOP HALF INTEGRAL
+ u'\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL
+ u'\xf7' # 0x00f6 -> DIVISION SIGN
+ u'\u2248' # 0x00f7 -> ALMOST EQUAL TO
+ u'\xb0' # 0x00f8 -> DEGREE SIGN
+ u'\u2219' # 0x00f9 -> BULLET OPERATOR
+ u'\xb7' # 0x00fa -> MIDDLE DOT
+ u'\u221a' # 0x00fb -> SQUARE ROOT
+ u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N
+ u'\xb2' # 0x00fd -> SUPERSCRIPT TWO
+ u'\u25a0' # 0x00fe -> BLACK SQUARE
+ u'\xa0' # 0x00ff -> NO-BREAK SPACE
+)
+
+### Encoding Map
+
+encoding_map = {
+ 0x0000: 0x0000, # NULL
+ 0x0001: 0x0001, # START OF HEADING
+ 0x0002: 0x0002, # START OF TEXT
+ 0x0003: 0x0003, # END OF TEXT
+ 0x0004: 0x0004, # END OF TRANSMISSION
+ 0x0005: 0x0005, # ENQUIRY
+ 0x0006: 0x0006, # ACKNOWLEDGE
+ 0x0007: 0x0007, # BELL
+ 0x0008: 0x0008, # BACKSPACE
+ 0x0009: 0x0009, # HORIZONTAL TABULATION
+ 0x000a: 0x000a, # LINE FEED
+ 0x000b: 0x000b, # VERTICAL TABULATION
+ 0x000c: 0x000c, # FORM FEED
+ 0x000d: 0x000d, # CARRIAGE RETURN
+ 0x000e: 0x000e, # SHIFT OUT
+ 0x000f: 0x000f, # SHIFT IN
+ 0x0010: 0x0010, # DATA LINK ESCAPE
+ 0x0011: 0x0011, # DEVICE CONTROL ONE
+ 0x0012: 0x0012, # DEVICE CONTROL TWO
+ 0x0013: 0x0013, # DEVICE CONTROL THREE
+ 0x0014: 0x0014, # DEVICE CONTROL FOUR
+ 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE
+ 0x0016: 0x0016, # SYNCHRONOUS IDLE
+ 0x0017: 0x0017, # END OF TRANSMISSION BLOCK
+ 0x0018: 0x0018, # CANCEL
+ 0x0019: 0x0019, # END OF MEDIUM
+ 0x001a: 0x001a, # SUBSTITUTE
+ 0x001b: 0x001b, # ESCAPE
+ 0x001c: 0x001c, # FILE SEPARATOR
+ 0x001d: 0x001d, # GROUP SEPARATOR
+ 0x001e: 0x001e, # RECORD SEPARATOR
+ 0x001f: 0x001f, # UNIT SEPARATOR
+ 0x0020: 0x0020, # SPACE
+ 0x0021: 0x0021, # EXCLAMATION MARK
+ 0x0022: 0x0022, # QUOTATION MARK
+ 0x0023: 0x0023, # NUMBER SIGN
+ 0x0024: 0x0024, # DOLLAR SIGN
+ 0x0025: 0x0025, # PERCENT SIGN
+ 0x0026: 0x0026, # AMPERSAND
+ 0x0027: 0x0027, # APOSTROPHE
+ 0x0028: 0x0028, # LEFT PARENTHESIS
+ 0x0029: 0x0029, # RIGHT PARENTHESIS
+ 0x002a: 0x002a, # ASTERISK
+ 0x002b: 0x002b, # PLUS SIGN
+ 0x002c: 0x002c, # COMMA
+ 0x002d: 0x002d, # HYPHEN-MINUS
+ 0x002e: 0x002e, # FULL STOP
+ 0x002f: 0x002f, # SOLIDUS
+ 0x0030: 0x0030, # DIGIT ZERO
+ 0x0031: 0x0031, # DIGIT ONE
+ 0x0032: 0x0032, # DIGIT TWO
+ 0x0033: 0x0033, # DIGIT THREE
+ 0x0034: 0x0034, # DIGIT FOUR
+ 0x0035: 0x0035, # DIGIT FIVE
+ 0x0036: 0x0036, # DIGIT SIX
+ 0x0037: 0x0037, # DIGIT SEVEN
+ 0x0038: 0x0038, # DIGIT EIGHT
+ 0x0039: 0x0039, # DIGIT NINE
+ 0x003a: 0x003a, # COLON
+ 0x003b: 0x003b, # SEMICOLON
+ 0x003c: 0x003c, # LESS-THAN SIGN
+ 0x003d: 0x003d, # EQUALS SIGN
+ 0x003e: 0x003e, # GREATER-THAN SIGN
+ 0x003f: 0x003f, # QUESTION MARK
+ 0x0040: 0x0040, # COMMERCIAL AT
+ 0x0041: 0x0041, # LATIN CAPITAL LETTER A
+ 0x0042: 0x0042, # LATIN CAPITAL LETTER B
+ 0x0043: 0x0043, # LATIN CAPITAL LETTER C
+ 0x0044: 0x0044, # LATIN CAPITAL LETTER D
+ 0x0045: 0x0045, # LATIN CAPITAL LETTER E
+ 0x0046: 0x0046, # LATIN CAPITAL LETTER F
+ 0x0047: 0x0047, # LATIN CAPITAL LETTER G
+ 0x0048: 0x0048, # LATIN CAPITAL LETTER H
+ 0x0049: 0x0049, # LATIN CAPITAL LETTER I
+ 0x004a: 0x004a, # LATIN CAPITAL LETTER J
+ 0x004b: 0x004b, # LATIN CAPITAL LETTER K
+ 0x004c: 0x004c, # LATIN CAPITAL LETTER L
+ 0x004d: 0x004d, # LATIN CAPITAL LETTER M
+ 0x004e: 0x004e, # LATIN CAPITAL LETTER N
+ 0x004f: 0x004f, # LATIN CAPITAL LETTER O
+ 0x0050: 0x0050, # LATIN CAPITAL LETTER P
+ 0x0051: 0x0051, # LATIN CAPITAL LETTER Q
+ 0x0052: 0x0052, # LATIN CAPITAL LETTER R
+ 0x0053: 0x0053, # LATIN CAPITAL LETTER S
+ 0x0054: 0x0054, # LATIN CAPITAL LETTER T
+ 0x0055: 0x0055, # LATIN CAPITAL LETTER U
+ 0x0056: 0x0056, # LATIN CAPITAL LETTER V
+ 0x0057: 0x0057, # LATIN CAPITAL LETTER W
+ 0x0058: 0x0058, # LATIN CAPITAL LETTER X
+ 0x0059: 0x0059, # LATIN CAPITAL LETTER Y
+ 0x005a: 0x005a, # LATIN CAPITAL LETTER Z
+ 0x005b: 0x005b, # LEFT SQUARE BRACKET
+ 0x005c: 0x005c, # REVERSE SOLIDUS
+ 0x005d: 0x005d, # RIGHT SQUARE BRACKET
+ 0x005e: 0x005e, # CIRCUMFLEX ACCENT
+ 0x005f: 0x005f, # LOW LINE
+ 0x0060: 0x0060, # GRAVE ACCENT
+ 0x0061: 0x0061, # LATIN SMALL LETTER A
+ 0x0062: 0x0062, # LATIN SMALL LETTER B
+ 0x0063: 0x0063, # LATIN SMALL LETTER C
+ 0x0064: 0x0064, # LATIN SMALL LETTER D
+ 0x0065: 0x0065, # LATIN SMALL LETTER E
+ 0x0066: 0x0066, # LATIN SMALL LETTER F
+ 0x0067: 0x0067, # LATIN SMALL LETTER G
+ 0x0068: 0x0068, # LATIN SMALL LETTER H
+ 0x0069: 0x0069, # LATIN SMALL LETTER I
+ 0x006a: 0x006a, # LATIN SMALL LETTER J
+ 0x006b: 0x006b, # LATIN SMALL LETTER K
+ 0x006c: 0x006c, # LATIN SMALL LETTER L
+ 0x006d: 0x006d, # LATIN SMALL LETTER M
+ 0x006e: 0x006e, # LATIN SMALL LETTER N
+ 0x006f: 0x006f, # LATIN SMALL LETTER O
+ 0x0070: 0x0070, # LATIN SMALL LETTER P
+ 0x0071: 0x0071, # LATIN SMALL LETTER Q
+ 0x0072: 0x0072, # LATIN SMALL LETTER R
+ 0x0073: 0x0073, # LATIN SMALL LETTER S
+ 0x0074: 0x0074, # LATIN SMALL LETTER T
+ 0x0075: 0x0075, # LATIN SMALL LETTER U
+ 0x0076: 0x0076, # LATIN SMALL LETTER V
+ 0x0077: 0x0077, # LATIN SMALL LETTER W
+ 0x0078: 0x0078, # LATIN SMALL LETTER X
+ 0x0079: 0x0079, # LATIN SMALL LETTER Y
+ 0x007a: 0x007a, # LATIN SMALL LETTER Z
+ 0x007b: 0x007b, # LEFT CURLY BRACKET
+ 0x007c: 0x007c, # VERTICAL LINE
+ 0x007d: 0x007d, # RIGHT CURLY BRACKET
+ 0x007e: 0x007e, # TILDE
+ 0x007f: 0x007f, # DELETE
+ 0x00a0: 0x00ff, # NO-BREAK SPACE
+ 0x00a1: 0x00ad, # INVERTED EXCLAMATION MARK
+ 0x00a2: 0x009b, # CENT SIGN
+ 0x00a3: 0x009c, # POUND SIGN
+ 0x00aa: 0x00a6, # FEMININE ORDINAL INDICATOR
+ 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00ac: 0x00aa, # NOT SIGN
+ 0x00b0: 0x00f8, # DEGREE SIGN
+ 0x00b1: 0x00f1, # PLUS-MINUS SIGN
+ 0x00b2: 0x00fd, # SUPERSCRIPT TWO
+ 0x00b5: 0x00e6, # MICRO SIGN
+ 0x00b7: 0x00fa, # MIDDLE DOT
+ 0x00ba: 0x00a7, # MASCULINE ORDINAL INDICATOR
+ 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER
+ 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF
+ 0x00bf: 0x00a8, # INVERTED QUESTION MARK
+ 0x00c0: 0x0091, # LATIN CAPITAL LETTER A WITH GRAVE
+ 0x00c1: 0x0086, # LATIN CAPITAL LETTER A WITH ACUTE
+ 0x00c2: 0x008f, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ 0x00c3: 0x008e, # LATIN CAPITAL LETTER A WITH TILDE
+ 0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x00c8: 0x0092, # LATIN CAPITAL LETTER E WITH GRAVE
+ 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x00ca: 0x0089, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ 0x00cc: 0x0098, # LATIN CAPITAL LETTER I WITH GRAVE
+ 0x00cd: 0x008b, # LATIN CAPITAL LETTER I WITH ACUTE
+ 0x00d1: 0x00a5, # LATIN CAPITAL LETTER N WITH TILDE
+ 0x00d2: 0x00a9, # LATIN CAPITAL LETTER O WITH GRAVE
+ 0x00d3: 0x009f, # LATIN CAPITAL LETTER O WITH ACUTE
+ 0x00d4: 0x008c, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ 0x00d5: 0x0099, # LATIN CAPITAL LETTER O WITH TILDE
+ 0x00d9: 0x009d, # LATIN CAPITAL LETTER U WITH GRAVE
+ 0x00da: 0x0096, # LATIN CAPITAL LETTER U WITH ACUTE
+ 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S
+ 0x00e0: 0x0085, # LATIN SMALL LETTER A WITH GRAVE
+ 0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x00e3: 0x0084, # LATIN SMALL LETTER A WITH TILDE
+ 0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x00e8: 0x008a, # LATIN SMALL LETTER E WITH GRAVE
+ 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE
+ 0x00ea: 0x0088, # LATIN SMALL LETTER E WITH CIRCUMFLEX
+ 0x00ec: 0x008d, # LATIN SMALL LETTER I WITH GRAVE
+ 0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00f1: 0x00a4, # LATIN SMALL LETTER N WITH TILDE
+ 0x00f2: 0x0095, # LATIN SMALL LETTER O WITH GRAVE
+ 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x00f5: 0x0094, # LATIN SMALL LETTER O WITH TILDE
+ 0x00f7: 0x00f6, # DIVISION SIGN
+ 0x00f9: 0x0097, # LATIN SMALL LETTER U WITH GRAVE
+ 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x0393: 0x00e2, # GREEK CAPITAL LETTER GAMMA
+ 0x0398: 0x00e9, # GREEK CAPITAL LETTER THETA
+ 0x03a3: 0x00e4, # GREEK CAPITAL LETTER SIGMA
+ 0x03a6: 0x00e8, # GREEK CAPITAL LETTER PHI
+ 0x03a9: 0x00ea, # GREEK CAPITAL LETTER OMEGA
+ 0x03b1: 0x00e0, # GREEK SMALL LETTER ALPHA
+ 0x03b4: 0x00eb, # GREEK SMALL LETTER DELTA
+ 0x03b5: 0x00ee, # GREEK SMALL LETTER EPSILON
+ 0x03c0: 0x00e3, # GREEK SMALL LETTER PI
+ 0x03c3: 0x00e5, # GREEK SMALL LETTER SIGMA
+ 0x03c4: 0x00e7, # GREEK SMALL LETTER TAU
+ 0x03c6: 0x00ed, # GREEK SMALL LETTER PHI
+ 0x207f: 0x00fc, # SUPERSCRIPT LATIN SMALL LETTER N
+ 0x20a7: 0x009e, # PESETA SIGN
+ 0x2219: 0x00f9, # BULLET OPERATOR
+ 0x221a: 0x00fb, # SQUARE ROOT
+ 0x221e: 0x00ec, # INFINITY
+ 0x2229: 0x00ef, # INTERSECTION
+ 0x2248: 0x00f7, # ALMOST EQUAL TO
+ 0x2261: 0x00f0, # IDENTICAL TO
+ 0x2264: 0x00f3, # LESS-THAN OR EQUAL TO
+ 0x2265: 0x00f2, # GREATER-THAN OR EQUAL TO
+ 0x2320: 0x00f4, # TOP HALF INTEGRAL
+ 0x2321: 0x00f5, # BOTTOM HALF INTEGRAL
+ 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL
+ 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x2552: 0x00d5, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ 0x2553: 0x00d6, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x2555: 0x00b8, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ 0x2556: 0x00b7, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x2558: 0x00d4, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ 0x2559: 0x00d3, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x255b: 0x00be, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ 0x255c: 0x00bd, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x255e: 0x00c6, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ 0x255f: 0x00c7, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x2561: 0x00b5, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ 0x2562: 0x00b6, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x2564: 0x00d1, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ 0x2565: 0x00d2, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x2567: 0x00cf, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ 0x2568: 0x00d0, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x256a: 0x00d8, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ 0x256b: 0x00d7, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x2580: 0x00df, # UPPER HALF BLOCK
+ 0x2584: 0x00dc, # LOWER HALF BLOCK
+ 0x2588: 0x00db, # FULL BLOCK
+ 0x258c: 0x00dd, # LEFT HALF BLOCK
+ 0x2590: 0x00de, # RIGHT HALF BLOCK
+ 0x2591: 0x00b0, # LIGHT SHADE
+ 0x2592: 0x00b1, # MEDIUM SHADE
+ 0x2593: 0x00b2, # DARK SHADE
+ 0x25a0: 0x00fe, # BLACK SQUARE
+}
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
index 0000000000..ce08f10f5b
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp861.py
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP861.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp861',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE
+ 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE
+ 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE
+ 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX
+ 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS
+ 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE
+ 0x008b: 0x00d0, # LATIN CAPITAL LETTER ETH
+ 0x008c: 0x00f0, # LATIN SMALL LETTER ETH
+ 0x008d: 0x00de, # LATIN CAPITAL LETTER THORN
+ 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE
+ 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE
+ 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE
+ 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x0095: 0x00fe, # LATIN SMALL LETTER THORN
+ 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX
+ 0x0097: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE
+ 0x0098: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE
+ 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE
+ 0x009c: 0x00a3, # POUND SIGN
+ 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE
+ 0x009e: 0x20a7, # PESETA SIGN
+ 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK
+ 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00a4: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE
+ 0x00a5: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE
+ 0x00a6: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE
+ 0x00a7: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE
+ 0x00a8: 0x00bf, # INVERTED QUESTION MARK
+ 0x00a9: 0x2310, # REVERSED NOT SIGN
+ 0x00aa: 0x00ac, # NOT SIGN
+ 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF
+ 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER
+ 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK
+ 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00b0: 0x2591, # LIGHT SHADE
+ 0x00b1: 0x2592, # MEDIUM SHADE
+ 0x00b2: 0x2593, # DARK SHADE
+ 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL
+ 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x00db: 0x2588, # FULL BLOCK
+ 0x00dc: 0x2584, # LOWER HALF BLOCK
+ 0x00dd: 0x258c, # LEFT HALF BLOCK
+ 0x00de: 0x2590, # RIGHT HALF BLOCK
+ 0x00df: 0x2580, # UPPER HALF BLOCK
+ 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA
+ 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S
+ 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA
+ 0x00e3: 0x03c0, # GREEK SMALL LETTER PI
+ 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA
+ 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA
+ 0x00e6: 0x00b5, # MICRO SIGN
+ 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU
+ 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI
+ 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA
+ 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA
+ 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA
+ 0x00ec: 0x221e, # INFINITY
+ 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI
+ 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON
+ 0x00ef: 0x2229, # INTERSECTION
+ 0x00f0: 0x2261, # IDENTICAL TO
+ 0x00f1: 0x00b1, # PLUS-MINUS SIGN
+ 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO
+ 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO
+ 0x00f4: 0x2320, # TOP HALF INTEGRAL
+ 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL
+ 0x00f6: 0x00f7, # DIVISION SIGN
+ 0x00f7: 0x2248, # ALMOST EQUAL TO
+ 0x00f8: 0x00b0, # DEGREE SIGN
+ 0x00f9: 0x2219, # BULLET OPERATOR
+ 0x00fa: 0x00b7, # MIDDLE DOT
+ 0x00fb: 0x221a, # SQUARE ROOT
+ 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N
+ 0x00fd: 0x00b2, # SUPERSCRIPT TWO
+ 0x00fe: 0x25a0, # BLACK SQUARE
+ 0x00ff: 0x00a0, # NO-BREAK SPACE
+})
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x0000 -> NULL
+ u'\x01' # 0x0001 -> START OF HEADING
+ u'\x02' # 0x0002 -> START OF TEXT
+ u'\x03' # 0x0003 -> END OF TEXT
+ u'\x04' # 0x0004 -> END OF TRANSMISSION
+ u'\x05' # 0x0005 -> ENQUIRY
+ u'\x06' # 0x0006 -> ACKNOWLEDGE
+ u'\x07' # 0x0007 -> BELL
+ u'\x08' # 0x0008 -> BACKSPACE
+ u'\t' # 0x0009 -> HORIZONTAL TABULATION
+ u'\n' # 0x000a -> LINE FEED
+ u'\x0b' # 0x000b -> VERTICAL TABULATION
+ u'\x0c' # 0x000c -> FORM FEED
+ u'\r' # 0x000d -> CARRIAGE RETURN
+ u'\x0e' # 0x000e -> SHIFT OUT
+ u'\x0f' # 0x000f -> SHIFT IN
+ u'\x10' # 0x0010 -> DATA LINK ESCAPE
+ u'\x11' # 0x0011 -> DEVICE CONTROL ONE
+ u'\x12' # 0x0012 -> DEVICE CONTROL TWO
+ u'\x13' # 0x0013 -> DEVICE CONTROL THREE
+ u'\x14' # 0x0014 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x0016 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x0018 -> CANCEL
+ u'\x19' # 0x0019 -> END OF MEDIUM
+ u'\x1a' # 0x001a -> SUBSTITUTE
+ u'\x1b' # 0x001b -> ESCAPE
+ u'\x1c' # 0x001c -> FILE SEPARATOR
+ u'\x1d' # 0x001d -> GROUP SEPARATOR
+ u'\x1e' # 0x001e -> RECORD SEPARATOR
+ u'\x1f' # 0x001f -> UNIT SEPARATOR
+ u' ' # 0x0020 -> SPACE
+ u'!' # 0x0021 -> EXCLAMATION MARK
+ u'"' # 0x0022 -> QUOTATION MARK
+ u'#' # 0x0023 -> NUMBER SIGN
+ u'$' # 0x0024 -> DOLLAR SIGN
+ u'%' # 0x0025 -> PERCENT SIGN
+ u'&' # 0x0026 -> AMPERSAND
+ u"'" # 0x0027 -> APOSTROPHE
+ u'(' # 0x0028 -> LEFT PARENTHESIS
+ u')' # 0x0029 -> RIGHT PARENTHESIS
+ u'*' # 0x002a -> ASTERISK
+ u'+' # 0x002b -> PLUS SIGN
+ u',' # 0x002c -> COMMA
+ u'-' # 0x002d -> HYPHEN-MINUS
+ u'.' # 0x002e -> FULL STOP
+ u'/' # 0x002f -> SOLIDUS
+ u'0' # 0x0030 -> DIGIT ZERO
+ u'1' # 0x0031 -> DIGIT ONE
+ u'2' # 0x0032 -> DIGIT TWO
+ u'3' # 0x0033 -> DIGIT THREE
+ u'4' # 0x0034 -> DIGIT FOUR
+ u'5' # 0x0035 -> DIGIT FIVE
+ u'6' # 0x0036 -> DIGIT SIX
+ u'7' # 0x0037 -> DIGIT SEVEN
+ u'8' # 0x0038 -> DIGIT EIGHT
+ u'9' # 0x0039 -> DIGIT NINE
+ u':' # 0x003a -> COLON
+ u';' # 0x003b -> SEMICOLON
+ u'<' # 0x003c -> LESS-THAN SIGN
+ u'=' # 0x003d -> EQUALS SIGN
+ u'>' # 0x003e -> GREATER-THAN SIGN
+ u'?' # 0x003f -> QUESTION MARK
+ u'@' # 0x0040 -> COMMERCIAL AT
+ u'A' # 0x0041 -> LATIN CAPITAL LETTER A
+ u'B' # 0x0042 -> LATIN CAPITAL LETTER B
+ u'C' # 0x0043 -> LATIN CAPITAL LETTER C
+ u'D' # 0x0044 -> LATIN CAPITAL LETTER D
+ u'E' # 0x0045 -> LATIN CAPITAL LETTER E
+ u'F' # 0x0046 -> LATIN CAPITAL LETTER F
+ u'G' # 0x0047 -> LATIN CAPITAL LETTER G
+ u'H' # 0x0048 -> LATIN CAPITAL LETTER H
+ u'I' # 0x0049 -> LATIN CAPITAL LETTER I
+ u'J' # 0x004a -> LATIN CAPITAL LETTER J
+ u'K' # 0x004b -> LATIN CAPITAL LETTER K
+ u'L' # 0x004c -> LATIN CAPITAL LETTER L
+ u'M' # 0x004d -> LATIN CAPITAL LETTER M
+ u'N' # 0x004e -> LATIN CAPITAL LETTER N
+ u'O' # 0x004f -> LATIN CAPITAL LETTER O
+ u'P' # 0x0050 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x0052 -> LATIN CAPITAL LETTER R
+ u'S' # 0x0053 -> LATIN CAPITAL LETTER S
+ u'T' # 0x0054 -> LATIN CAPITAL LETTER T
+ u'U' # 0x0055 -> LATIN CAPITAL LETTER U
+ u'V' # 0x0056 -> LATIN CAPITAL LETTER V
+ u'W' # 0x0057 -> LATIN CAPITAL LETTER W
+ u'X' # 0x0058 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x005a -> LATIN CAPITAL LETTER Z
+ u'[' # 0x005b -> LEFT SQUARE BRACKET
+ u'\\' # 0x005c -> REVERSE SOLIDUS
+ u']' # 0x005d -> RIGHT SQUARE BRACKET
+ u'^' # 0x005e -> CIRCUMFLEX ACCENT
+ u'_' # 0x005f -> LOW LINE
+ u'`' # 0x0060 -> GRAVE ACCENT
+ u'a' # 0x0061 -> LATIN SMALL LETTER A
+ u'b' # 0x0062 -> LATIN SMALL LETTER B
+ u'c' # 0x0063 -> LATIN SMALL LETTER C
+ u'd' # 0x0064 -> LATIN SMALL LETTER D
+ u'e' # 0x0065 -> LATIN SMALL LETTER E
+ u'f' # 0x0066 -> LATIN SMALL LETTER F
+ u'g' # 0x0067 -> LATIN SMALL LETTER G
+ u'h' # 0x0068 -> LATIN SMALL LETTER H
+ u'i' # 0x0069 -> LATIN SMALL LETTER I
+ u'j' # 0x006a -> LATIN SMALL LETTER J
+ u'k' # 0x006b -> LATIN SMALL LETTER K
+ u'l' # 0x006c -> LATIN SMALL LETTER L
+ u'm' # 0x006d -> LATIN SMALL LETTER M
+ u'n' # 0x006e -> LATIN SMALL LETTER N
+ u'o' # 0x006f -> LATIN SMALL LETTER O
+ u'p' # 0x0070 -> LATIN SMALL LETTER P
+ u'q' # 0x0071 -> LATIN SMALL LETTER Q
+ u'r' # 0x0072 -> LATIN SMALL LETTER R
+ u's' # 0x0073 -> LATIN SMALL LETTER S
+ u't' # 0x0074 -> LATIN SMALL LETTER T
+ u'u' # 0x0075 -> LATIN SMALL LETTER U
+ u'v' # 0x0076 -> LATIN SMALL LETTER V
+ u'w' # 0x0077 -> LATIN SMALL LETTER W
+ u'x' # 0x0078 -> LATIN SMALL LETTER X
+ u'y' # 0x0079 -> LATIN SMALL LETTER Y
+ u'z' # 0x007a -> LATIN SMALL LETTER Z
+ u'{' # 0x007b -> LEFT CURLY BRACKET
+ u'|' # 0x007c -> VERTICAL LINE
+ u'}' # 0x007d -> RIGHT CURLY BRACKET
+ u'~' # 0x007e -> TILDE
+ u'\x7f' # 0x007f -> DELETE
+ u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xd0' # 0x008b -> LATIN CAPITAL LETTER ETH
+ u'\xf0' # 0x008c -> LATIN SMALL LETTER ETH
+ u'\xde' # 0x008d -> LATIN CAPITAL LETTER THORN
+ u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE
+ u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE
+ u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xfe' # 0x0095 -> LATIN SMALL LETTER THORN
+ u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xdd' # 0x0097 -> LATIN CAPITAL LETTER Y WITH ACUTE
+ u'\xfd' # 0x0098 -> LATIN SMALL LETTER Y WITH ACUTE
+ u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE
+ u'\xa3' # 0x009c -> POUND SIGN
+ u'\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\u20a7' # 0x009e -> PESETA SIGN
+ u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK
+ u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xc1' # 0x00a4 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xcd' # 0x00a5 -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xd3' # 0x00a6 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xda' # 0x00a7 -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK
+ u'\u2310' # 0x00a9 -> REVERSED NOT SIGN
+ u'\xac' # 0x00aa -> NOT SIGN
+ u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF
+ u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER
+ u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK
+ u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2591' # 0x00b0 -> LIGHT SHADE
+ u'\u2592' # 0x00b1 -> MEDIUM SHADE
+ u'\u2593' # 0x00b2 -> DARK SHADE
+ u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL
+ u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL
+ u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT
+ u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT
+ u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT
+ u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT
+ u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL
+ u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
+ u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL
+ u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT
+ u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT
+ u'\u2588' # 0x00db -> FULL BLOCK
+ u'\u2584' # 0x00dc -> LOWER HALF BLOCK
+ u'\u258c' # 0x00dd -> LEFT HALF BLOCK
+ u'\u2590' # 0x00de -> RIGHT HALF BLOCK
+ u'\u2580' # 0x00df -> UPPER HALF BLOCK
+ u'\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA
+ u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S
+ u'\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA
+ u'\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI
+ u'\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA
+ u'\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA
+ u'\xb5' # 0x00e6 -> MICRO SIGN
+ u'\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU
+ u'\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI
+ u'\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA
+ u'\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA
+ u'\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA
+ u'\u221e' # 0x00ec -> INFINITY
+ u'\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI
+ u'\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON
+ u'\u2229' # 0x00ef -> INTERSECTION
+ u'\u2261' # 0x00f0 -> IDENTICAL TO
+ u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN
+ u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO
+ u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO
+ u'\u2320' # 0x00f4 -> TOP HALF INTEGRAL
+ u'\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL
+ u'\xf7' # 0x00f6 -> DIVISION SIGN
+ u'\u2248' # 0x00f7 -> ALMOST EQUAL TO
+ u'\xb0' # 0x00f8 -> DEGREE SIGN
+ u'\u2219' # 0x00f9 -> BULLET OPERATOR
+ u'\xb7' # 0x00fa -> MIDDLE DOT
+ u'\u221a' # 0x00fb -> SQUARE ROOT
+ u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N
+ u'\xb2' # 0x00fd -> SUPERSCRIPT TWO
+ u'\u25a0' # 0x00fe -> BLACK SQUARE
+ u'\xa0' # 0x00ff -> NO-BREAK SPACE
+)
+
+### Encoding Map
+
+encoding_map = {
+ 0x0000: 0x0000, # NULL
+ 0x0001: 0x0001, # START OF HEADING
+ 0x0002: 0x0002, # START OF TEXT
+ 0x0003: 0x0003, # END OF TEXT
+ 0x0004: 0x0004, # END OF TRANSMISSION
+ 0x0005: 0x0005, # ENQUIRY
+ 0x0006: 0x0006, # ACKNOWLEDGE
+ 0x0007: 0x0007, # BELL
+ 0x0008: 0x0008, # BACKSPACE
+ 0x0009: 0x0009, # HORIZONTAL TABULATION
+ 0x000a: 0x000a, # LINE FEED
+ 0x000b: 0x000b, # VERTICAL TABULATION
+ 0x000c: 0x000c, # FORM FEED
+ 0x000d: 0x000d, # CARRIAGE RETURN
+ 0x000e: 0x000e, # SHIFT OUT
+ 0x000f: 0x000f, # SHIFT IN
+ 0x0010: 0x0010, # DATA LINK ESCAPE
+ 0x0011: 0x0011, # DEVICE CONTROL ONE
+ 0x0012: 0x0012, # DEVICE CONTROL TWO
+ 0x0013: 0x0013, # DEVICE CONTROL THREE
+ 0x0014: 0x0014, # DEVICE CONTROL FOUR
+ 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE
+ 0x0016: 0x0016, # SYNCHRONOUS IDLE
+ 0x0017: 0x0017, # END OF TRANSMISSION BLOCK
+ 0x0018: 0x0018, # CANCEL
+ 0x0019: 0x0019, # END OF MEDIUM
+ 0x001a: 0x001a, # SUBSTITUTE
+ 0x001b: 0x001b, # ESCAPE
+ 0x001c: 0x001c, # FILE SEPARATOR
+ 0x001d: 0x001d, # GROUP SEPARATOR
+ 0x001e: 0x001e, # RECORD SEPARATOR
+ 0x001f: 0x001f, # UNIT SEPARATOR
+ 0x0020: 0x0020, # SPACE
+ 0x0021: 0x0021, # EXCLAMATION MARK
+ 0x0022: 0x0022, # QUOTATION MARK
+ 0x0023: 0x0023, # NUMBER SIGN
+ 0x0024: 0x0024, # DOLLAR SIGN
+ 0x0025: 0x0025, # PERCENT SIGN
+ 0x0026: 0x0026, # AMPERSAND
+ 0x0027: 0x0027, # APOSTROPHE
+ 0x0028: 0x0028, # LEFT PARENTHESIS
+ 0x0029: 0x0029, # RIGHT PARENTHESIS
+ 0x002a: 0x002a, # ASTERISK
+ 0x002b: 0x002b, # PLUS SIGN
+ 0x002c: 0x002c, # COMMA
+ 0x002d: 0x002d, # HYPHEN-MINUS
+ 0x002e: 0x002e, # FULL STOP
+ 0x002f: 0x002f, # SOLIDUS
+ 0x0030: 0x0030, # DIGIT ZERO
+ 0x0031: 0x0031, # DIGIT ONE
+ 0x0032: 0x0032, # DIGIT TWO
+ 0x0033: 0x0033, # DIGIT THREE
+ 0x0034: 0x0034, # DIGIT FOUR
+ 0x0035: 0x0035, # DIGIT FIVE
+ 0x0036: 0x0036, # DIGIT SIX
+ 0x0037: 0x0037, # DIGIT SEVEN
+ 0x0038: 0x0038, # DIGIT EIGHT
+ 0x0039: 0x0039, # DIGIT NINE
+ 0x003a: 0x003a, # COLON
+ 0x003b: 0x003b, # SEMICOLON
+ 0x003c: 0x003c, # LESS-THAN SIGN
+ 0x003d: 0x003d, # EQUALS SIGN
+ 0x003e: 0x003e, # GREATER-THAN SIGN
+ 0x003f: 0x003f, # QUESTION MARK
+ 0x0040: 0x0040, # COMMERCIAL AT
+ 0x0041: 0x0041, # LATIN CAPITAL LETTER A
+ 0x0042: 0x0042, # LATIN CAPITAL LETTER B
+ 0x0043: 0x0043, # LATIN CAPITAL LETTER C
+ 0x0044: 0x0044, # LATIN CAPITAL LETTER D
+ 0x0045: 0x0045, # LATIN CAPITAL LETTER E
+ 0x0046: 0x0046, # LATIN CAPITAL LETTER F
+ 0x0047: 0x0047, # LATIN CAPITAL LETTER G
+ 0x0048: 0x0048, # LATIN CAPITAL LETTER H
+ 0x0049: 0x0049, # LATIN CAPITAL LETTER I
+ 0x004a: 0x004a, # LATIN CAPITAL LETTER J
+ 0x004b: 0x004b, # LATIN CAPITAL LETTER K
+ 0x004c: 0x004c, # LATIN CAPITAL LETTER L
+ 0x004d: 0x004d, # LATIN CAPITAL LETTER M
+ 0x004e: 0x004e, # LATIN CAPITAL LETTER N
+ 0x004f: 0x004f, # LATIN CAPITAL LETTER O
+ 0x0050: 0x0050, # LATIN CAPITAL LETTER P
+ 0x0051: 0x0051, # LATIN CAPITAL LETTER Q
+ 0x0052: 0x0052, # LATIN CAPITAL LETTER R
+ 0x0053: 0x0053, # LATIN CAPITAL LETTER S
+ 0x0054: 0x0054, # LATIN CAPITAL LETTER T
+ 0x0055: 0x0055, # LATIN CAPITAL LETTER U
+ 0x0056: 0x0056, # LATIN CAPITAL LETTER V
+ 0x0057: 0x0057, # LATIN CAPITAL LETTER W
+ 0x0058: 0x0058, # LATIN CAPITAL LETTER X
+ 0x0059: 0x0059, # LATIN CAPITAL LETTER Y
+ 0x005a: 0x005a, # LATIN CAPITAL LETTER Z
+ 0x005b: 0x005b, # LEFT SQUARE BRACKET
+ 0x005c: 0x005c, # REVERSE SOLIDUS
+ 0x005d: 0x005d, # RIGHT SQUARE BRACKET
+ 0x005e: 0x005e, # CIRCUMFLEX ACCENT
+ 0x005f: 0x005f, # LOW LINE
+ 0x0060: 0x0060, # GRAVE ACCENT
+ 0x0061: 0x0061, # LATIN SMALL LETTER A
+ 0x0062: 0x0062, # LATIN SMALL LETTER B
+ 0x0063: 0x0063, # LATIN SMALL LETTER C
+ 0x0064: 0x0064, # LATIN SMALL LETTER D
+ 0x0065: 0x0065, # LATIN SMALL LETTER E
+ 0x0066: 0x0066, # LATIN SMALL LETTER F
+ 0x0067: 0x0067, # LATIN SMALL LETTER G
+ 0x0068: 0x0068, # LATIN SMALL LETTER H
+ 0x0069: 0x0069, # LATIN SMALL LETTER I
+ 0x006a: 0x006a, # LATIN SMALL LETTER J
+ 0x006b: 0x006b, # LATIN SMALL LETTER K
+ 0x006c: 0x006c, # LATIN SMALL LETTER L
+ 0x006d: 0x006d, # LATIN SMALL LETTER M
+ 0x006e: 0x006e, # LATIN SMALL LETTER N
+ 0x006f: 0x006f, # LATIN SMALL LETTER O
+ 0x0070: 0x0070, # LATIN SMALL LETTER P
+ 0x0071: 0x0071, # LATIN SMALL LETTER Q
+ 0x0072: 0x0072, # LATIN SMALL LETTER R
+ 0x0073: 0x0073, # LATIN SMALL LETTER S
+ 0x0074: 0x0074, # LATIN SMALL LETTER T
+ 0x0075: 0x0075, # LATIN SMALL LETTER U
+ 0x0076: 0x0076, # LATIN SMALL LETTER V
+ 0x0077: 0x0077, # LATIN SMALL LETTER W
+ 0x0078: 0x0078, # LATIN SMALL LETTER X
+ 0x0079: 0x0079, # LATIN SMALL LETTER Y
+ 0x007a: 0x007a, # LATIN SMALL LETTER Z
+ 0x007b: 0x007b, # LEFT CURLY BRACKET
+ 0x007c: 0x007c, # VERTICAL LINE
+ 0x007d: 0x007d, # RIGHT CURLY BRACKET
+ 0x007e: 0x007e, # TILDE
+ 0x007f: 0x007f, # DELETE
+ 0x00a0: 0x00ff, # NO-BREAK SPACE
+ 0x00a1: 0x00ad, # INVERTED EXCLAMATION MARK
+ 0x00a3: 0x009c, # POUND SIGN
+ 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00ac: 0x00aa, # NOT SIGN
+ 0x00b0: 0x00f8, # DEGREE SIGN
+ 0x00b1: 0x00f1, # PLUS-MINUS SIGN
+ 0x00b2: 0x00fd, # SUPERSCRIPT TWO
+ 0x00b5: 0x00e6, # MICRO SIGN
+ 0x00b7: 0x00fa, # MIDDLE DOT
+ 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER
+ 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF
+ 0x00bf: 0x00a8, # INVERTED QUESTION MARK
+ 0x00c1: 0x00a4, # LATIN CAPITAL LETTER A WITH ACUTE
+ 0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x00c5: 0x008f, # LATIN CAPITAL LETTER A WITH RING ABOVE
+ 0x00c6: 0x0092, # LATIN CAPITAL LIGATURE AE
+ 0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x00cd: 0x00a5, # LATIN CAPITAL LETTER I WITH ACUTE
+ 0x00d0: 0x008b, # LATIN CAPITAL LETTER ETH
+ 0x00d3: 0x00a6, # LATIN CAPITAL LETTER O WITH ACUTE
+ 0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x00d8: 0x009d, # LATIN CAPITAL LETTER O WITH STROKE
+ 0x00da: 0x00a7, # LATIN CAPITAL LETTER U WITH ACUTE
+ 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x00dd: 0x0097, # LATIN CAPITAL LETTER Y WITH ACUTE
+ 0x00de: 0x008d, # LATIN CAPITAL LETTER THORN
+ 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S
+ 0x00e0: 0x0085, # LATIN SMALL LETTER A WITH GRAVE
+ 0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x00e5: 0x0086, # LATIN SMALL LETTER A WITH RING ABOVE
+ 0x00e6: 0x0091, # LATIN SMALL LIGATURE AE
+ 0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x00e8: 0x008a, # LATIN SMALL LETTER E WITH GRAVE
+ 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE
+ 0x00ea: 0x0088, # LATIN SMALL LETTER E WITH CIRCUMFLEX
+ 0x00eb: 0x0089, # LATIN SMALL LETTER E WITH DIAERESIS
+ 0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00f0: 0x008c, # LATIN SMALL LETTER ETH
+ 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x00f7: 0x00f6, # DIVISION SIGN
+ 0x00f8: 0x009b, # LATIN SMALL LETTER O WITH STROKE
+ 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00fb: 0x0096, # LATIN SMALL LETTER U WITH CIRCUMFLEX
+ 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x00fd: 0x0098, # LATIN SMALL LETTER Y WITH ACUTE
+ 0x00fe: 0x0095, # LATIN SMALL LETTER THORN
+ 0x0192: 0x009f, # LATIN SMALL LETTER F WITH HOOK
+ 0x0393: 0x00e2, # GREEK CAPITAL LETTER GAMMA
+ 0x0398: 0x00e9, # GREEK CAPITAL LETTER THETA
+ 0x03a3: 0x00e4, # GREEK CAPITAL LETTER SIGMA
+ 0x03a6: 0x00e8, # GREEK CAPITAL LETTER PHI
+ 0x03a9: 0x00ea, # GREEK CAPITAL LETTER OMEGA
+ 0x03b1: 0x00e0, # GREEK SMALL LETTER ALPHA
+ 0x03b4: 0x00eb, # GREEK SMALL LETTER DELTA
+ 0x03b5: 0x00ee, # GREEK SMALL LETTER EPSILON
+ 0x03c0: 0x00e3, # GREEK SMALL LETTER PI
+ 0x03c3: 0x00e5, # GREEK SMALL LETTER SIGMA
+ 0x03c4: 0x00e7, # GREEK SMALL LETTER TAU
+ 0x03c6: 0x00ed, # GREEK SMALL LETTER PHI
+ 0x207f: 0x00fc, # SUPERSCRIPT LATIN SMALL LETTER N
+ 0x20a7: 0x009e, # PESETA SIGN
+ 0x2219: 0x00f9, # BULLET OPERATOR
+ 0x221a: 0x00fb, # SQUARE ROOT
+ 0x221e: 0x00ec, # INFINITY
+ 0x2229: 0x00ef, # INTERSECTION
+ 0x2248: 0x00f7, # ALMOST EQUAL TO
+ 0x2261: 0x00f0, # IDENTICAL TO
+ 0x2264: 0x00f3, # LESS-THAN OR EQUAL TO
+ 0x2265: 0x00f2, # GREATER-THAN OR EQUAL TO
+ 0x2310: 0x00a9, # REVERSED NOT SIGN
+ 0x2320: 0x00f4, # TOP HALF INTEGRAL
+ 0x2321: 0x00f5, # BOTTOM HALF INTEGRAL
+ 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL
+ 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x2552: 0x00d5, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ 0x2553: 0x00d6, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x2555: 0x00b8, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ 0x2556: 0x00b7, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x2558: 0x00d4, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ 0x2559: 0x00d3, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x255b: 0x00be, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ 0x255c: 0x00bd, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x255e: 0x00c6, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ 0x255f: 0x00c7, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x2561: 0x00b5, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ 0x2562: 0x00b6, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x2564: 0x00d1, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ 0x2565: 0x00d2, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x2567: 0x00cf, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ 0x2568: 0x00d0, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x256a: 0x00d8, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ 0x256b: 0x00d7, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x2580: 0x00df, # UPPER HALF BLOCK
+ 0x2584: 0x00dc, # LOWER HALF BLOCK
+ 0x2588: 0x00db, # FULL BLOCK
+ 0x258c: 0x00dd, # LEFT HALF BLOCK
+ 0x2590: 0x00de, # RIGHT HALF BLOCK
+ 0x2591: 0x00b0, # LIGHT SHADE
+ 0x2592: 0x00b1, # MEDIUM SHADE
+ 0x2593: 0x00b2, # DARK SHADE
+ 0x25a0: 0x00fe, # BLACK SQUARE
+}
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
index 0000000000..ac81345349
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp862.py
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP862.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp862',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0080: 0x05d0, # HEBREW LETTER ALEF
+ 0x0081: 0x05d1, # HEBREW LETTER BET
+ 0x0082: 0x05d2, # HEBREW LETTER GIMEL
+ 0x0083: 0x05d3, # HEBREW LETTER DALET
+ 0x0084: 0x05d4, # HEBREW LETTER HE
+ 0x0085: 0x05d5, # HEBREW LETTER VAV
+ 0x0086: 0x05d6, # HEBREW LETTER ZAYIN
+ 0x0087: 0x05d7, # HEBREW LETTER HET
+ 0x0088: 0x05d8, # HEBREW LETTER TET
+ 0x0089: 0x05d9, # HEBREW LETTER YOD
+ 0x008a: 0x05da, # HEBREW LETTER FINAL KAF
+ 0x008b: 0x05db, # HEBREW LETTER KAF
+ 0x008c: 0x05dc, # HEBREW LETTER LAMED
+ 0x008d: 0x05dd, # HEBREW LETTER FINAL MEM
+ 0x008e: 0x05de, # HEBREW LETTER MEM
+ 0x008f: 0x05df, # HEBREW LETTER FINAL NUN
+ 0x0090: 0x05e0, # HEBREW LETTER NUN
+ 0x0091: 0x05e1, # HEBREW LETTER SAMEKH
+ 0x0092: 0x05e2, # HEBREW LETTER AYIN
+ 0x0093: 0x05e3, # HEBREW LETTER FINAL PE
+ 0x0094: 0x05e4, # HEBREW LETTER PE
+ 0x0095: 0x05e5, # HEBREW LETTER FINAL TSADI
+ 0x0096: 0x05e6, # HEBREW LETTER TSADI
+ 0x0097: 0x05e7, # HEBREW LETTER QOF
+ 0x0098: 0x05e8, # HEBREW LETTER RESH
+ 0x0099: 0x05e9, # HEBREW LETTER SHIN
+ 0x009a: 0x05ea, # HEBREW LETTER TAV
+ 0x009b: 0x00a2, # CENT SIGN
+ 0x009c: 0x00a3, # POUND SIGN
+ 0x009d: 0x00a5, # YEN SIGN
+ 0x009e: 0x20a7, # PESETA SIGN
+ 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK
+ 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE
+ 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE
+ 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR
+ 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR
+ 0x00a8: 0x00bf, # INVERTED QUESTION MARK
+ 0x00a9: 0x2310, # REVERSED NOT SIGN
+ 0x00aa: 0x00ac, # NOT SIGN
+ 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF
+ 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER
+ 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK
+ 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00b0: 0x2591, # LIGHT SHADE
+ 0x00b1: 0x2592, # MEDIUM SHADE
+ 0x00b2: 0x2593, # DARK SHADE
+ 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL
+ 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x00db: 0x2588, # FULL BLOCK
+ 0x00dc: 0x2584, # LOWER HALF BLOCK
+ 0x00dd: 0x258c, # LEFT HALF BLOCK
+ 0x00de: 0x2590, # RIGHT HALF BLOCK
+ 0x00df: 0x2580, # UPPER HALF BLOCK
+ 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA
+ 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S (GERMAN)
+ 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA
+ 0x00e3: 0x03c0, # GREEK SMALL LETTER PI
+ 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA
+ 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA
+ 0x00e6: 0x00b5, # MICRO SIGN
+ 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU
+ 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI
+ 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA
+ 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA
+ 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA
+ 0x00ec: 0x221e, # INFINITY
+ 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI
+ 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON
+ 0x00ef: 0x2229, # INTERSECTION
+ 0x00f0: 0x2261, # IDENTICAL TO
+ 0x00f1: 0x00b1, # PLUS-MINUS SIGN
+ 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO
+ 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO
+ 0x00f4: 0x2320, # TOP HALF INTEGRAL
+ 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL
+ 0x00f6: 0x00f7, # DIVISION SIGN
+ 0x00f7: 0x2248, # ALMOST EQUAL TO
+ 0x00f8: 0x00b0, # DEGREE SIGN
+ 0x00f9: 0x2219, # BULLET OPERATOR
+ 0x00fa: 0x00b7, # MIDDLE DOT
+ 0x00fb: 0x221a, # SQUARE ROOT
+ 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N
+ 0x00fd: 0x00b2, # SUPERSCRIPT TWO
+ 0x00fe: 0x25a0, # BLACK SQUARE
+ 0x00ff: 0x00a0, # NO-BREAK SPACE
+})
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x0000 -> NULL
+ u'\x01' # 0x0001 -> START OF HEADING
+ u'\x02' # 0x0002 -> START OF TEXT
+ u'\x03' # 0x0003 -> END OF TEXT
+ u'\x04' # 0x0004 -> END OF TRANSMISSION
+ u'\x05' # 0x0005 -> ENQUIRY
+ u'\x06' # 0x0006 -> ACKNOWLEDGE
+ u'\x07' # 0x0007 -> BELL
+ u'\x08' # 0x0008 -> BACKSPACE
+ u'\t' # 0x0009 -> HORIZONTAL TABULATION
+ u'\n' # 0x000a -> LINE FEED
+ u'\x0b' # 0x000b -> VERTICAL TABULATION
+ u'\x0c' # 0x000c -> FORM FEED
+ u'\r' # 0x000d -> CARRIAGE RETURN
+ u'\x0e' # 0x000e -> SHIFT OUT
+ u'\x0f' # 0x000f -> SHIFT IN
+ u'\x10' # 0x0010 -> DATA LINK ESCAPE
+ u'\x11' # 0x0011 -> DEVICE CONTROL ONE
+ u'\x12' # 0x0012 -> DEVICE CONTROL TWO
+ u'\x13' # 0x0013 -> DEVICE CONTROL THREE
+ u'\x14' # 0x0014 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x0016 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x0018 -> CANCEL
+ u'\x19' # 0x0019 -> END OF MEDIUM
+ u'\x1a' # 0x001a -> SUBSTITUTE
+ u'\x1b' # 0x001b -> ESCAPE
+ u'\x1c' # 0x001c -> FILE SEPARATOR
+ u'\x1d' # 0x001d -> GROUP SEPARATOR
+ u'\x1e' # 0x001e -> RECORD SEPARATOR
+ u'\x1f' # 0x001f -> UNIT SEPARATOR
+ u' ' # 0x0020 -> SPACE
+ u'!' # 0x0021 -> EXCLAMATION MARK
+ u'"' # 0x0022 -> QUOTATION MARK
+ u'#' # 0x0023 -> NUMBER SIGN
+ u'$' # 0x0024 -> DOLLAR SIGN
+ u'%' # 0x0025 -> PERCENT SIGN
+ u'&' # 0x0026 -> AMPERSAND
+ u"'" # 0x0027 -> APOSTROPHE
+ u'(' # 0x0028 -> LEFT PARENTHESIS
+ u')' # 0x0029 -> RIGHT PARENTHESIS
+ u'*' # 0x002a -> ASTERISK
+ u'+' # 0x002b -> PLUS SIGN
+ u',' # 0x002c -> COMMA
+ u'-' # 0x002d -> HYPHEN-MINUS
+ u'.' # 0x002e -> FULL STOP
+ u'/' # 0x002f -> SOLIDUS
+ u'0' # 0x0030 -> DIGIT ZERO
+ u'1' # 0x0031 -> DIGIT ONE
+ u'2' # 0x0032 -> DIGIT TWO
+ u'3' # 0x0033 -> DIGIT THREE
+ u'4' # 0x0034 -> DIGIT FOUR
+ u'5' # 0x0035 -> DIGIT FIVE
+ u'6' # 0x0036 -> DIGIT SIX
+ u'7' # 0x0037 -> DIGIT SEVEN
+ u'8' # 0x0038 -> DIGIT EIGHT
+ u'9' # 0x0039 -> DIGIT NINE
+ u':' # 0x003a -> COLON
+ u';' # 0x003b -> SEMICOLON
+ u'<' # 0x003c -> LESS-THAN SIGN
+ u'=' # 0x003d -> EQUALS SIGN
+ u'>' # 0x003e -> GREATER-THAN SIGN
+ u'?' # 0x003f -> QUESTION MARK
+ u'@' # 0x0040 -> COMMERCIAL AT
+ u'A' # 0x0041 -> LATIN CAPITAL LETTER A
+ u'B' # 0x0042 -> LATIN CAPITAL LETTER B
+ u'C' # 0x0043 -> LATIN CAPITAL LETTER C
+ u'D' # 0x0044 -> LATIN CAPITAL LETTER D
+ u'E' # 0x0045 -> LATIN CAPITAL LETTER E
+ u'F' # 0x0046 -> LATIN CAPITAL LETTER F
+ u'G' # 0x0047 -> LATIN CAPITAL LETTER G
+ u'H' # 0x0048 -> LATIN CAPITAL LETTER H
+ u'I' # 0x0049 -> LATIN CAPITAL LETTER I
+ u'J' # 0x004a -> LATIN CAPITAL LETTER J
+ u'K' # 0x004b -> LATIN CAPITAL LETTER K
+ u'L' # 0x004c -> LATIN CAPITAL LETTER L
+ u'M' # 0x004d -> LATIN CAPITAL LETTER M
+ u'N' # 0x004e -> LATIN CAPITAL LETTER N
+ u'O' # 0x004f -> LATIN CAPITAL LETTER O
+ u'P' # 0x0050 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x0052 -> LATIN CAPITAL LETTER R
+ u'S' # 0x0053 -> LATIN CAPITAL LETTER S
+ u'T' # 0x0054 -> LATIN CAPITAL LETTER T
+ u'U' # 0x0055 -> LATIN CAPITAL LETTER U
+ u'V' # 0x0056 -> LATIN CAPITAL LETTER V
+ u'W' # 0x0057 -> LATIN CAPITAL LETTER W
+ u'X' # 0x0058 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x005a -> LATIN CAPITAL LETTER Z
+ u'[' # 0x005b -> LEFT SQUARE BRACKET
+ u'\\' # 0x005c -> REVERSE SOLIDUS
+ u']' # 0x005d -> RIGHT SQUARE BRACKET
+ u'^' # 0x005e -> CIRCUMFLEX ACCENT
+ u'_' # 0x005f -> LOW LINE
+ u'`' # 0x0060 -> GRAVE ACCENT
+ u'a' # 0x0061 -> LATIN SMALL LETTER A
+ u'b' # 0x0062 -> LATIN SMALL LETTER B
+ u'c' # 0x0063 -> LATIN SMALL LETTER C
+ u'd' # 0x0064 -> LATIN SMALL LETTER D
+ u'e' # 0x0065 -> LATIN SMALL LETTER E
+ u'f' # 0x0066 -> LATIN SMALL LETTER F
+ u'g' # 0x0067 -> LATIN SMALL LETTER G
+ u'h' # 0x0068 -> LATIN SMALL LETTER H
+ u'i' # 0x0069 -> LATIN SMALL LETTER I
+ u'j' # 0x006a -> LATIN SMALL LETTER J
+ u'k' # 0x006b -> LATIN SMALL LETTER K
+ u'l' # 0x006c -> LATIN SMALL LETTER L
+ u'm' # 0x006d -> LATIN SMALL LETTER M
+ u'n' # 0x006e -> LATIN SMALL LETTER N
+ u'o' # 0x006f -> LATIN SMALL LETTER O
+ u'p' # 0x0070 -> LATIN SMALL LETTER P
+ u'q' # 0x0071 -> LATIN SMALL LETTER Q
+ u'r' # 0x0072 -> LATIN SMALL LETTER R
+ u's' # 0x0073 -> LATIN SMALL LETTER S
+ u't' # 0x0074 -> LATIN SMALL LETTER T
+ u'u' # 0x0075 -> LATIN SMALL LETTER U
+ u'v' # 0x0076 -> LATIN SMALL LETTER V
+ u'w' # 0x0077 -> LATIN SMALL LETTER W
+ u'x' # 0x0078 -> LATIN SMALL LETTER X
+ u'y' # 0x0079 -> LATIN SMALL LETTER Y
+ u'z' # 0x007a -> LATIN SMALL LETTER Z
+ u'{' # 0x007b -> LEFT CURLY BRACKET
+ u'|' # 0x007c -> VERTICAL LINE
+ u'}' # 0x007d -> RIGHT CURLY BRACKET
+ u'~' # 0x007e -> TILDE
+ u'\x7f' # 0x007f -> DELETE
+ u'\u05d0' # 0x0080 -> HEBREW LETTER ALEF
+ u'\u05d1' # 0x0081 -> HEBREW LETTER BET
+ u'\u05d2' # 0x0082 -> HEBREW LETTER GIMEL
+ u'\u05d3' # 0x0083 -> HEBREW LETTER DALET
+ u'\u05d4' # 0x0084 -> HEBREW LETTER HE
+ u'\u05d5' # 0x0085 -> HEBREW LETTER VAV
+ u'\u05d6' # 0x0086 -> HEBREW LETTER ZAYIN
+ u'\u05d7' # 0x0087 -> HEBREW LETTER HET
+ u'\u05d8' # 0x0088 -> HEBREW LETTER TET
+ u'\u05d9' # 0x0089 -> HEBREW LETTER YOD
+ u'\u05da' # 0x008a -> HEBREW LETTER FINAL KAF
+ u'\u05db' # 0x008b -> HEBREW LETTER KAF
+ u'\u05dc' # 0x008c -> HEBREW LETTER LAMED
+ u'\u05dd' # 0x008d -> HEBREW LETTER FINAL MEM
+ u'\u05de' # 0x008e -> HEBREW LETTER MEM
+ u'\u05df' # 0x008f -> HEBREW LETTER FINAL NUN
+ u'\u05e0' # 0x0090 -> HEBREW LETTER NUN
+ u'\u05e1' # 0x0091 -> HEBREW LETTER SAMEKH
+ u'\u05e2' # 0x0092 -> HEBREW LETTER AYIN
+ u'\u05e3' # 0x0093 -> HEBREW LETTER FINAL PE
+ u'\u05e4' # 0x0094 -> HEBREW LETTER PE
+ u'\u05e5' # 0x0095 -> HEBREW LETTER FINAL TSADI
+ u'\u05e6' # 0x0096 -> HEBREW LETTER TSADI
+ u'\u05e7' # 0x0097 -> HEBREW LETTER QOF
+ u'\u05e8' # 0x0098 -> HEBREW LETTER RESH
+ u'\u05e9' # 0x0099 -> HEBREW LETTER SHIN
+ u'\u05ea' # 0x009a -> HEBREW LETTER TAV
+ u'\xa2' # 0x009b -> CENT SIGN
+ u'\xa3' # 0x009c -> POUND SIGN
+ u'\xa5' # 0x009d -> YEN SIGN
+ u'\u20a7' # 0x009e -> PESETA SIGN
+ u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK
+ u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR
+ u'\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR
+ u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK
+ u'\u2310' # 0x00a9 -> REVERSED NOT SIGN
+ u'\xac' # 0x00aa -> NOT SIGN
+ u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF
+ u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER
+ u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK
+ u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2591' # 0x00b0 -> LIGHT SHADE
+ u'\u2592' # 0x00b1 -> MEDIUM SHADE
+ u'\u2593' # 0x00b2 -> DARK SHADE
+ u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL
+ u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL
+ u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT
+ u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT
+ u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT
+ u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT
+ u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL
+ u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
+ u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL
+ u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT
+ u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT
+ u'\u2588' # 0x00db -> FULL BLOCK
+ u'\u2584' # 0x00dc -> LOWER HALF BLOCK
+ u'\u258c' # 0x00dd -> LEFT HALF BLOCK
+ u'\u2590' # 0x00de -> RIGHT HALF BLOCK
+ u'\u2580' # 0x00df -> UPPER HALF BLOCK
+ u'\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA
+ u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S (GERMAN)
+ u'\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA
+ u'\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI
+ u'\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA
+ u'\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA
+ u'\xb5' # 0x00e6 -> MICRO SIGN
+ u'\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU
+ u'\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI
+ u'\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA
+ u'\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA
+ u'\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA
+ u'\u221e' # 0x00ec -> INFINITY
+ u'\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI
+ u'\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON
+ u'\u2229' # 0x00ef -> INTERSECTION
+ u'\u2261' # 0x00f0 -> IDENTICAL TO
+ u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN
+ u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO
+ u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO
+ u'\u2320' # 0x00f4 -> TOP HALF INTEGRAL
+ u'\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL
+ u'\xf7' # 0x00f6 -> DIVISION SIGN
+ u'\u2248' # 0x00f7 -> ALMOST EQUAL TO
+ u'\xb0' # 0x00f8 -> DEGREE SIGN
+ u'\u2219' # 0x00f9 -> BULLET OPERATOR
+ u'\xb7' # 0x00fa -> MIDDLE DOT
+ u'\u221a' # 0x00fb -> SQUARE ROOT
+ u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N
+ u'\xb2' # 0x00fd -> SUPERSCRIPT TWO
+ u'\u25a0' # 0x00fe -> BLACK SQUARE
+ u'\xa0' # 0x00ff -> NO-BREAK SPACE
+)
+
+### Encoding Map
+
+encoding_map = {
+ 0x0000: 0x0000, # NULL
+ 0x0001: 0x0001, # START OF HEADING
+ 0x0002: 0x0002, # START OF TEXT
+ 0x0003: 0x0003, # END OF TEXT
+ 0x0004: 0x0004, # END OF TRANSMISSION
+ 0x0005: 0x0005, # ENQUIRY
+ 0x0006: 0x0006, # ACKNOWLEDGE
+ 0x0007: 0x0007, # BELL
+ 0x0008: 0x0008, # BACKSPACE
+ 0x0009: 0x0009, # HORIZONTAL TABULATION
+ 0x000a: 0x000a, # LINE FEED
+ 0x000b: 0x000b, # VERTICAL TABULATION
+ 0x000c: 0x000c, # FORM FEED
+ 0x000d: 0x000d, # CARRIAGE RETURN
+ 0x000e: 0x000e, # SHIFT OUT
+ 0x000f: 0x000f, # SHIFT IN
+ 0x0010: 0x0010, # DATA LINK ESCAPE
+ 0x0011: 0x0011, # DEVICE CONTROL ONE
+ 0x0012: 0x0012, # DEVICE CONTROL TWO
+ 0x0013: 0x0013, # DEVICE CONTROL THREE
+ 0x0014: 0x0014, # DEVICE CONTROL FOUR
+ 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE
+ 0x0016: 0x0016, # SYNCHRONOUS IDLE
+ 0x0017: 0x0017, # END OF TRANSMISSION BLOCK
+ 0x0018: 0x0018, # CANCEL
+ 0x0019: 0x0019, # END OF MEDIUM
+ 0x001a: 0x001a, # SUBSTITUTE
+ 0x001b: 0x001b, # ESCAPE
+ 0x001c: 0x001c, # FILE SEPARATOR
+ 0x001d: 0x001d, # GROUP SEPARATOR
+ 0x001e: 0x001e, # RECORD SEPARATOR
+ 0x001f: 0x001f, # UNIT SEPARATOR
+ 0x0020: 0x0020, # SPACE
+ 0x0021: 0x0021, # EXCLAMATION MARK
+ 0x0022: 0x0022, # QUOTATION MARK
+ 0x0023: 0x0023, # NUMBER SIGN
+ 0x0024: 0x0024, # DOLLAR SIGN
+ 0x0025: 0x0025, # PERCENT SIGN
+ 0x0026: 0x0026, # AMPERSAND
+ 0x0027: 0x0027, # APOSTROPHE
+ 0x0028: 0x0028, # LEFT PARENTHESIS
+ 0x0029: 0x0029, # RIGHT PARENTHESIS
+ 0x002a: 0x002a, # ASTERISK
+ 0x002b: 0x002b, # PLUS SIGN
+ 0x002c: 0x002c, # COMMA
+ 0x002d: 0x002d, # HYPHEN-MINUS
+ 0x002e: 0x002e, # FULL STOP
+ 0x002f: 0x002f, # SOLIDUS
+ 0x0030: 0x0030, # DIGIT ZERO
+ 0x0031: 0x0031, # DIGIT ONE
+ 0x0032: 0x0032, # DIGIT TWO
+ 0x0033: 0x0033, # DIGIT THREE
+ 0x0034: 0x0034, # DIGIT FOUR
+ 0x0035: 0x0035, # DIGIT FIVE
+ 0x0036: 0x0036, # DIGIT SIX
+ 0x0037: 0x0037, # DIGIT SEVEN
+ 0x0038: 0x0038, # DIGIT EIGHT
+ 0x0039: 0x0039, # DIGIT NINE
+ 0x003a: 0x003a, # COLON
+ 0x003b: 0x003b, # SEMICOLON
+ 0x003c: 0x003c, # LESS-THAN SIGN
+ 0x003d: 0x003d, # EQUALS SIGN
+ 0x003e: 0x003e, # GREATER-THAN SIGN
+ 0x003f: 0x003f, # QUESTION MARK
+ 0x0040: 0x0040, # COMMERCIAL AT
+ 0x0041: 0x0041, # LATIN CAPITAL LETTER A
+ 0x0042: 0x0042, # LATIN CAPITAL LETTER B
+ 0x0043: 0x0043, # LATIN CAPITAL LETTER C
+ 0x0044: 0x0044, # LATIN CAPITAL LETTER D
+ 0x0045: 0x0045, # LATIN CAPITAL LETTER E
+ 0x0046: 0x0046, # LATIN CAPITAL LETTER F
+ 0x0047: 0x0047, # LATIN CAPITAL LETTER G
+ 0x0048: 0x0048, # LATIN CAPITAL LETTER H
+ 0x0049: 0x0049, # LATIN CAPITAL LETTER I
+ 0x004a: 0x004a, # LATIN CAPITAL LETTER J
+ 0x004b: 0x004b, # LATIN CAPITAL LETTER K
+ 0x004c: 0x004c, # LATIN CAPITAL LETTER L
+ 0x004d: 0x004d, # LATIN CAPITAL LETTER M
+ 0x004e: 0x004e, # LATIN CAPITAL LETTER N
+ 0x004f: 0x004f, # LATIN CAPITAL LETTER O
+ 0x0050: 0x0050, # LATIN CAPITAL LETTER P
+ 0x0051: 0x0051, # LATIN CAPITAL LETTER Q
+ 0x0052: 0x0052, # LATIN CAPITAL LETTER R
+ 0x0053: 0x0053, # LATIN CAPITAL LETTER S
+ 0x0054: 0x0054, # LATIN CAPITAL LETTER T
+ 0x0055: 0x0055, # LATIN CAPITAL LETTER U
+ 0x0056: 0x0056, # LATIN CAPITAL LETTER V
+ 0x0057: 0x0057, # LATIN CAPITAL LETTER W
+ 0x0058: 0x0058, # LATIN CAPITAL LETTER X
+ 0x0059: 0x0059, # LATIN CAPITAL LETTER Y
+ 0x005a: 0x005a, # LATIN CAPITAL LETTER Z
+ 0x005b: 0x005b, # LEFT SQUARE BRACKET
+ 0x005c: 0x005c, # REVERSE SOLIDUS
+ 0x005d: 0x005d, # RIGHT SQUARE BRACKET
+ 0x005e: 0x005e, # CIRCUMFLEX ACCENT
+ 0x005f: 0x005f, # LOW LINE
+ 0x0060: 0x0060, # GRAVE ACCENT
+ 0x0061: 0x0061, # LATIN SMALL LETTER A
+ 0x0062: 0x0062, # LATIN SMALL LETTER B
+ 0x0063: 0x0063, # LATIN SMALL LETTER C
+ 0x0064: 0x0064, # LATIN SMALL LETTER D
+ 0x0065: 0x0065, # LATIN SMALL LETTER E
+ 0x0066: 0x0066, # LATIN SMALL LETTER F
+ 0x0067: 0x0067, # LATIN SMALL LETTER G
+ 0x0068: 0x0068, # LATIN SMALL LETTER H
+ 0x0069: 0x0069, # LATIN SMALL LETTER I
+ 0x006a: 0x006a, # LATIN SMALL LETTER J
+ 0x006b: 0x006b, # LATIN SMALL LETTER K
+ 0x006c: 0x006c, # LATIN SMALL LETTER L
+ 0x006d: 0x006d, # LATIN SMALL LETTER M
+ 0x006e: 0x006e, # LATIN SMALL LETTER N
+ 0x006f: 0x006f, # LATIN SMALL LETTER O
+ 0x0070: 0x0070, # LATIN SMALL LETTER P
+ 0x0071: 0x0071, # LATIN SMALL LETTER Q
+ 0x0072: 0x0072, # LATIN SMALL LETTER R
+ 0x0073: 0x0073, # LATIN SMALL LETTER S
+ 0x0074: 0x0074, # LATIN SMALL LETTER T
+ 0x0075: 0x0075, # LATIN SMALL LETTER U
+ 0x0076: 0x0076, # LATIN SMALL LETTER V
+ 0x0077: 0x0077, # LATIN SMALL LETTER W
+ 0x0078: 0x0078, # LATIN SMALL LETTER X
+ 0x0079: 0x0079, # LATIN SMALL LETTER Y
+ 0x007a: 0x007a, # LATIN SMALL LETTER Z
+ 0x007b: 0x007b, # LEFT CURLY BRACKET
+ 0x007c: 0x007c, # VERTICAL LINE
+ 0x007d: 0x007d, # RIGHT CURLY BRACKET
+ 0x007e: 0x007e, # TILDE
+ 0x007f: 0x007f, # DELETE
+ 0x00a0: 0x00ff, # NO-BREAK SPACE
+ 0x00a1: 0x00ad, # INVERTED EXCLAMATION MARK
+ 0x00a2: 0x009b, # CENT SIGN
+ 0x00a3: 0x009c, # POUND SIGN
+ 0x00a5: 0x009d, # YEN SIGN
+ 0x00aa: 0x00a6, # FEMININE ORDINAL INDICATOR
+ 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00ac: 0x00aa, # NOT SIGN
+ 0x00b0: 0x00f8, # DEGREE SIGN
+ 0x00b1: 0x00f1, # PLUS-MINUS SIGN
+ 0x00b2: 0x00fd, # SUPERSCRIPT TWO
+ 0x00b5: 0x00e6, # MICRO SIGN
+ 0x00b7: 0x00fa, # MIDDLE DOT
+ 0x00ba: 0x00a7, # MASCULINE ORDINAL INDICATOR
+ 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER
+ 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF
+ 0x00bf: 0x00a8, # INVERTED QUESTION MARK
+ 0x00d1: 0x00a5, # LATIN CAPITAL LETTER N WITH TILDE
+ 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S (GERMAN)
+ 0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00f1: 0x00a4, # LATIN SMALL LETTER N WITH TILDE
+ 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00f7: 0x00f6, # DIVISION SIGN
+ 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE
+ 0x0192: 0x009f, # LATIN SMALL LETTER F WITH HOOK
+ 0x0393: 0x00e2, # GREEK CAPITAL LETTER GAMMA
+ 0x0398: 0x00e9, # GREEK CAPITAL LETTER THETA
+ 0x03a3: 0x00e4, # GREEK CAPITAL LETTER SIGMA
+ 0x03a6: 0x00e8, # GREEK CAPITAL LETTER PHI
+ 0x03a9: 0x00ea, # GREEK CAPITAL LETTER OMEGA
+ 0x03b1: 0x00e0, # GREEK SMALL LETTER ALPHA
+ 0x03b4: 0x00eb, # GREEK SMALL LETTER DELTA
+ 0x03b5: 0x00ee, # GREEK SMALL LETTER EPSILON
+ 0x03c0: 0x00e3, # GREEK SMALL LETTER PI
+ 0x03c3: 0x00e5, # GREEK SMALL LETTER SIGMA
+ 0x03c4: 0x00e7, # GREEK SMALL LETTER TAU
+ 0x03c6: 0x00ed, # GREEK SMALL LETTER PHI
+ 0x05d0: 0x0080, # HEBREW LETTER ALEF
+ 0x05d1: 0x0081, # HEBREW LETTER BET
+ 0x05d2: 0x0082, # HEBREW LETTER GIMEL
+ 0x05d3: 0x0083, # HEBREW LETTER DALET
+ 0x05d4: 0x0084, # HEBREW LETTER HE
+ 0x05d5: 0x0085, # HEBREW LETTER VAV
+ 0x05d6: 0x0086, # HEBREW LETTER ZAYIN
+ 0x05d7: 0x0087, # HEBREW LETTER HET
+ 0x05d8: 0x0088, # HEBREW LETTER TET
+ 0x05d9: 0x0089, # HEBREW LETTER YOD
+ 0x05da: 0x008a, # HEBREW LETTER FINAL KAF
+ 0x05db: 0x008b, # HEBREW LETTER KAF
+ 0x05dc: 0x008c, # HEBREW LETTER LAMED
+ 0x05dd: 0x008d, # HEBREW LETTER FINAL MEM
+ 0x05de: 0x008e, # HEBREW LETTER MEM
+ 0x05df: 0x008f, # HEBREW LETTER FINAL NUN
+ 0x05e0: 0x0090, # HEBREW LETTER NUN
+ 0x05e1: 0x0091, # HEBREW LETTER SAMEKH
+ 0x05e2: 0x0092, # HEBREW LETTER AYIN
+ 0x05e3: 0x0093, # HEBREW LETTER FINAL PE
+ 0x05e4: 0x0094, # HEBREW LETTER PE
+ 0x05e5: 0x0095, # HEBREW LETTER FINAL TSADI
+ 0x05e6: 0x0096, # HEBREW LETTER TSADI
+ 0x05e7: 0x0097, # HEBREW LETTER QOF
+ 0x05e8: 0x0098, # HEBREW LETTER RESH
+ 0x05e9: 0x0099, # HEBREW LETTER SHIN
+ 0x05ea: 0x009a, # HEBREW LETTER TAV
+ 0x207f: 0x00fc, # SUPERSCRIPT LATIN SMALL LETTER N
+ 0x20a7: 0x009e, # PESETA SIGN
+ 0x2219: 0x00f9, # BULLET OPERATOR
+ 0x221a: 0x00fb, # SQUARE ROOT
+ 0x221e: 0x00ec, # INFINITY
+ 0x2229: 0x00ef, # INTERSECTION
+ 0x2248: 0x00f7, # ALMOST EQUAL TO
+ 0x2261: 0x00f0, # IDENTICAL TO
+ 0x2264: 0x00f3, # LESS-THAN OR EQUAL TO
+ 0x2265: 0x00f2, # GREATER-THAN OR EQUAL TO
+ 0x2310: 0x00a9, # REVERSED NOT SIGN
+ 0x2320: 0x00f4, # TOP HALF INTEGRAL
+ 0x2321: 0x00f5, # BOTTOM HALF INTEGRAL
+ 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL
+ 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x2552: 0x00d5, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ 0x2553: 0x00d6, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x2555: 0x00b8, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ 0x2556: 0x00b7, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x2558: 0x00d4, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ 0x2559: 0x00d3, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x255b: 0x00be, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ 0x255c: 0x00bd, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x255e: 0x00c6, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ 0x255f: 0x00c7, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x2561: 0x00b5, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ 0x2562: 0x00b6, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x2564: 0x00d1, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ 0x2565: 0x00d2, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x2567: 0x00cf, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ 0x2568: 0x00d0, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x256a: 0x00d8, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ 0x256b: 0x00d7, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x2580: 0x00df, # UPPER HALF BLOCK
+ 0x2584: 0x00dc, # LOWER HALF BLOCK
+ 0x2588: 0x00db, # FULL BLOCK
+ 0x258c: 0x00dd, # LEFT HALF BLOCK
+ 0x2590: 0x00de, # RIGHT HALF BLOCK
+ 0x2591: 0x00b0, # LIGHT SHADE
+ 0x2592: 0x00b1, # MEDIUM SHADE
+ 0x2593: 0x00b2, # DARK SHADE
+ 0x25a0: 0x00fe, # BLACK SQUARE
+}
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
index 0000000000..fc8dfa5fde
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp863.py
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP863.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp863',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE
+ 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x0084: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE
+ 0x0086: 0x00b6, # PILCROW SIGN
+ 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX
+ 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS
+ 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE
+ 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS
+ 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX
+ 0x008d: 0x2017, # DOUBLE LOW LINE
+ 0x008e: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE
+ 0x008f: 0x00a7, # SECTION SIGN
+ 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x0091: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE
+ 0x0092: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x0094: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS
+ 0x0095: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS
+ 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX
+ 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE
+ 0x0098: 0x00a4, # CURRENCY SIGN
+ 0x0099: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x009b: 0x00a2, # CENT SIGN
+ 0x009c: 0x00a3, # POUND SIGN
+ 0x009d: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE
+ 0x009e: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK
+ 0x00a0: 0x00a6, # BROKEN BAR
+ 0x00a1: 0x00b4, # ACUTE ACCENT
+ 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00a4: 0x00a8, # DIAERESIS
+ 0x00a5: 0x00b8, # CEDILLA
+ 0x00a6: 0x00b3, # SUPERSCRIPT THREE
+ 0x00a7: 0x00af, # MACRON
+ 0x00a8: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ 0x00a9: 0x2310, # REVERSED NOT SIGN
+ 0x00aa: 0x00ac, # NOT SIGN
+ 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF
+ 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER
+ 0x00ad: 0x00be, # VULGAR FRACTION THREE QUARTERS
+ 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00b0: 0x2591, # LIGHT SHADE
+ 0x00b1: 0x2592, # MEDIUM SHADE
+ 0x00b2: 0x2593, # DARK SHADE
+ 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL
+ 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x00db: 0x2588, # FULL BLOCK
+ 0x00dc: 0x2584, # LOWER HALF BLOCK
+ 0x00dd: 0x258c, # LEFT HALF BLOCK
+ 0x00de: 0x2590, # RIGHT HALF BLOCK
+ 0x00df: 0x2580, # UPPER HALF BLOCK
+ 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA
+ 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S
+ 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA
+ 0x00e3: 0x03c0, # GREEK SMALL LETTER PI
+ 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA
+ 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA
+ 0x00e6: 0x00b5, # MICRO SIGN
+ 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU
+ 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI
+ 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA
+ 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA
+ 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA
+ 0x00ec: 0x221e, # INFINITY
+ 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI
+ 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON
+ 0x00ef: 0x2229, # INTERSECTION
+ 0x00f0: 0x2261, # IDENTICAL TO
+ 0x00f1: 0x00b1, # PLUS-MINUS SIGN
+ 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO
+ 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO
+ 0x00f4: 0x2320, # TOP HALF INTEGRAL
+ 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL
+ 0x00f6: 0x00f7, # DIVISION SIGN
+ 0x00f7: 0x2248, # ALMOST EQUAL TO
+ 0x00f8: 0x00b0, # DEGREE SIGN
+ 0x00f9: 0x2219, # BULLET OPERATOR
+ 0x00fa: 0x00b7, # MIDDLE DOT
+ 0x00fb: 0x221a, # SQUARE ROOT
+ 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N
+ 0x00fd: 0x00b2, # SUPERSCRIPT TWO
+ 0x00fe: 0x25a0, # BLACK SQUARE
+ 0x00ff: 0x00a0, # NO-BREAK SPACE
+})
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x0000 -> NULL
+ u'\x01' # 0x0001 -> START OF HEADING
+ u'\x02' # 0x0002 -> START OF TEXT
+ u'\x03' # 0x0003 -> END OF TEXT
+ u'\x04' # 0x0004 -> END OF TRANSMISSION
+ u'\x05' # 0x0005 -> ENQUIRY
+ u'\x06' # 0x0006 -> ACKNOWLEDGE
+ u'\x07' # 0x0007 -> BELL
+ u'\x08' # 0x0008 -> BACKSPACE
+ u'\t' # 0x0009 -> HORIZONTAL TABULATION
+ u'\n' # 0x000a -> LINE FEED
+ u'\x0b' # 0x000b -> VERTICAL TABULATION
+ u'\x0c' # 0x000c -> FORM FEED
+ u'\r' # 0x000d -> CARRIAGE RETURN
+ u'\x0e' # 0x000e -> SHIFT OUT
+ u'\x0f' # 0x000f -> SHIFT IN
+ u'\x10' # 0x0010 -> DATA LINK ESCAPE
+ u'\x11' # 0x0011 -> DEVICE CONTROL ONE
+ u'\x12' # 0x0012 -> DEVICE CONTROL TWO
+ u'\x13' # 0x0013 -> DEVICE CONTROL THREE
+ u'\x14' # 0x0014 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x0016 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x0018 -> CANCEL
+ u'\x19' # 0x0019 -> END OF MEDIUM
+ u'\x1a' # 0x001a -> SUBSTITUTE
+ u'\x1b' # 0x001b -> ESCAPE
+ u'\x1c' # 0x001c -> FILE SEPARATOR
+ u'\x1d' # 0x001d -> GROUP SEPARATOR
+ u'\x1e' # 0x001e -> RECORD SEPARATOR
+ u'\x1f' # 0x001f -> UNIT SEPARATOR
+ u' ' # 0x0020 -> SPACE
+ u'!' # 0x0021 -> EXCLAMATION MARK
+ u'"' # 0x0022 -> QUOTATION MARK
+ u'#' # 0x0023 -> NUMBER SIGN
+ u'$' # 0x0024 -> DOLLAR SIGN
+ u'%' # 0x0025 -> PERCENT SIGN
+ u'&' # 0x0026 -> AMPERSAND
+ u"'" # 0x0027 -> APOSTROPHE
+ u'(' # 0x0028 -> LEFT PARENTHESIS
+ u')' # 0x0029 -> RIGHT PARENTHESIS
+ u'*' # 0x002a -> ASTERISK
+ u'+' # 0x002b -> PLUS SIGN
+ u',' # 0x002c -> COMMA
+ u'-' # 0x002d -> HYPHEN-MINUS
+ u'.' # 0x002e -> FULL STOP
+ u'/' # 0x002f -> SOLIDUS
+ u'0' # 0x0030 -> DIGIT ZERO
+ u'1' # 0x0031 -> DIGIT ONE
+ u'2' # 0x0032 -> DIGIT TWO
+ u'3' # 0x0033 -> DIGIT THREE
+ u'4' # 0x0034 -> DIGIT FOUR
+ u'5' # 0x0035 -> DIGIT FIVE
+ u'6' # 0x0036 -> DIGIT SIX
+ u'7' # 0x0037 -> DIGIT SEVEN
+ u'8' # 0x0038 -> DIGIT EIGHT
+ u'9' # 0x0039 -> DIGIT NINE
+ u':' # 0x003a -> COLON
+ u';' # 0x003b -> SEMICOLON
+ u'<' # 0x003c -> LESS-THAN SIGN
+ u'=' # 0x003d -> EQUALS SIGN
+ u'>' # 0x003e -> GREATER-THAN SIGN
+ u'?' # 0x003f -> QUESTION MARK
+ u'@' # 0x0040 -> COMMERCIAL AT
+ u'A' # 0x0041 -> LATIN CAPITAL LETTER A
+ u'B' # 0x0042 -> LATIN CAPITAL LETTER B
+ u'C' # 0x0043 -> LATIN CAPITAL LETTER C
+ u'D' # 0x0044 -> LATIN CAPITAL LETTER D
+ u'E' # 0x0045 -> LATIN CAPITAL LETTER E
+ u'F' # 0x0046 -> LATIN CAPITAL LETTER F
+ u'G' # 0x0047 -> LATIN CAPITAL LETTER G
+ u'H' # 0x0048 -> LATIN CAPITAL LETTER H
+ u'I' # 0x0049 -> LATIN CAPITAL LETTER I
+ u'J' # 0x004a -> LATIN CAPITAL LETTER J
+ u'K' # 0x004b -> LATIN CAPITAL LETTER K
+ u'L' # 0x004c -> LATIN CAPITAL LETTER L
+ u'M' # 0x004d -> LATIN CAPITAL LETTER M
+ u'N' # 0x004e -> LATIN CAPITAL LETTER N
+ u'O' # 0x004f -> LATIN CAPITAL LETTER O
+ u'P' # 0x0050 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x0052 -> LATIN CAPITAL LETTER R
+ u'S' # 0x0053 -> LATIN CAPITAL LETTER S
+ u'T' # 0x0054 -> LATIN CAPITAL LETTER T
+ u'U' # 0x0055 -> LATIN CAPITAL LETTER U
+ u'V' # 0x0056 -> LATIN CAPITAL LETTER V
+ u'W' # 0x0057 -> LATIN CAPITAL LETTER W
+ u'X' # 0x0058 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x005a -> LATIN CAPITAL LETTER Z
+ u'[' # 0x005b -> LEFT SQUARE BRACKET
+ u'\\' # 0x005c -> REVERSE SOLIDUS
+ u']' # 0x005d -> RIGHT SQUARE BRACKET
+ u'^' # 0x005e -> CIRCUMFLEX ACCENT
+ u'_' # 0x005f -> LOW LINE
+ u'`' # 0x0060 -> GRAVE ACCENT
+ u'a' # 0x0061 -> LATIN SMALL LETTER A
+ u'b' # 0x0062 -> LATIN SMALL LETTER B
+ u'c' # 0x0063 -> LATIN SMALL LETTER C
+ u'd' # 0x0064 -> LATIN SMALL LETTER D
+ u'e' # 0x0065 -> LATIN SMALL LETTER E
+ u'f' # 0x0066 -> LATIN SMALL LETTER F
+ u'g' # 0x0067 -> LATIN SMALL LETTER G
+ u'h' # 0x0068 -> LATIN SMALL LETTER H
+ u'i' # 0x0069 -> LATIN SMALL LETTER I
+ u'j' # 0x006a -> LATIN SMALL LETTER J
+ u'k' # 0x006b -> LATIN SMALL LETTER K
+ u'l' # 0x006c -> LATIN SMALL LETTER L
+ u'm' # 0x006d -> LATIN SMALL LETTER M
+ u'n' # 0x006e -> LATIN SMALL LETTER N
+ u'o' # 0x006f -> LATIN SMALL LETTER O
+ u'p' # 0x0070 -> LATIN SMALL LETTER P
+ u'q' # 0x0071 -> LATIN SMALL LETTER Q
+ u'r' # 0x0072 -> LATIN SMALL LETTER R
+ u's' # 0x0073 -> LATIN SMALL LETTER S
+ u't' # 0x0074 -> LATIN SMALL LETTER T
+ u'u' # 0x0075 -> LATIN SMALL LETTER U
+ u'v' # 0x0076 -> LATIN SMALL LETTER V
+ u'w' # 0x0077 -> LATIN SMALL LETTER W
+ u'x' # 0x0078 -> LATIN SMALL LETTER X
+ u'y' # 0x0079 -> LATIN SMALL LETTER Y
+ u'z' # 0x007a -> LATIN SMALL LETTER Z
+ u'{' # 0x007b -> LEFT CURLY BRACKET
+ u'|' # 0x007c -> VERTICAL LINE
+ u'}' # 0x007d -> RIGHT CURLY BRACKET
+ u'~' # 0x007e -> TILDE
+ u'\x7f' # 0x007f -> DELETE
+ u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xc2' # 0x0084 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xb6' # 0x0086 -> PILCROW SIGN
+ u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\u2017' # 0x008d -> DOUBLE LOW LINE
+ u'\xc0' # 0x008e -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xa7' # 0x008f -> SECTION SIGN
+ u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xc8' # 0x0091 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xca' # 0x0092 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xcb' # 0x0094 -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xcf' # 0x0095 -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xa4' # 0x0098 -> CURRENCY SIGN
+ u'\xd4' # 0x0099 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xa2' # 0x009b -> CENT SIGN
+ u'\xa3' # 0x009c -> POUND SIGN
+ u'\xd9' # 0x009d -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\xdb' # 0x009e -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK
+ u'\xa6' # 0x00a0 -> BROKEN BAR
+ u'\xb4' # 0x00a1 -> ACUTE ACCENT
+ u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xa8' # 0x00a4 -> DIAERESIS
+ u'\xb8' # 0x00a5 -> CEDILLA
+ u'\xb3' # 0x00a6 -> SUPERSCRIPT THREE
+ u'\xaf' # 0x00a7 -> MACRON
+ u'\xce' # 0x00a8 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\u2310' # 0x00a9 -> REVERSED NOT SIGN
+ u'\xac' # 0x00aa -> NOT SIGN
+ u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF
+ u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER
+ u'\xbe' # 0x00ad -> VULGAR FRACTION THREE QUARTERS
+ u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2591' # 0x00b0 -> LIGHT SHADE
+ u'\u2592' # 0x00b1 -> MEDIUM SHADE
+ u'\u2593' # 0x00b2 -> DARK SHADE
+ u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL
+ u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL
+ u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT
+ u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT
+ u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT
+ u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT
+ u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL
+ u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
+ u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL
+ u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT
+ u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT
+ u'\u2588' # 0x00db -> FULL BLOCK
+ u'\u2584' # 0x00dc -> LOWER HALF BLOCK
+ u'\u258c' # 0x00dd -> LEFT HALF BLOCK
+ u'\u2590' # 0x00de -> RIGHT HALF BLOCK
+ u'\u2580' # 0x00df -> UPPER HALF BLOCK
+ u'\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA
+ u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S
+ u'\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA
+ u'\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI
+ u'\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA
+ u'\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA
+ u'\xb5' # 0x00e6 -> MICRO SIGN
+ u'\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU
+ u'\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI
+ u'\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA
+ u'\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA
+ u'\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA
+ u'\u221e' # 0x00ec -> INFINITY
+ u'\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI
+ u'\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON
+ u'\u2229' # 0x00ef -> INTERSECTION
+ u'\u2261' # 0x00f0 -> IDENTICAL TO
+ u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN
+ u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO
+ u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO
+ u'\u2320' # 0x00f4 -> TOP HALF INTEGRAL
+ u'\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL
+ u'\xf7' # 0x00f6 -> DIVISION SIGN
+ u'\u2248' # 0x00f7 -> ALMOST EQUAL TO
+ u'\xb0' # 0x00f8 -> DEGREE SIGN
+ u'\u2219' # 0x00f9 -> BULLET OPERATOR
+ u'\xb7' # 0x00fa -> MIDDLE DOT
+ u'\u221a' # 0x00fb -> SQUARE ROOT
+ u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N
+ u'\xb2' # 0x00fd -> SUPERSCRIPT TWO
+ u'\u25a0' # 0x00fe -> BLACK SQUARE
+ u'\xa0' # 0x00ff -> NO-BREAK SPACE
+)
+
+### Encoding Map
+
+encoding_map = {
+ 0x0000: 0x0000, # NULL
+ 0x0001: 0x0001, # START OF HEADING
+ 0x0002: 0x0002, # START OF TEXT
+ 0x0003: 0x0003, # END OF TEXT
+ 0x0004: 0x0004, # END OF TRANSMISSION
+ 0x0005: 0x0005, # ENQUIRY
+ 0x0006: 0x0006, # ACKNOWLEDGE
+ 0x0007: 0x0007, # BELL
+ 0x0008: 0x0008, # BACKSPACE
+ 0x0009: 0x0009, # HORIZONTAL TABULATION
+ 0x000a: 0x000a, # LINE FEED
+ 0x000b: 0x000b, # VERTICAL TABULATION
+ 0x000c: 0x000c, # FORM FEED
+ 0x000d: 0x000d, # CARRIAGE RETURN
+ 0x000e: 0x000e, # SHIFT OUT
+ 0x000f: 0x000f, # SHIFT IN
+ 0x0010: 0x0010, # DATA LINK ESCAPE
+ 0x0011: 0x0011, # DEVICE CONTROL ONE
+ 0x0012: 0x0012, # DEVICE CONTROL TWO
+ 0x0013: 0x0013, # DEVICE CONTROL THREE
+ 0x0014: 0x0014, # DEVICE CONTROL FOUR
+ 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE
+ 0x0016: 0x0016, # SYNCHRONOUS IDLE
+ 0x0017: 0x0017, # END OF TRANSMISSION BLOCK
+ 0x0018: 0x0018, # CANCEL
+ 0x0019: 0x0019, # END OF MEDIUM
+ 0x001a: 0x001a, # SUBSTITUTE
+ 0x001b: 0x001b, # ESCAPE
+ 0x001c: 0x001c, # FILE SEPARATOR
+ 0x001d: 0x001d, # GROUP SEPARATOR
+ 0x001e: 0x001e, # RECORD SEPARATOR
+ 0x001f: 0x001f, # UNIT SEPARATOR
+ 0x0020: 0x0020, # SPACE
+ 0x0021: 0x0021, # EXCLAMATION MARK
+ 0x0022: 0x0022, # QUOTATION MARK
+ 0x0023: 0x0023, # NUMBER SIGN
+ 0x0024: 0x0024, # DOLLAR SIGN
+ 0x0025: 0x0025, # PERCENT SIGN
+ 0x0026: 0x0026, # AMPERSAND
+ 0x0027: 0x0027, # APOSTROPHE
+ 0x0028: 0x0028, # LEFT PARENTHESIS
+ 0x0029: 0x0029, # RIGHT PARENTHESIS
+ 0x002a: 0x002a, # ASTERISK
+ 0x002b: 0x002b, # PLUS SIGN
+ 0x002c: 0x002c, # COMMA
+ 0x002d: 0x002d, # HYPHEN-MINUS
+ 0x002e: 0x002e, # FULL STOP
+ 0x002f: 0x002f, # SOLIDUS
+ 0x0030: 0x0030, # DIGIT ZERO
+ 0x0031: 0x0031, # DIGIT ONE
+ 0x0032: 0x0032, # DIGIT TWO
+ 0x0033: 0x0033, # DIGIT THREE
+ 0x0034: 0x0034, # DIGIT FOUR
+ 0x0035: 0x0035, # DIGIT FIVE
+ 0x0036: 0x0036, # DIGIT SIX
+ 0x0037: 0x0037, # DIGIT SEVEN
+ 0x0038: 0x0038, # DIGIT EIGHT
+ 0x0039: 0x0039, # DIGIT NINE
+ 0x003a: 0x003a, # COLON
+ 0x003b: 0x003b, # SEMICOLON
+ 0x003c: 0x003c, # LESS-THAN SIGN
+ 0x003d: 0x003d, # EQUALS SIGN
+ 0x003e: 0x003e, # GREATER-THAN SIGN
+ 0x003f: 0x003f, # QUESTION MARK
+ 0x0040: 0x0040, # COMMERCIAL AT
+ 0x0041: 0x0041, # LATIN CAPITAL LETTER A
+ 0x0042: 0x0042, # LATIN CAPITAL LETTER B
+ 0x0043: 0x0043, # LATIN CAPITAL LETTER C
+ 0x0044: 0x0044, # LATIN CAPITAL LETTER D
+ 0x0045: 0x0045, # LATIN CAPITAL LETTER E
+ 0x0046: 0x0046, # LATIN CAPITAL LETTER F
+ 0x0047: 0x0047, # LATIN CAPITAL LETTER G
+ 0x0048: 0x0048, # LATIN CAPITAL LETTER H
+ 0x0049: 0x0049, # LATIN CAPITAL LETTER I
+ 0x004a: 0x004a, # LATIN CAPITAL LETTER J
+ 0x004b: 0x004b, # LATIN CAPITAL LETTER K
+ 0x004c: 0x004c, # LATIN CAPITAL LETTER L
+ 0x004d: 0x004d, # LATIN CAPITAL LETTER M
+ 0x004e: 0x004e, # LATIN CAPITAL LETTER N
+ 0x004f: 0x004f, # LATIN CAPITAL LETTER O
+ 0x0050: 0x0050, # LATIN CAPITAL LETTER P
+ 0x0051: 0x0051, # LATIN CAPITAL LETTER Q
+ 0x0052: 0x0052, # LATIN CAPITAL LETTER R
+ 0x0053: 0x0053, # LATIN CAPITAL LETTER S
+ 0x0054: 0x0054, # LATIN CAPITAL LETTER T
+ 0x0055: 0x0055, # LATIN CAPITAL LETTER U
+ 0x0056: 0x0056, # LATIN CAPITAL LETTER V
+ 0x0057: 0x0057, # LATIN CAPITAL LETTER W
+ 0x0058: 0x0058, # LATIN CAPITAL LETTER X
+ 0x0059: 0x0059, # LATIN CAPITAL LETTER Y
+ 0x005a: 0x005a, # LATIN CAPITAL LETTER Z
+ 0x005b: 0x005b, # LEFT SQUARE BRACKET
+ 0x005c: 0x005c, # REVERSE SOLIDUS
+ 0x005d: 0x005d, # RIGHT SQUARE BRACKET
+ 0x005e: 0x005e, # CIRCUMFLEX ACCENT
+ 0x005f: 0x005f, # LOW LINE
+ 0x0060: 0x0060, # GRAVE ACCENT
+ 0x0061: 0x0061, # LATIN SMALL LETTER A
+ 0x0062: 0x0062, # LATIN SMALL LETTER B
+ 0x0063: 0x0063, # LATIN SMALL LETTER C
+ 0x0064: 0x0064, # LATIN SMALL LETTER D
+ 0x0065: 0x0065, # LATIN SMALL LETTER E
+ 0x0066: 0x0066, # LATIN SMALL LETTER F
+ 0x0067: 0x0067, # LATIN SMALL LETTER G
+ 0x0068: 0x0068, # LATIN SMALL LETTER H
+ 0x0069: 0x0069, # LATIN SMALL LETTER I
+ 0x006a: 0x006a, # LATIN SMALL LETTER J
+ 0x006b: 0x006b, # LATIN SMALL LETTER K
+ 0x006c: 0x006c, # LATIN SMALL LETTER L
+ 0x006d: 0x006d, # LATIN SMALL LETTER M
+ 0x006e: 0x006e, # LATIN SMALL LETTER N
+ 0x006f: 0x006f, # LATIN SMALL LETTER O
+ 0x0070: 0x0070, # LATIN SMALL LETTER P
+ 0x0071: 0x0071, # LATIN SMALL LETTER Q
+ 0x0072: 0x0072, # LATIN SMALL LETTER R
+ 0x0073: 0x0073, # LATIN SMALL LETTER S
+ 0x0074: 0x0074, # LATIN SMALL LETTER T
+ 0x0075: 0x0075, # LATIN SMALL LETTER U
+ 0x0076: 0x0076, # LATIN SMALL LETTER V
+ 0x0077: 0x0077, # LATIN SMALL LETTER W
+ 0x0078: 0x0078, # LATIN SMALL LETTER X
+ 0x0079: 0x0079, # LATIN SMALL LETTER Y
+ 0x007a: 0x007a, # LATIN SMALL LETTER Z
+ 0x007b: 0x007b, # LEFT CURLY BRACKET
+ 0x007c: 0x007c, # VERTICAL LINE
+ 0x007d: 0x007d, # RIGHT CURLY BRACKET
+ 0x007e: 0x007e, # TILDE
+ 0x007f: 0x007f, # DELETE
+ 0x00a0: 0x00ff, # NO-BREAK SPACE
+ 0x00a2: 0x009b, # CENT SIGN
+ 0x00a3: 0x009c, # POUND SIGN
+ 0x00a4: 0x0098, # CURRENCY SIGN
+ 0x00a6: 0x00a0, # BROKEN BAR
+ 0x00a7: 0x008f, # SECTION SIGN
+ 0x00a8: 0x00a4, # DIAERESIS
+ 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00ac: 0x00aa, # NOT SIGN
+ 0x00af: 0x00a7, # MACRON
+ 0x00b0: 0x00f8, # DEGREE SIGN
+ 0x00b1: 0x00f1, # PLUS-MINUS SIGN
+ 0x00b2: 0x00fd, # SUPERSCRIPT TWO
+ 0x00b3: 0x00a6, # SUPERSCRIPT THREE
+ 0x00b4: 0x00a1, # ACUTE ACCENT
+ 0x00b5: 0x00e6, # MICRO SIGN
+ 0x00b6: 0x0086, # PILCROW SIGN
+ 0x00b7: 0x00fa, # MIDDLE DOT
+ 0x00b8: 0x00a5, # CEDILLA
+ 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER
+ 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF
+ 0x00be: 0x00ad, # VULGAR FRACTION THREE QUARTERS
+ 0x00c0: 0x008e, # LATIN CAPITAL LETTER A WITH GRAVE
+ 0x00c2: 0x0084, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ 0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x00c8: 0x0091, # LATIN CAPITAL LETTER E WITH GRAVE
+ 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x00ca: 0x0092, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ 0x00cb: 0x0094, # LATIN CAPITAL LETTER E WITH DIAERESIS
+ 0x00ce: 0x00a8, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ 0x00cf: 0x0095, # LATIN CAPITAL LETTER I WITH DIAERESIS
+ 0x00d4: 0x0099, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ 0x00d9: 0x009d, # LATIN CAPITAL LETTER U WITH GRAVE
+ 0x00db: 0x009e, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S
+ 0x00e0: 0x0085, # LATIN SMALL LETTER A WITH GRAVE
+ 0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x00e8: 0x008a, # LATIN SMALL LETTER E WITH GRAVE
+ 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE
+ 0x00ea: 0x0088, # LATIN SMALL LETTER E WITH CIRCUMFLEX
+ 0x00eb: 0x0089, # LATIN SMALL LETTER E WITH DIAERESIS
+ 0x00ee: 0x008c, # LATIN SMALL LETTER I WITH CIRCUMFLEX
+ 0x00ef: 0x008b, # LATIN SMALL LETTER I WITH DIAERESIS
+ 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x00f7: 0x00f6, # DIVISION SIGN
+ 0x00f9: 0x0097, # LATIN SMALL LETTER U WITH GRAVE
+ 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00fb: 0x0096, # LATIN SMALL LETTER U WITH CIRCUMFLEX
+ 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x0192: 0x009f, # LATIN SMALL LETTER F WITH HOOK
+ 0x0393: 0x00e2, # GREEK CAPITAL LETTER GAMMA
+ 0x0398: 0x00e9, # GREEK CAPITAL LETTER THETA
+ 0x03a3: 0x00e4, # GREEK CAPITAL LETTER SIGMA
+ 0x03a6: 0x00e8, # GREEK CAPITAL LETTER PHI
+ 0x03a9: 0x00ea, # GREEK CAPITAL LETTER OMEGA
+ 0x03b1: 0x00e0, # GREEK SMALL LETTER ALPHA
+ 0x03b4: 0x00eb, # GREEK SMALL LETTER DELTA
+ 0x03b5: 0x00ee, # GREEK SMALL LETTER EPSILON
+ 0x03c0: 0x00e3, # GREEK SMALL LETTER PI
+ 0x03c3: 0x00e5, # GREEK SMALL LETTER SIGMA
+ 0x03c4: 0x00e7, # GREEK SMALL LETTER TAU
+ 0x03c6: 0x00ed, # GREEK SMALL LETTER PHI
+ 0x2017: 0x008d, # DOUBLE LOW LINE
+ 0x207f: 0x00fc, # SUPERSCRIPT LATIN SMALL LETTER N
+ 0x2219: 0x00f9, # BULLET OPERATOR
+ 0x221a: 0x00fb, # SQUARE ROOT
+ 0x221e: 0x00ec, # INFINITY
+ 0x2229: 0x00ef, # INTERSECTION
+ 0x2248: 0x00f7, # ALMOST EQUAL TO
+ 0x2261: 0x00f0, # IDENTICAL TO
+ 0x2264: 0x00f3, # LESS-THAN OR EQUAL TO
+ 0x2265: 0x00f2, # GREATER-THAN OR EQUAL TO
+ 0x2310: 0x00a9, # REVERSED NOT SIGN
+ 0x2320: 0x00f4, # TOP HALF INTEGRAL
+ 0x2321: 0x00f5, # BOTTOM HALF INTEGRAL
+ 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL
+ 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x2552: 0x00d5, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ 0x2553: 0x00d6, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x2555: 0x00b8, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ 0x2556: 0x00b7, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x2558: 0x00d4, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ 0x2559: 0x00d3, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x255b: 0x00be, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ 0x255c: 0x00bd, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x255e: 0x00c6, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ 0x255f: 0x00c7, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x2561: 0x00b5, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ 0x2562: 0x00b6, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x2564: 0x00d1, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ 0x2565: 0x00d2, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x2567: 0x00cf, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ 0x2568: 0x00d0, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x256a: 0x00d8, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ 0x256b: 0x00d7, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x2580: 0x00df, # UPPER HALF BLOCK
+ 0x2584: 0x00dc, # LOWER HALF BLOCK
+ 0x2588: 0x00db, # FULL BLOCK
+ 0x258c: 0x00dd, # LEFT HALF BLOCK
+ 0x2590: 0x00de, # RIGHT HALF BLOCK
+ 0x2591: 0x00b0, # LIGHT SHADE
+ 0x2592: 0x00b1, # MEDIUM SHADE
+ 0x2593: 0x00b2, # DARK SHADE
+ 0x25a0: 0x00fe, # BLACK SQUARE
+}
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
index 0000000000..9733ada1d7
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp864.py
@@ -0,0 +1,690 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP864.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp864',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0025: 0x066a, # ARABIC PERCENT SIGN
+ 0x0080: 0x00b0, # DEGREE SIGN
+ 0x0081: 0x00b7, # MIDDLE DOT
+ 0x0082: 0x2219, # BULLET OPERATOR
+ 0x0083: 0x221a, # SQUARE ROOT
+ 0x0084: 0x2592, # MEDIUM SHADE
+ 0x0085: 0x2500, # FORMS LIGHT HORIZONTAL
+ 0x0086: 0x2502, # FORMS LIGHT VERTICAL
+ 0x0087: 0x253c, # FORMS LIGHT VERTICAL AND HORIZONTAL
+ 0x0088: 0x2524, # FORMS LIGHT VERTICAL AND LEFT
+ 0x0089: 0x252c, # FORMS LIGHT DOWN AND HORIZONTAL
+ 0x008a: 0x251c, # FORMS LIGHT VERTICAL AND RIGHT
+ 0x008b: 0x2534, # FORMS LIGHT UP AND HORIZONTAL
+ 0x008c: 0x2510, # FORMS LIGHT DOWN AND LEFT
+ 0x008d: 0x250c, # FORMS LIGHT DOWN AND RIGHT
+ 0x008e: 0x2514, # FORMS LIGHT UP AND RIGHT
+ 0x008f: 0x2518, # FORMS LIGHT UP AND LEFT
+ 0x0090: 0x03b2, # GREEK SMALL BETA
+ 0x0091: 0x221e, # INFINITY
+ 0x0092: 0x03c6, # GREEK SMALL PHI
+ 0x0093: 0x00b1, # PLUS-OR-MINUS SIGN
+ 0x0094: 0x00bd, # FRACTION 1/2
+ 0x0095: 0x00bc, # FRACTION 1/4
+ 0x0096: 0x2248, # ALMOST EQUAL TO
+ 0x0097: 0x00ab, # LEFT POINTING GUILLEMET
+ 0x0098: 0x00bb, # RIGHT POINTING GUILLEMET
+ 0x0099: 0xfef7, # ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE ISOLATED FORM
+ 0x009a: 0xfef8, # ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE FINAL FORM
+ 0x009b: None, # UNDEFINED
+ 0x009c: None, # UNDEFINED
+ 0x009d: 0xfefb, # ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM
+ 0x009e: 0xfefc, # ARABIC LIGATURE LAM WITH ALEF FINAL FORM
+ 0x009f: None, # UNDEFINED
+ 0x00a1: 0x00ad, # SOFT HYPHEN
+ 0x00a2: 0xfe82, # ARABIC LETTER ALEF WITH MADDA ABOVE FINAL FORM
+ 0x00a5: 0xfe84, # ARABIC LETTER ALEF WITH HAMZA ABOVE FINAL FORM
+ 0x00a6: None, # UNDEFINED
+ 0x00a7: None, # UNDEFINED
+ 0x00a8: 0xfe8e, # ARABIC LETTER ALEF FINAL FORM
+ 0x00a9: 0xfe8f, # ARABIC LETTER BEH ISOLATED FORM
+ 0x00aa: 0xfe95, # ARABIC LETTER TEH ISOLATED FORM
+ 0x00ab: 0xfe99, # ARABIC LETTER THEH ISOLATED FORM
+ 0x00ac: 0x060c, # ARABIC COMMA
+ 0x00ad: 0xfe9d, # ARABIC LETTER JEEM ISOLATED FORM
+ 0x00ae: 0xfea1, # ARABIC LETTER HAH ISOLATED FORM
+ 0x00af: 0xfea5, # ARABIC LETTER KHAH ISOLATED FORM
+ 0x00b0: 0x0660, # ARABIC-INDIC DIGIT ZERO
+ 0x00b1: 0x0661, # ARABIC-INDIC DIGIT ONE
+ 0x00b2: 0x0662, # ARABIC-INDIC DIGIT TWO
+ 0x00b3: 0x0663, # ARABIC-INDIC DIGIT THREE
+ 0x00b4: 0x0664, # ARABIC-INDIC DIGIT FOUR
+ 0x00b5: 0x0665, # ARABIC-INDIC DIGIT FIVE
+ 0x00b6: 0x0666, # ARABIC-INDIC DIGIT SIX
+ 0x00b7: 0x0667, # ARABIC-INDIC DIGIT SEVEN
+ 0x00b8: 0x0668, # ARABIC-INDIC DIGIT EIGHT
+ 0x00b9: 0x0669, # ARABIC-INDIC DIGIT NINE
+ 0x00ba: 0xfed1, # ARABIC LETTER FEH ISOLATED FORM
+ 0x00bb: 0x061b, # ARABIC SEMICOLON
+ 0x00bc: 0xfeb1, # ARABIC LETTER SEEN ISOLATED FORM
+ 0x00bd: 0xfeb5, # ARABIC LETTER SHEEN ISOLATED FORM
+ 0x00be: 0xfeb9, # ARABIC LETTER SAD ISOLATED FORM
+ 0x00bf: 0x061f, # ARABIC QUESTION MARK
+ 0x00c0: 0x00a2, # CENT SIGN
+ 0x00c1: 0xfe80, # ARABIC LETTER HAMZA ISOLATED FORM
+ 0x00c2: 0xfe81, # ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM
+ 0x00c3: 0xfe83, # ARABIC LETTER ALEF WITH HAMZA ABOVE ISOLATED FORM
+ 0x00c4: 0xfe85, # ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM
+ 0x00c5: 0xfeca, # ARABIC LETTER AIN FINAL FORM
+ 0x00c6: 0xfe8b, # ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM
+ 0x00c7: 0xfe8d, # ARABIC LETTER ALEF ISOLATED FORM
+ 0x00c8: 0xfe91, # ARABIC LETTER BEH INITIAL FORM
+ 0x00c9: 0xfe93, # ARABIC LETTER TEH MARBUTA ISOLATED FORM
+ 0x00ca: 0xfe97, # ARABIC LETTER TEH INITIAL FORM
+ 0x00cb: 0xfe9b, # ARABIC LETTER THEH INITIAL FORM
+ 0x00cc: 0xfe9f, # ARABIC LETTER JEEM INITIAL FORM
+ 0x00cd: 0xfea3, # ARABIC LETTER HAH INITIAL FORM
+ 0x00ce: 0xfea7, # ARABIC LETTER KHAH INITIAL FORM
+ 0x00cf: 0xfea9, # ARABIC LETTER DAL ISOLATED FORM
+ 0x00d0: 0xfeab, # ARABIC LETTER THAL ISOLATED FORM
+ 0x00d1: 0xfead, # ARABIC LETTER REH ISOLATED FORM
+ 0x00d2: 0xfeaf, # ARABIC LETTER ZAIN ISOLATED FORM
+ 0x00d3: 0xfeb3, # ARABIC LETTER SEEN INITIAL FORM
+ 0x00d4: 0xfeb7, # ARABIC LETTER SHEEN INITIAL FORM
+ 0x00d5: 0xfebb, # ARABIC LETTER SAD INITIAL FORM
+ 0x00d6: 0xfebf, # ARABIC LETTER DAD INITIAL FORM
+ 0x00d7: 0xfec1, # ARABIC LETTER TAH ISOLATED FORM
+ 0x00d8: 0xfec5, # ARABIC LETTER ZAH ISOLATED FORM
+ 0x00d9: 0xfecb, # ARABIC LETTER AIN INITIAL FORM
+ 0x00da: 0xfecf, # ARABIC LETTER GHAIN INITIAL FORM
+ 0x00db: 0x00a6, # BROKEN VERTICAL BAR
+ 0x00dc: 0x00ac, # NOT SIGN
+ 0x00dd: 0x00f7, # DIVISION SIGN
+ 0x00de: 0x00d7, # MULTIPLICATION SIGN
+ 0x00df: 0xfec9, # ARABIC LETTER AIN ISOLATED FORM
+ 0x00e0: 0x0640, # ARABIC TATWEEL
+ 0x00e1: 0xfed3, # ARABIC LETTER FEH INITIAL FORM
+ 0x00e2: 0xfed7, # ARABIC LETTER QAF INITIAL FORM
+ 0x00e3: 0xfedb, # ARABIC LETTER KAF INITIAL FORM
+ 0x00e4: 0xfedf, # ARABIC LETTER LAM INITIAL FORM
+ 0x00e5: 0xfee3, # ARABIC LETTER MEEM INITIAL FORM
+ 0x00e6: 0xfee7, # ARABIC LETTER NOON INITIAL FORM
+ 0x00e7: 0xfeeb, # ARABIC LETTER HEH INITIAL FORM
+ 0x00e8: 0xfeed, # ARABIC LETTER WAW ISOLATED FORM
+ 0x00e9: 0xfeef, # ARABIC LETTER ALEF MAKSURA ISOLATED FORM
+ 0x00ea: 0xfef3, # ARABIC LETTER YEH INITIAL FORM
+ 0x00eb: 0xfebd, # ARABIC LETTER DAD ISOLATED FORM
+ 0x00ec: 0xfecc, # ARABIC LETTER AIN MEDIAL FORM
+ 0x00ed: 0xfece, # ARABIC LETTER GHAIN FINAL FORM
+ 0x00ee: 0xfecd, # ARABIC LETTER GHAIN ISOLATED FORM
+ 0x00ef: 0xfee1, # ARABIC LETTER MEEM ISOLATED FORM
+ 0x00f0: 0xfe7d, # ARABIC SHADDA MEDIAL FORM
+ 0x00f1: 0x0651, # ARABIC SHADDAH
+ 0x00f2: 0xfee5, # ARABIC LETTER NOON ISOLATED FORM
+ 0x00f3: 0xfee9, # ARABIC LETTER HEH ISOLATED FORM
+ 0x00f4: 0xfeec, # ARABIC LETTER HEH MEDIAL FORM
+ 0x00f5: 0xfef0, # ARABIC LETTER ALEF MAKSURA FINAL FORM
+ 0x00f6: 0xfef2, # ARABIC LETTER YEH FINAL FORM
+ 0x00f7: 0xfed0, # ARABIC LETTER GHAIN MEDIAL FORM
+ 0x00f8: 0xfed5, # ARABIC LETTER QAF ISOLATED FORM
+ 0x00f9: 0xfef5, # ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM
+ 0x00fa: 0xfef6, # ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM
+ 0x00fb: 0xfedd, # ARABIC LETTER LAM ISOLATED FORM
+ 0x00fc: 0xfed9, # ARABIC LETTER KAF ISOLATED FORM
+ 0x00fd: 0xfef1, # ARABIC LETTER YEH ISOLATED FORM
+ 0x00fe: 0x25a0, # BLACK SQUARE
+ 0x00ff: None, # UNDEFINED
+})
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x0000 -> NULL
+ u'\x01' # 0x0001 -> START OF HEADING
+ u'\x02' # 0x0002 -> START OF TEXT
+ u'\x03' # 0x0003 -> END OF TEXT
+ u'\x04' # 0x0004 -> END OF TRANSMISSION
+ u'\x05' # 0x0005 -> ENQUIRY
+ u'\x06' # 0x0006 -> ACKNOWLEDGE
+ u'\x07' # 0x0007 -> BELL
+ u'\x08' # 0x0008 -> BACKSPACE
+ u'\t' # 0x0009 -> HORIZONTAL TABULATION
+ u'\n' # 0x000a -> LINE FEED
+ u'\x0b' # 0x000b -> VERTICAL TABULATION
+ u'\x0c' # 0x000c -> FORM FEED
+ u'\r' # 0x000d -> CARRIAGE RETURN
+ u'\x0e' # 0x000e -> SHIFT OUT
+ u'\x0f' # 0x000f -> SHIFT IN
+ u'\x10' # 0x0010 -> DATA LINK ESCAPE
+ u'\x11' # 0x0011 -> DEVICE CONTROL ONE
+ u'\x12' # 0x0012 -> DEVICE CONTROL TWO
+ u'\x13' # 0x0013 -> DEVICE CONTROL THREE
+ u'\x14' # 0x0014 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x0016 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x0018 -> CANCEL
+ u'\x19' # 0x0019 -> END OF MEDIUM
+ u'\x1a' # 0x001a -> SUBSTITUTE
+ u'\x1b' # 0x001b -> ESCAPE
+ u'\x1c' # 0x001c -> FILE SEPARATOR
+ u'\x1d' # 0x001d -> GROUP SEPARATOR
+ u'\x1e' # 0x001e -> RECORD SEPARATOR
+ u'\x1f' # 0x001f -> UNIT SEPARATOR
+ u' ' # 0x0020 -> SPACE
+ u'!' # 0x0021 -> EXCLAMATION MARK
+ u'"' # 0x0022 -> QUOTATION MARK
+ u'#' # 0x0023 -> NUMBER SIGN
+ u'$' # 0x0024 -> DOLLAR SIGN
+ u'\u066a' # 0x0025 -> ARABIC PERCENT SIGN
+ u'&' # 0x0026 -> AMPERSAND
+ u"'" # 0x0027 -> APOSTROPHE
+ u'(' # 0x0028 -> LEFT PARENTHESIS
+ u')' # 0x0029 -> RIGHT PARENTHESIS
+ u'*' # 0x002a -> ASTERISK
+ u'+' # 0x002b -> PLUS SIGN
+ u',' # 0x002c -> COMMA
+ u'-' # 0x002d -> HYPHEN-MINUS
+ u'.' # 0x002e -> FULL STOP
+ u'/' # 0x002f -> SOLIDUS
+ u'0' # 0x0030 -> DIGIT ZERO
+ u'1' # 0x0031 -> DIGIT ONE
+ u'2' # 0x0032 -> DIGIT TWO
+ u'3' # 0x0033 -> DIGIT THREE
+ u'4' # 0x0034 -> DIGIT FOUR
+ u'5' # 0x0035 -> DIGIT FIVE
+ u'6' # 0x0036 -> DIGIT SIX
+ u'7' # 0x0037 -> DIGIT SEVEN
+ u'8' # 0x0038 -> DIGIT EIGHT
+ u'9' # 0x0039 -> DIGIT NINE
+ u':' # 0x003a -> COLON
+ u';' # 0x003b -> SEMICOLON
+ u'<' # 0x003c -> LESS-THAN SIGN
+ u'=' # 0x003d -> EQUALS SIGN
+ u'>' # 0x003e -> GREATER-THAN SIGN
+ u'?' # 0x003f -> QUESTION MARK
+ u'@' # 0x0040 -> COMMERCIAL AT
+ u'A' # 0x0041 -> LATIN CAPITAL LETTER A
+ u'B' # 0x0042 -> LATIN CAPITAL LETTER B
+ u'C' # 0x0043 -> LATIN CAPITAL LETTER C
+ u'D' # 0x0044 -> LATIN CAPITAL LETTER D
+ u'E' # 0x0045 -> LATIN CAPITAL LETTER E
+ u'F' # 0x0046 -> LATIN CAPITAL LETTER F
+ u'G' # 0x0047 -> LATIN CAPITAL LETTER G
+ u'H' # 0x0048 -> LATIN CAPITAL LETTER H
+ u'I' # 0x0049 -> LATIN CAPITAL LETTER I
+ u'J' # 0x004a -> LATIN CAPITAL LETTER J
+ u'K' # 0x004b -> LATIN CAPITAL LETTER K
+ u'L' # 0x004c -> LATIN CAPITAL LETTER L
+ u'M' # 0x004d -> LATIN CAPITAL LETTER M
+ u'N' # 0x004e -> LATIN CAPITAL LETTER N
+ u'O' # 0x004f -> LATIN CAPITAL LETTER O
+ u'P' # 0x0050 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x0052 -> LATIN CAPITAL LETTER R
+ u'S' # 0x0053 -> LATIN CAPITAL LETTER S
+ u'T' # 0x0054 -> LATIN CAPITAL LETTER T
+ u'U' # 0x0055 -> LATIN CAPITAL LETTER U
+ u'V' # 0x0056 -> LATIN CAPITAL LETTER V
+ u'W' # 0x0057 -> LATIN CAPITAL LETTER W
+ u'X' # 0x0058 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x005a -> LATIN CAPITAL LETTER Z
+ u'[' # 0x005b -> LEFT SQUARE BRACKET
+ u'\\' # 0x005c -> REVERSE SOLIDUS
+ u']' # 0x005d -> RIGHT SQUARE BRACKET
+ u'^' # 0x005e -> CIRCUMFLEX ACCENT
+ u'_' # 0x005f -> LOW LINE
+ u'`' # 0x0060 -> GRAVE ACCENT
+ u'a' # 0x0061 -> LATIN SMALL LETTER A
+ u'b' # 0x0062 -> LATIN SMALL LETTER B
+ u'c' # 0x0063 -> LATIN SMALL LETTER C
+ u'd' # 0x0064 -> LATIN SMALL LETTER D
+ u'e' # 0x0065 -> LATIN SMALL LETTER E
+ u'f' # 0x0066 -> LATIN SMALL LETTER F
+ u'g' # 0x0067 -> LATIN SMALL LETTER G
+ u'h' # 0x0068 -> LATIN SMALL LETTER H
+ u'i' # 0x0069 -> LATIN SMALL LETTER I
+ u'j' # 0x006a -> LATIN SMALL LETTER J
+ u'k' # 0x006b -> LATIN SMALL LETTER K
+ u'l' # 0x006c -> LATIN SMALL LETTER L
+ u'm' # 0x006d -> LATIN SMALL LETTER M
+ u'n' # 0x006e -> LATIN SMALL LETTER N
+ u'o' # 0x006f -> LATIN SMALL LETTER O
+ u'p' # 0x0070 -> LATIN SMALL LETTER P
+ u'q' # 0x0071 -> LATIN SMALL LETTER Q
+ u'r' # 0x0072 -> LATIN SMALL LETTER R
+ u's' # 0x0073 -> LATIN SMALL LETTER S
+ u't' # 0x0074 -> LATIN SMALL LETTER T
+ u'u' # 0x0075 -> LATIN SMALL LETTER U
+ u'v' # 0x0076 -> LATIN SMALL LETTER V
+ u'w' # 0x0077 -> LATIN SMALL LETTER W
+ u'x' # 0x0078 -> LATIN SMALL LETTER X
+ u'y' # 0x0079 -> LATIN SMALL LETTER Y
+ u'z' # 0x007a -> LATIN SMALL LETTER Z
+ u'{' # 0x007b -> LEFT CURLY BRACKET
+ u'|' # 0x007c -> VERTICAL LINE
+ u'}' # 0x007d -> RIGHT CURLY BRACKET
+ u'~' # 0x007e -> TILDE
+ u'\x7f' # 0x007f -> DELETE
+ u'\xb0' # 0x0080 -> DEGREE SIGN
+ u'\xb7' # 0x0081 -> MIDDLE DOT
+ u'\u2219' # 0x0082 -> BULLET OPERATOR
+ u'\u221a' # 0x0083 -> SQUARE ROOT
+ u'\u2592' # 0x0084 -> MEDIUM SHADE
+ u'\u2500' # 0x0085 -> FORMS LIGHT HORIZONTAL
+ u'\u2502' # 0x0086 -> FORMS LIGHT VERTICAL
+ u'\u253c' # 0x0087 -> FORMS LIGHT VERTICAL AND HORIZONTAL
+ u'\u2524' # 0x0088 -> FORMS LIGHT VERTICAL AND LEFT
+ u'\u252c' # 0x0089 -> FORMS LIGHT DOWN AND HORIZONTAL
+ u'\u251c' # 0x008a -> FORMS LIGHT VERTICAL AND RIGHT
+ u'\u2534' # 0x008b -> FORMS LIGHT UP AND HORIZONTAL
+ u'\u2510' # 0x008c -> FORMS LIGHT DOWN AND LEFT
+ u'\u250c' # 0x008d -> FORMS LIGHT DOWN AND RIGHT
+ u'\u2514' # 0x008e -> FORMS LIGHT UP AND RIGHT
+ u'\u2518' # 0x008f -> FORMS LIGHT UP AND LEFT
+ u'\u03b2' # 0x0090 -> GREEK SMALL BETA
+ u'\u221e' # 0x0091 -> INFINITY
+ u'\u03c6' # 0x0092 -> GREEK SMALL PHI
+ u'\xb1' # 0x0093 -> PLUS-OR-MINUS SIGN
+ u'\xbd' # 0x0094 -> FRACTION 1/2
+ u'\xbc' # 0x0095 -> FRACTION 1/4
+ u'\u2248' # 0x0096 -> ALMOST EQUAL TO
+ u'\xab' # 0x0097 -> LEFT POINTING GUILLEMET
+ u'\xbb' # 0x0098 -> RIGHT POINTING GUILLEMET
+ u'\ufef7' # 0x0099 -> ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE ISOLATED FORM
+ u'\ufef8' # 0x009a -> ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE FINAL FORM
+ u'\ufffe' # 0x009b -> UNDEFINED
+ u'\ufffe' # 0x009c -> UNDEFINED
+ u'\ufefb' # 0x009d -> ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM
+ u'\ufefc' # 0x009e -> ARABIC LIGATURE LAM WITH ALEF FINAL FORM
+ u'\ufffe' # 0x009f -> UNDEFINED
+ u'\xa0' # 0x00a0 -> NON-BREAKING SPACE
+ u'\xad' # 0x00a1 -> SOFT HYPHEN
+ u'\ufe82' # 0x00a2 -> ARABIC LETTER ALEF WITH MADDA ABOVE FINAL FORM
+ u'\xa3' # 0x00a3 -> POUND SIGN
+ u'\xa4' # 0x00a4 -> CURRENCY SIGN
+ u'\ufe84' # 0x00a5 -> ARABIC LETTER ALEF WITH HAMZA ABOVE FINAL FORM
+ u'\ufffe' # 0x00a6 -> UNDEFINED
+ u'\ufffe' # 0x00a7 -> UNDEFINED
+ u'\ufe8e' # 0x00a8 -> ARABIC LETTER ALEF FINAL FORM
+ u'\ufe8f' # 0x00a9 -> ARABIC LETTER BEH ISOLATED FORM
+ u'\ufe95' # 0x00aa -> ARABIC LETTER TEH ISOLATED FORM
+ u'\ufe99' # 0x00ab -> ARABIC LETTER THEH ISOLATED FORM
+ u'\u060c' # 0x00ac -> ARABIC COMMA
+ u'\ufe9d' # 0x00ad -> ARABIC LETTER JEEM ISOLATED FORM
+ u'\ufea1' # 0x00ae -> ARABIC LETTER HAH ISOLATED FORM
+ u'\ufea5' # 0x00af -> ARABIC LETTER KHAH ISOLATED FORM
+ u'\u0660' # 0x00b0 -> ARABIC-INDIC DIGIT ZERO
+ u'\u0661' # 0x00b1 -> ARABIC-INDIC DIGIT ONE
+ u'\u0662' # 0x00b2 -> ARABIC-INDIC DIGIT TWO
+ u'\u0663' # 0x00b3 -> ARABIC-INDIC DIGIT THREE
+ u'\u0664' # 0x00b4 -> ARABIC-INDIC DIGIT FOUR
+ u'\u0665' # 0x00b5 -> ARABIC-INDIC DIGIT FIVE
+ u'\u0666' # 0x00b6 -> ARABIC-INDIC DIGIT SIX
+ u'\u0667' # 0x00b7 -> ARABIC-INDIC DIGIT SEVEN
+ u'\u0668' # 0x00b8 -> ARABIC-INDIC DIGIT EIGHT
+ u'\u0669' # 0x00b9 -> ARABIC-INDIC DIGIT NINE
+ u'\ufed1' # 0x00ba -> ARABIC LETTER FEH ISOLATED FORM
+ u'\u061b' # 0x00bb -> ARABIC SEMICOLON
+ u'\ufeb1' # 0x00bc -> ARABIC LETTER SEEN ISOLATED FORM
+ u'\ufeb5' # 0x00bd -> ARABIC LETTER SHEEN ISOLATED FORM
+ u'\ufeb9' # 0x00be -> ARABIC LETTER SAD ISOLATED FORM
+ u'\u061f' # 0x00bf -> ARABIC QUESTION MARK
+ u'\xa2' # 0x00c0 -> CENT SIGN
+ u'\ufe80' # 0x00c1 -> ARABIC LETTER HAMZA ISOLATED FORM
+ u'\ufe81' # 0x00c2 -> ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM
+ u'\ufe83' # 0x00c3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE ISOLATED FORM
+ u'\ufe85' # 0x00c4 -> ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM
+ u'\ufeca' # 0x00c5 -> ARABIC LETTER AIN FINAL FORM
+ u'\ufe8b' # 0x00c6 -> ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM
+ u'\ufe8d' # 0x00c7 -> ARABIC LETTER ALEF ISOLATED FORM
+ u'\ufe91' # 0x00c8 -> ARABIC LETTER BEH INITIAL FORM
+ u'\ufe93' # 0x00c9 -> ARABIC LETTER TEH MARBUTA ISOLATED FORM
+ u'\ufe97' # 0x00ca -> ARABIC LETTER TEH INITIAL FORM
+ u'\ufe9b' # 0x00cb -> ARABIC LETTER THEH INITIAL FORM
+ u'\ufe9f' # 0x00cc -> ARABIC LETTER JEEM INITIAL FORM
+ u'\ufea3' # 0x00cd -> ARABIC LETTER HAH INITIAL FORM
+ u'\ufea7' # 0x00ce -> ARABIC LETTER KHAH INITIAL FORM
+ u'\ufea9' # 0x00cf -> ARABIC LETTER DAL ISOLATED FORM
+ u'\ufeab' # 0x00d0 -> ARABIC LETTER THAL ISOLATED FORM
+ u'\ufead' # 0x00d1 -> ARABIC LETTER REH ISOLATED FORM
+ u'\ufeaf' # 0x00d2 -> ARABIC LETTER ZAIN ISOLATED FORM
+ u'\ufeb3' # 0x00d3 -> ARABIC LETTER SEEN INITIAL FORM
+ u'\ufeb7' # 0x00d4 -> ARABIC LETTER SHEEN INITIAL FORM
+ u'\ufebb' # 0x00d5 -> ARABIC LETTER SAD INITIAL FORM
+ u'\ufebf' # 0x00d6 -> ARABIC LETTER DAD INITIAL FORM
+ u'\ufec1' # 0x00d7 -> ARABIC LETTER TAH ISOLATED FORM
+ u'\ufec5' # 0x00d8 -> ARABIC LETTER ZAH ISOLATED FORM
+ u'\ufecb' # 0x00d9 -> ARABIC LETTER AIN INITIAL FORM
+ u'\ufecf' # 0x00da -> ARABIC LETTER GHAIN INITIAL FORM
+ u'\xa6' # 0x00db -> BROKEN VERTICAL BAR
+ u'\xac' # 0x00dc -> NOT SIGN
+ u'\xf7' # 0x00dd -> DIVISION SIGN
+ u'\xd7' # 0x00de -> MULTIPLICATION SIGN
+ u'\ufec9' # 0x00df -> ARABIC LETTER AIN ISOLATED FORM
+ u'\u0640' # 0x00e0 -> ARABIC TATWEEL
+ u'\ufed3' # 0x00e1 -> ARABIC LETTER FEH INITIAL FORM
+ u'\ufed7' # 0x00e2 -> ARABIC LETTER QAF INITIAL FORM
+ u'\ufedb' # 0x00e3 -> ARABIC LETTER KAF INITIAL FORM
+ u'\ufedf' # 0x00e4 -> ARABIC LETTER LAM INITIAL FORM
+ u'\ufee3' # 0x00e5 -> ARABIC LETTER MEEM INITIAL FORM
+ u'\ufee7' # 0x00e6 -> ARABIC LETTER NOON INITIAL FORM
+ u'\ufeeb' # 0x00e7 -> ARABIC LETTER HEH INITIAL FORM
+ u'\ufeed' # 0x00e8 -> ARABIC LETTER WAW ISOLATED FORM
+ u'\ufeef' # 0x00e9 -> ARABIC LETTER ALEF MAKSURA ISOLATED FORM
+ u'\ufef3' # 0x00ea -> ARABIC LETTER YEH INITIAL FORM
+ u'\ufebd' # 0x00eb -> ARABIC LETTER DAD ISOLATED FORM
+ u'\ufecc' # 0x00ec -> ARABIC LETTER AIN MEDIAL FORM
+ u'\ufece' # 0x00ed -> ARABIC LETTER GHAIN FINAL FORM
+ u'\ufecd' # 0x00ee -> ARABIC LETTER GHAIN ISOLATED FORM
+ u'\ufee1' # 0x00ef -> ARABIC LETTER MEEM ISOLATED FORM
+ u'\ufe7d' # 0x00f0 -> ARABIC SHADDA MEDIAL FORM
+ u'\u0651' # 0x00f1 -> ARABIC SHADDAH
+ u'\ufee5' # 0x00f2 -> ARABIC LETTER NOON ISOLATED FORM
+ u'\ufee9' # 0x00f3 -> ARABIC LETTER HEH ISOLATED FORM
+ u'\ufeec' # 0x00f4 -> ARABIC LETTER HEH MEDIAL FORM
+ u'\ufef0' # 0x00f5 -> ARABIC LETTER ALEF MAKSURA FINAL FORM
+ u'\ufef2' # 0x00f6 -> ARABIC LETTER YEH FINAL FORM
+ u'\ufed0' # 0x00f7 -> ARABIC LETTER GHAIN MEDIAL FORM
+ u'\ufed5' # 0x00f8 -> ARABIC LETTER QAF ISOLATED FORM
+ u'\ufef5' # 0x00f9 -> ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM
+ u'\ufef6' # 0x00fa -> ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM
+ u'\ufedd' # 0x00fb -> ARABIC LETTER LAM ISOLATED FORM
+ u'\ufed9' # 0x00fc -> ARABIC LETTER KAF ISOLATED FORM
+ u'\ufef1' # 0x00fd -> ARABIC LETTER YEH ISOLATED FORM
+ u'\u25a0' # 0x00fe -> BLACK SQUARE
+ u'\ufffe' # 0x00ff -> UNDEFINED
+)
+
+### Encoding Map
+
+encoding_map = {
+ 0x0000: 0x0000, # NULL
+ 0x0001: 0x0001, # START OF HEADING
+ 0x0002: 0x0002, # START OF TEXT
+ 0x0003: 0x0003, # END OF TEXT
+ 0x0004: 0x0004, # END OF TRANSMISSION
+ 0x0005: 0x0005, # ENQUIRY
+ 0x0006: 0x0006, # ACKNOWLEDGE
+ 0x0007: 0x0007, # BELL
+ 0x0008: 0x0008, # BACKSPACE
+ 0x0009: 0x0009, # HORIZONTAL TABULATION
+ 0x000a: 0x000a, # LINE FEED
+ 0x000b: 0x000b, # VERTICAL TABULATION
+ 0x000c: 0x000c, # FORM FEED
+ 0x000d: 0x000d, # CARRIAGE RETURN
+ 0x000e: 0x000e, # SHIFT OUT
+ 0x000f: 0x000f, # SHIFT IN
+ 0x0010: 0x0010, # DATA LINK ESCAPE
+ 0x0011: 0x0011, # DEVICE CONTROL ONE
+ 0x0012: 0x0012, # DEVICE CONTROL TWO
+ 0x0013: 0x0013, # DEVICE CONTROL THREE
+ 0x0014: 0x0014, # DEVICE CONTROL FOUR
+ 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE
+ 0x0016: 0x0016, # SYNCHRONOUS IDLE
+ 0x0017: 0x0017, # END OF TRANSMISSION BLOCK
+ 0x0018: 0x0018, # CANCEL
+ 0x0019: 0x0019, # END OF MEDIUM
+ 0x001a: 0x001a, # SUBSTITUTE
+ 0x001b: 0x001b, # ESCAPE
+ 0x001c: 0x001c, # FILE SEPARATOR
+ 0x001d: 0x001d, # GROUP SEPARATOR
+ 0x001e: 0x001e, # RECORD SEPARATOR
+ 0x001f: 0x001f, # UNIT SEPARATOR
+ 0x0020: 0x0020, # SPACE
+ 0x0021: 0x0021, # EXCLAMATION MARK
+ 0x0022: 0x0022, # QUOTATION MARK
+ 0x0023: 0x0023, # NUMBER SIGN
+ 0x0024: 0x0024, # DOLLAR SIGN
+ 0x0026: 0x0026, # AMPERSAND
+ 0x0027: 0x0027, # APOSTROPHE
+ 0x0028: 0x0028, # LEFT PARENTHESIS
+ 0x0029: 0x0029, # RIGHT PARENTHESIS
+ 0x002a: 0x002a, # ASTERISK
+ 0x002b: 0x002b, # PLUS SIGN
+ 0x002c: 0x002c, # COMMA
+ 0x002d: 0x002d, # HYPHEN-MINUS
+ 0x002e: 0x002e, # FULL STOP
+ 0x002f: 0x002f, # SOLIDUS
+ 0x0030: 0x0030, # DIGIT ZERO
+ 0x0031: 0x0031, # DIGIT ONE
+ 0x0032: 0x0032, # DIGIT TWO
+ 0x0033: 0x0033, # DIGIT THREE
+ 0x0034: 0x0034, # DIGIT FOUR
+ 0x0035: 0x0035, # DIGIT FIVE
+ 0x0036: 0x0036, # DIGIT SIX
+ 0x0037: 0x0037, # DIGIT SEVEN
+ 0x0038: 0x0038, # DIGIT EIGHT
+ 0x0039: 0x0039, # DIGIT NINE
+ 0x003a: 0x003a, # COLON
+ 0x003b: 0x003b, # SEMICOLON
+ 0x003c: 0x003c, # LESS-THAN SIGN
+ 0x003d: 0x003d, # EQUALS SIGN
+ 0x003e: 0x003e, # GREATER-THAN SIGN
+ 0x003f: 0x003f, # QUESTION MARK
+ 0x0040: 0x0040, # COMMERCIAL AT
+ 0x0041: 0x0041, # LATIN CAPITAL LETTER A
+ 0x0042: 0x0042, # LATIN CAPITAL LETTER B
+ 0x0043: 0x0043, # LATIN CAPITAL LETTER C
+ 0x0044: 0x0044, # LATIN CAPITAL LETTER D
+ 0x0045: 0x0045, # LATIN CAPITAL LETTER E
+ 0x0046: 0x0046, # LATIN CAPITAL LETTER F
+ 0x0047: 0x0047, # LATIN CAPITAL LETTER G
+ 0x0048: 0x0048, # LATIN CAPITAL LETTER H
+ 0x0049: 0x0049, # LATIN CAPITAL LETTER I
+ 0x004a: 0x004a, # LATIN CAPITAL LETTER J
+ 0x004b: 0x004b, # LATIN CAPITAL LETTER K
+ 0x004c: 0x004c, # LATIN CAPITAL LETTER L
+ 0x004d: 0x004d, # LATIN CAPITAL LETTER M
+ 0x004e: 0x004e, # LATIN CAPITAL LETTER N
+ 0x004f: 0x004f, # LATIN CAPITAL LETTER O
+ 0x0050: 0x0050, # LATIN CAPITAL LETTER P
+ 0x0051: 0x0051, # LATIN CAPITAL LETTER Q
+ 0x0052: 0x0052, # LATIN CAPITAL LETTER R
+ 0x0053: 0x0053, # LATIN CAPITAL LETTER S
+ 0x0054: 0x0054, # LATIN CAPITAL LETTER T
+ 0x0055: 0x0055, # LATIN CAPITAL LETTER U
+ 0x0056: 0x0056, # LATIN CAPITAL LETTER V
+ 0x0057: 0x0057, # LATIN CAPITAL LETTER W
+ 0x0058: 0x0058, # LATIN CAPITAL LETTER X
+ 0x0059: 0x0059, # LATIN CAPITAL LETTER Y
+ 0x005a: 0x005a, # LATIN CAPITAL LETTER Z
+ 0x005b: 0x005b, # LEFT SQUARE BRACKET
+ 0x005c: 0x005c, # REVERSE SOLIDUS
+ 0x005d: 0x005d, # RIGHT SQUARE BRACKET
+ 0x005e: 0x005e, # CIRCUMFLEX ACCENT
+ 0x005f: 0x005f, # LOW LINE
+ 0x0060: 0x0060, # GRAVE ACCENT
+ 0x0061: 0x0061, # LATIN SMALL LETTER A
+ 0x0062: 0x0062, # LATIN SMALL LETTER B
+ 0x0063: 0x0063, # LATIN SMALL LETTER C
+ 0x0064: 0x0064, # LATIN SMALL LETTER D
+ 0x0065: 0x0065, # LATIN SMALL LETTER E
+ 0x0066: 0x0066, # LATIN SMALL LETTER F
+ 0x0067: 0x0067, # LATIN SMALL LETTER G
+ 0x0068: 0x0068, # LATIN SMALL LETTER H
+ 0x0069: 0x0069, # LATIN SMALL LETTER I
+ 0x006a: 0x006a, # LATIN SMALL LETTER J
+ 0x006b: 0x006b, # LATIN SMALL LETTER K
+ 0x006c: 0x006c, # LATIN SMALL LETTER L
+ 0x006d: 0x006d, # LATIN SMALL LETTER M
+ 0x006e: 0x006e, # LATIN SMALL LETTER N
+ 0x006f: 0x006f, # LATIN SMALL LETTER O
+ 0x0070: 0x0070, # LATIN SMALL LETTER P
+ 0x0071: 0x0071, # LATIN SMALL LETTER Q
+ 0x0072: 0x0072, # LATIN SMALL LETTER R
+ 0x0073: 0x0073, # LATIN SMALL LETTER S
+ 0x0074: 0x0074, # LATIN SMALL LETTER T
+ 0x0075: 0x0075, # LATIN SMALL LETTER U
+ 0x0076: 0x0076, # LATIN SMALL LETTER V
+ 0x0077: 0x0077, # LATIN SMALL LETTER W
+ 0x0078: 0x0078, # LATIN SMALL LETTER X
+ 0x0079: 0x0079, # LATIN SMALL LETTER Y
+ 0x007a: 0x007a, # LATIN SMALL LETTER Z
+ 0x007b: 0x007b, # LEFT CURLY BRACKET
+ 0x007c: 0x007c, # VERTICAL LINE
+ 0x007d: 0x007d, # RIGHT CURLY BRACKET
+ 0x007e: 0x007e, # TILDE
+ 0x007f: 0x007f, # DELETE
+ 0x00a0: 0x00a0, # NON-BREAKING SPACE
+ 0x00a2: 0x00c0, # CENT SIGN
+ 0x00a3: 0x00a3, # POUND SIGN
+ 0x00a4: 0x00a4, # CURRENCY SIGN
+ 0x00a6: 0x00db, # BROKEN VERTICAL BAR
+ 0x00ab: 0x0097, # LEFT POINTING GUILLEMET
+ 0x00ac: 0x00dc, # NOT SIGN
+ 0x00ad: 0x00a1, # SOFT HYPHEN
+ 0x00b0: 0x0080, # DEGREE SIGN
+ 0x00b1: 0x0093, # PLUS-OR-MINUS SIGN
+ 0x00b7: 0x0081, # MIDDLE DOT
+ 0x00bb: 0x0098, # RIGHT POINTING GUILLEMET
+ 0x00bc: 0x0095, # FRACTION 1/4
+ 0x00bd: 0x0094, # FRACTION 1/2
+ 0x00d7: 0x00de, # MULTIPLICATION SIGN
+ 0x00f7: 0x00dd, # DIVISION SIGN
+ 0x03b2: 0x0090, # GREEK SMALL BETA
+ 0x03c6: 0x0092, # GREEK SMALL PHI
+ 0x060c: 0x00ac, # ARABIC COMMA
+ 0x061b: 0x00bb, # ARABIC SEMICOLON
+ 0x061f: 0x00bf, # ARABIC QUESTION MARK
+ 0x0640: 0x00e0, # ARABIC TATWEEL
+ 0x0651: 0x00f1, # ARABIC SHADDAH
+ 0x0660: 0x00b0, # ARABIC-INDIC DIGIT ZERO
+ 0x0661: 0x00b1, # ARABIC-INDIC DIGIT ONE
+ 0x0662: 0x00b2, # ARABIC-INDIC DIGIT TWO
+ 0x0663: 0x00b3, # ARABIC-INDIC DIGIT THREE
+ 0x0664: 0x00b4, # ARABIC-INDIC DIGIT FOUR
+ 0x0665: 0x00b5, # ARABIC-INDIC DIGIT FIVE
+ 0x0666: 0x00b6, # ARABIC-INDIC DIGIT SIX
+ 0x0667: 0x00b7, # ARABIC-INDIC DIGIT SEVEN
+ 0x0668: 0x00b8, # ARABIC-INDIC DIGIT EIGHT
+ 0x0669: 0x00b9, # ARABIC-INDIC DIGIT NINE
+ 0x066a: 0x0025, # ARABIC PERCENT SIGN
+ 0x2219: 0x0082, # BULLET OPERATOR
+ 0x221a: 0x0083, # SQUARE ROOT
+ 0x221e: 0x0091, # INFINITY
+ 0x2248: 0x0096, # ALMOST EQUAL TO
+ 0x2500: 0x0085, # FORMS LIGHT HORIZONTAL
+ 0x2502: 0x0086, # FORMS LIGHT VERTICAL
+ 0x250c: 0x008d, # FORMS LIGHT DOWN AND RIGHT
+ 0x2510: 0x008c, # FORMS LIGHT DOWN AND LEFT
+ 0x2514: 0x008e, # FORMS LIGHT UP AND RIGHT
+ 0x2518: 0x008f, # FORMS LIGHT UP AND LEFT
+ 0x251c: 0x008a, # FORMS LIGHT VERTICAL AND RIGHT
+ 0x2524: 0x0088, # FORMS LIGHT VERTICAL AND LEFT
+ 0x252c: 0x0089, # FORMS LIGHT DOWN AND HORIZONTAL
+ 0x2534: 0x008b, # FORMS LIGHT UP AND HORIZONTAL
+ 0x253c: 0x0087, # FORMS LIGHT VERTICAL AND HORIZONTAL
+ 0x2592: 0x0084, # MEDIUM SHADE
+ 0x25a0: 0x00fe, # BLACK SQUARE
+ 0xfe7d: 0x00f0, # ARABIC SHADDA MEDIAL FORM
+ 0xfe80: 0x00c1, # ARABIC LETTER HAMZA ISOLATED FORM
+ 0xfe81: 0x00c2, # ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM
+ 0xfe82: 0x00a2, # ARABIC LETTER ALEF WITH MADDA ABOVE FINAL FORM
+ 0xfe83: 0x00c3, # ARABIC LETTER ALEF WITH HAMZA ABOVE ISOLATED FORM
+ 0xfe84: 0x00a5, # ARABIC LETTER ALEF WITH HAMZA ABOVE FINAL FORM
+ 0xfe85: 0x00c4, # ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM
+ 0xfe8b: 0x00c6, # ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM
+ 0xfe8d: 0x00c7, # ARABIC LETTER ALEF ISOLATED FORM
+ 0xfe8e: 0x00a8, # ARABIC LETTER ALEF FINAL FORM
+ 0xfe8f: 0x00a9, # ARABIC LETTER BEH ISOLATED FORM
+ 0xfe91: 0x00c8, # ARABIC LETTER BEH INITIAL FORM
+ 0xfe93: 0x00c9, # ARABIC LETTER TEH MARBUTA ISOLATED FORM
+ 0xfe95: 0x00aa, # ARABIC LETTER TEH ISOLATED FORM
+ 0xfe97: 0x00ca, # ARABIC LETTER TEH INITIAL FORM
+ 0xfe99: 0x00ab, # ARABIC LETTER THEH ISOLATED FORM
+ 0xfe9b: 0x00cb, # ARABIC LETTER THEH INITIAL FORM
+ 0xfe9d: 0x00ad, # ARABIC LETTER JEEM ISOLATED FORM
+ 0xfe9f: 0x00cc, # ARABIC LETTER JEEM INITIAL FORM
+ 0xfea1: 0x00ae, # ARABIC LETTER HAH ISOLATED FORM
+ 0xfea3: 0x00cd, # ARABIC LETTER HAH INITIAL FORM
+ 0xfea5: 0x00af, # ARABIC LETTER KHAH ISOLATED FORM
+ 0xfea7: 0x00ce, # ARABIC LETTER KHAH INITIAL FORM
+ 0xfea9: 0x00cf, # ARABIC LETTER DAL ISOLATED FORM
+ 0xfeab: 0x00d0, # ARABIC LETTER THAL ISOLATED FORM
+ 0xfead: 0x00d1, # ARABIC LETTER REH ISOLATED FORM
+ 0xfeaf: 0x00d2, # ARABIC LETTER ZAIN ISOLATED FORM
+ 0xfeb1: 0x00bc, # ARABIC LETTER SEEN ISOLATED FORM
+ 0xfeb3: 0x00d3, # ARABIC LETTER SEEN INITIAL FORM
+ 0xfeb5: 0x00bd, # ARABIC LETTER SHEEN ISOLATED FORM
+ 0xfeb7: 0x00d4, # ARABIC LETTER SHEEN INITIAL FORM
+ 0xfeb9: 0x00be, # ARABIC LETTER SAD ISOLATED FORM
+ 0xfebb: 0x00d5, # ARABIC LETTER SAD INITIAL FORM
+ 0xfebd: 0x00eb, # ARABIC LETTER DAD ISOLATED FORM
+ 0xfebf: 0x00d6, # ARABIC LETTER DAD INITIAL FORM
+ 0xfec1: 0x00d7, # ARABIC LETTER TAH ISOLATED FORM
+ 0xfec5: 0x00d8, # ARABIC LETTER ZAH ISOLATED FORM
+ 0xfec9: 0x00df, # ARABIC LETTER AIN ISOLATED FORM
+ 0xfeca: 0x00c5, # ARABIC LETTER AIN FINAL FORM
+ 0xfecb: 0x00d9, # ARABIC LETTER AIN INITIAL FORM
+ 0xfecc: 0x00ec, # ARABIC LETTER AIN MEDIAL FORM
+ 0xfecd: 0x00ee, # ARABIC LETTER GHAIN ISOLATED FORM
+ 0xfece: 0x00ed, # ARABIC LETTER GHAIN FINAL FORM
+ 0xfecf: 0x00da, # ARABIC LETTER GHAIN INITIAL FORM
+ 0xfed0: 0x00f7, # ARABIC LETTER GHAIN MEDIAL FORM
+ 0xfed1: 0x00ba, # ARABIC LETTER FEH ISOLATED FORM
+ 0xfed3: 0x00e1, # ARABIC LETTER FEH INITIAL FORM
+ 0xfed5: 0x00f8, # ARABIC LETTER QAF ISOLATED FORM
+ 0xfed7: 0x00e2, # ARABIC LETTER QAF INITIAL FORM
+ 0xfed9: 0x00fc, # ARABIC LETTER KAF ISOLATED FORM
+ 0xfedb: 0x00e3, # ARABIC LETTER KAF INITIAL FORM
+ 0xfedd: 0x00fb, # ARABIC LETTER LAM ISOLATED FORM
+ 0xfedf: 0x00e4, # ARABIC LETTER LAM INITIAL FORM
+ 0xfee1: 0x00ef, # ARABIC LETTER MEEM ISOLATED FORM
+ 0xfee3: 0x00e5, # ARABIC LETTER MEEM INITIAL FORM
+ 0xfee5: 0x00f2, # ARABIC LETTER NOON ISOLATED FORM
+ 0xfee7: 0x00e6, # ARABIC LETTER NOON INITIAL FORM
+ 0xfee9: 0x00f3, # ARABIC LETTER HEH ISOLATED FORM
+ 0xfeeb: 0x00e7, # ARABIC LETTER HEH INITIAL FORM
+ 0xfeec: 0x00f4, # ARABIC LETTER HEH MEDIAL FORM
+ 0xfeed: 0x00e8, # ARABIC LETTER WAW ISOLATED FORM
+ 0xfeef: 0x00e9, # ARABIC LETTER ALEF MAKSURA ISOLATED FORM
+ 0xfef0: 0x00f5, # ARABIC LETTER ALEF MAKSURA FINAL FORM
+ 0xfef1: 0x00fd, # ARABIC LETTER YEH ISOLATED FORM
+ 0xfef2: 0x00f6, # ARABIC LETTER YEH FINAL FORM
+ 0xfef3: 0x00ea, # ARABIC LETTER YEH INITIAL FORM
+ 0xfef5: 0x00f9, # ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM
+ 0xfef6: 0x00fa, # ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM
+ 0xfef7: 0x0099, # ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE ISOLATED FORM
+ 0xfef8: 0x009a, # ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE FINAL FORM
+ 0xfefb: 0x009d, # ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM
+ 0xfefc: 0x009e, # ARABIC LIGATURE LAM WITH ALEF FINAL FORM
+}
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
index 0000000000..b246a491a2
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp865.py
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP865.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp865',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE
+ 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE
+ 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE
+ 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX
+ 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS
+ 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE
+ 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS
+ 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX
+ 0x008d: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE
+ 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE
+ 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE
+ 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE
+ 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE
+ 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX
+ 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE
+ 0x0098: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS
+ 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE
+ 0x009c: 0x00a3, # POUND SIGN
+ 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE
+ 0x009e: 0x20a7, # PESETA SIGN
+ 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK
+ 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE
+ 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE
+ 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR
+ 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR
+ 0x00a8: 0x00bf, # INVERTED QUESTION MARK
+ 0x00a9: 0x2310, # REVERSED NOT SIGN
+ 0x00aa: 0x00ac, # NOT SIGN
+ 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF
+ 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER
+ 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK
+ 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00af: 0x00a4, # CURRENCY SIGN
+ 0x00b0: 0x2591, # LIGHT SHADE
+ 0x00b1: 0x2592, # MEDIUM SHADE
+ 0x00b2: 0x2593, # DARK SHADE
+ 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL
+ 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x00db: 0x2588, # FULL BLOCK
+ 0x00dc: 0x2584, # LOWER HALF BLOCK
+ 0x00dd: 0x258c, # LEFT HALF BLOCK
+ 0x00de: 0x2590, # RIGHT HALF BLOCK
+ 0x00df: 0x2580, # UPPER HALF BLOCK
+ 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA
+ 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S
+ 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA
+ 0x00e3: 0x03c0, # GREEK SMALL LETTER PI
+ 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA
+ 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA
+ 0x00e6: 0x00b5, # MICRO SIGN
+ 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU
+ 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI
+ 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA
+ 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA
+ 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA
+ 0x00ec: 0x221e, # INFINITY
+ 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI
+ 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON
+ 0x00ef: 0x2229, # INTERSECTION
+ 0x00f0: 0x2261, # IDENTICAL TO
+ 0x00f1: 0x00b1, # PLUS-MINUS SIGN
+ 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO
+ 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO
+ 0x00f4: 0x2320, # TOP HALF INTEGRAL
+ 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL
+ 0x00f6: 0x00f7, # DIVISION SIGN
+ 0x00f7: 0x2248, # ALMOST EQUAL TO
+ 0x00f8: 0x00b0, # DEGREE SIGN
+ 0x00f9: 0x2219, # BULLET OPERATOR
+ 0x00fa: 0x00b7, # MIDDLE DOT
+ 0x00fb: 0x221a, # SQUARE ROOT
+ 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N
+ 0x00fd: 0x00b2, # SUPERSCRIPT TWO
+ 0x00fe: 0x25a0, # BLACK SQUARE
+ 0x00ff: 0x00a0, # NO-BREAK SPACE
+})
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x0000 -> NULL
+ u'\x01' # 0x0001 -> START OF HEADING
+ u'\x02' # 0x0002 -> START OF TEXT
+ u'\x03' # 0x0003 -> END OF TEXT
+ u'\x04' # 0x0004 -> END OF TRANSMISSION
+ u'\x05' # 0x0005 -> ENQUIRY
+ u'\x06' # 0x0006 -> ACKNOWLEDGE
+ u'\x07' # 0x0007 -> BELL
+ u'\x08' # 0x0008 -> BACKSPACE
+ u'\t' # 0x0009 -> HORIZONTAL TABULATION
+ u'\n' # 0x000a -> LINE FEED
+ u'\x0b' # 0x000b -> VERTICAL TABULATION
+ u'\x0c' # 0x000c -> FORM FEED
+ u'\r' # 0x000d -> CARRIAGE RETURN
+ u'\x0e' # 0x000e -> SHIFT OUT
+ u'\x0f' # 0x000f -> SHIFT IN
+ u'\x10' # 0x0010 -> DATA LINK ESCAPE
+ u'\x11' # 0x0011 -> DEVICE CONTROL ONE
+ u'\x12' # 0x0012 -> DEVICE CONTROL TWO
+ u'\x13' # 0x0013 -> DEVICE CONTROL THREE
+ u'\x14' # 0x0014 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x0016 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x0018 -> CANCEL
+ u'\x19' # 0x0019 -> END OF MEDIUM
+ u'\x1a' # 0x001a -> SUBSTITUTE
+ u'\x1b' # 0x001b -> ESCAPE
+ u'\x1c' # 0x001c -> FILE SEPARATOR
+ u'\x1d' # 0x001d -> GROUP SEPARATOR
+ u'\x1e' # 0x001e -> RECORD SEPARATOR
+ u'\x1f' # 0x001f -> UNIT SEPARATOR
+ u' ' # 0x0020 -> SPACE
+ u'!' # 0x0021 -> EXCLAMATION MARK
+ u'"' # 0x0022 -> QUOTATION MARK
+ u'#' # 0x0023 -> NUMBER SIGN
+ u'$' # 0x0024 -> DOLLAR SIGN
+ u'%' # 0x0025 -> PERCENT SIGN
+ u'&' # 0x0026 -> AMPERSAND
+ u"'" # 0x0027 -> APOSTROPHE
+ u'(' # 0x0028 -> LEFT PARENTHESIS
+ u')' # 0x0029 -> RIGHT PARENTHESIS
+ u'*' # 0x002a -> ASTERISK
+ u'+' # 0x002b -> PLUS SIGN
+ u',' # 0x002c -> COMMA
+ u'-' # 0x002d -> HYPHEN-MINUS
+ u'.' # 0x002e -> FULL STOP
+ u'/' # 0x002f -> SOLIDUS
+ u'0' # 0x0030 -> DIGIT ZERO
+ u'1' # 0x0031 -> DIGIT ONE
+ u'2' # 0x0032 -> DIGIT TWO
+ u'3' # 0x0033 -> DIGIT THREE
+ u'4' # 0x0034 -> DIGIT FOUR
+ u'5' # 0x0035 -> DIGIT FIVE
+ u'6' # 0x0036 -> DIGIT SIX
+ u'7' # 0x0037 -> DIGIT SEVEN
+ u'8' # 0x0038 -> DIGIT EIGHT
+ u'9' # 0x0039 -> DIGIT NINE
+ u':' # 0x003a -> COLON
+ u';' # 0x003b -> SEMICOLON
+ u'<' # 0x003c -> LESS-THAN SIGN
+ u'=' # 0x003d -> EQUALS SIGN
+ u'>' # 0x003e -> GREATER-THAN SIGN
+ u'?' # 0x003f -> QUESTION MARK
+ u'@' # 0x0040 -> COMMERCIAL AT
+ u'A' # 0x0041 -> LATIN CAPITAL LETTER A
+ u'B' # 0x0042 -> LATIN CAPITAL LETTER B
+ u'C' # 0x0043 -> LATIN CAPITAL LETTER C
+ u'D' # 0x0044 -> LATIN CAPITAL LETTER D
+ u'E' # 0x0045 -> LATIN CAPITAL LETTER E
+ u'F' # 0x0046 -> LATIN CAPITAL LETTER F
+ u'G' # 0x0047 -> LATIN CAPITAL LETTER G
+ u'H' # 0x0048 -> LATIN CAPITAL LETTER H
+ u'I' # 0x0049 -> LATIN CAPITAL LETTER I
+ u'J' # 0x004a -> LATIN CAPITAL LETTER J
+ u'K' # 0x004b -> LATIN CAPITAL LETTER K
+ u'L' # 0x004c -> LATIN CAPITAL LETTER L
+ u'M' # 0x004d -> LATIN CAPITAL LETTER M
+ u'N' # 0x004e -> LATIN CAPITAL LETTER N
+ u'O' # 0x004f -> LATIN CAPITAL LETTER O
+ u'P' # 0x0050 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x0052 -> LATIN CAPITAL LETTER R
+ u'S' # 0x0053 -> LATIN CAPITAL LETTER S
+ u'T' # 0x0054 -> LATIN CAPITAL LETTER T
+ u'U' # 0x0055 -> LATIN CAPITAL LETTER U
+ u'V' # 0x0056 -> LATIN CAPITAL LETTER V
+ u'W' # 0x0057 -> LATIN CAPITAL LETTER W
+ u'X' # 0x0058 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x005a -> LATIN CAPITAL LETTER Z
+ u'[' # 0x005b -> LEFT SQUARE BRACKET
+ u'\\' # 0x005c -> REVERSE SOLIDUS
+ u']' # 0x005d -> RIGHT SQUARE BRACKET
+ u'^' # 0x005e -> CIRCUMFLEX ACCENT
+ u'_' # 0x005f -> LOW LINE
+ u'`' # 0x0060 -> GRAVE ACCENT
+ u'a' # 0x0061 -> LATIN SMALL LETTER A
+ u'b' # 0x0062 -> LATIN SMALL LETTER B
+ u'c' # 0x0063 -> LATIN SMALL LETTER C
+ u'd' # 0x0064 -> LATIN SMALL LETTER D
+ u'e' # 0x0065 -> LATIN SMALL LETTER E
+ u'f' # 0x0066 -> LATIN SMALL LETTER F
+ u'g' # 0x0067 -> LATIN SMALL LETTER G
+ u'h' # 0x0068 -> LATIN SMALL LETTER H
+ u'i' # 0x0069 -> LATIN SMALL LETTER I
+ u'j' # 0x006a -> LATIN SMALL LETTER J
+ u'k' # 0x006b -> LATIN SMALL LETTER K
+ u'l' # 0x006c -> LATIN SMALL LETTER L
+ u'm' # 0x006d -> LATIN SMALL LETTER M
+ u'n' # 0x006e -> LATIN SMALL LETTER N
+ u'o' # 0x006f -> LATIN SMALL LETTER O
+ u'p' # 0x0070 -> LATIN SMALL LETTER P
+ u'q' # 0x0071 -> LATIN SMALL LETTER Q
+ u'r' # 0x0072 -> LATIN SMALL LETTER R
+ u's' # 0x0073 -> LATIN SMALL LETTER S
+ u't' # 0x0074 -> LATIN SMALL LETTER T
+ u'u' # 0x0075 -> LATIN SMALL LETTER U
+ u'v' # 0x0076 -> LATIN SMALL LETTER V
+ u'w' # 0x0077 -> LATIN SMALL LETTER W
+ u'x' # 0x0078 -> LATIN SMALL LETTER X
+ u'y' # 0x0079 -> LATIN SMALL LETTER Y
+ u'z' # 0x007a -> LATIN SMALL LETTER Z
+ u'{' # 0x007b -> LEFT CURLY BRACKET
+ u'|' # 0x007c -> VERTICAL LINE
+ u'}' # 0x007d -> RIGHT CURLY BRACKET
+ u'~' # 0x007e -> TILDE
+ u'\x7f' # 0x007f -> DELETE
+ u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xec' # 0x008d -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE
+ u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE
+ u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xff' # 0x0098 -> LATIN SMALL LETTER Y WITH DIAERESIS
+ u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE
+ u'\xa3' # 0x009c -> POUND SIGN
+ u'\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\u20a7' # 0x009e -> PESETA SIGN
+ u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK
+ u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR
+ u'\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR
+ u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK
+ u'\u2310' # 0x00a9 -> REVERSED NOT SIGN
+ u'\xac' # 0x00aa -> NOT SIGN
+ u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF
+ u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER
+ u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK
+ u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xa4' # 0x00af -> CURRENCY SIGN
+ u'\u2591' # 0x00b0 -> LIGHT SHADE
+ u'\u2592' # 0x00b1 -> MEDIUM SHADE
+ u'\u2593' # 0x00b2 -> DARK SHADE
+ u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL
+ u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL
+ u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT
+ u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT
+ u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT
+ u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT
+ u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL
+ u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
+ u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL
+ u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT
+ u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT
+ u'\u2588' # 0x00db -> FULL BLOCK
+ u'\u2584' # 0x00dc -> LOWER HALF BLOCK
+ u'\u258c' # 0x00dd -> LEFT HALF BLOCK
+ u'\u2590' # 0x00de -> RIGHT HALF BLOCK
+ u'\u2580' # 0x00df -> UPPER HALF BLOCK
+ u'\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA
+ u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S
+ u'\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA
+ u'\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI
+ u'\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA
+ u'\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA
+ u'\xb5' # 0x00e6 -> MICRO SIGN
+ u'\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU
+ u'\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI
+ u'\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA
+ u'\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA
+ u'\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA
+ u'\u221e' # 0x00ec -> INFINITY
+ u'\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI
+ u'\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON
+ u'\u2229' # 0x00ef -> INTERSECTION
+ u'\u2261' # 0x00f0 -> IDENTICAL TO
+ u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN
+ u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO
+ u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO
+ u'\u2320' # 0x00f4 -> TOP HALF INTEGRAL
+ u'\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL
+ u'\xf7' # 0x00f6 -> DIVISION SIGN
+ u'\u2248' # 0x00f7 -> ALMOST EQUAL TO
+ u'\xb0' # 0x00f8 -> DEGREE SIGN
+ u'\u2219' # 0x00f9 -> BULLET OPERATOR
+ u'\xb7' # 0x00fa -> MIDDLE DOT
+ u'\u221a' # 0x00fb -> SQUARE ROOT
+ u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N
+ u'\xb2' # 0x00fd -> SUPERSCRIPT TWO
+ u'\u25a0' # 0x00fe -> BLACK SQUARE
+ u'\xa0' # 0x00ff -> NO-BREAK SPACE
+)
+
+### Encoding Map
+
+encoding_map = {
+ 0x0000: 0x0000, # NULL
+ 0x0001: 0x0001, # START OF HEADING
+ 0x0002: 0x0002, # START OF TEXT
+ 0x0003: 0x0003, # END OF TEXT
+ 0x0004: 0x0004, # END OF TRANSMISSION
+ 0x0005: 0x0005, # ENQUIRY
+ 0x0006: 0x0006, # ACKNOWLEDGE
+ 0x0007: 0x0007, # BELL
+ 0x0008: 0x0008, # BACKSPACE
+ 0x0009: 0x0009, # HORIZONTAL TABULATION
+ 0x000a: 0x000a, # LINE FEED
+ 0x000b: 0x000b, # VERTICAL TABULATION
+ 0x000c: 0x000c, # FORM FEED
+ 0x000d: 0x000d, # CARRIAGE RETURN
+ 0x000e: 0x000e, # SHIFT OUT
+ 0x000f: 0x000f, # SHIFT IN
+ 0x0010: 0x0010, # DATA LINK ESCAPE
+ 0x0011: 0x0011, # DEVICE CONTROL ONE
+ 0x0012: 0x0012, # DEVICE CONTROL TWO
+ 0x0013: 0x0013, # DEVICE CONTROL THREE
+ 0x0014: 0x0014, # DEVICE CONTROL FOUR
+ 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE
+ 0x0016: 0x0016, # SYNCHRONOUS IDLE
+ 0x0017: 0x0017, # END OF TRANSMISSION BLOCK
+ 0x0018: 0x0018, # CANCEL
+ 0x0019: 0x0019, # END OF MEDIUM
+ 0x001a: 0x001a, # SUBSTITUTE
+ 0x001b: 0x001b, # ESCAPE
+ 0x001c: 0x001c, # FILE SEPARATOR
+ 0x001d: 0x001d, # GROUP SEPARATOR
+ 0x001e: 0x001e, # RECORD SEPARATOR
+ 0x001f: 0x001f, # UNIT SEPARATOR
+ 0x0020: 0x0020, # SPACE
+ 0x0021: 0x0021, # EXCLAMATION MARK
+ 0x0022: 0x0022, # QUOTATION MARK
+ 0x0023: 0x0023, # NUMBER SIGN
+ 0x0024: 0x0024, # DOLLAR SIGN
+ 0x0025: 0x0025, # PERCENT SIGN
+ 0x0026: 0x0026, # AMPERSAND
+ 0x0027: 0x0027, # APOSTROPHE
+ 0x0028: 0x0028, # LEFT PARENTHESIS
+ 0x0029: 0x0029, # RIGHT PARENTHESIS
+ 0x002a: 0x002a, # ASTERISK
+ 0x002b: 0x002b, # PLUS SIGN
+ 0x002c: 0x002c, # COMMA
+ 0x002d: 0x002d, # HYPHEN-MINUS
+ 0x002e: 0x002e, # FULL STOP
+ 0x002f: 0x002f, # SOLIDUS
+ 0x0030: 0x0030, # DIGIT ZERO
+ 0x0031: 0x0031, # DIGIT ONE
+ 0x0032: 0x0032, # DIGIT TWO
+ 0x0033: 0x0033, # DIGIT THREE
+ 0x0034: 0x0034, # DIGIT FOUR
+ 0x0035: 0x0035, # DIGIT FIVE
+ 0x0036: 0x0036, # DIGIT SIX
+ 0x0037: 0x0037, # DIGIT SEVEN
+ 0x0038: 0x0038, # DIGIT EIGHT
+ 0x0039: 0x0039, # DIGIT NINE
+ 0x003a: 0x003a, # COLON
+ 0x003b: 0x003b, # SEMICOLON
+ 0x003c: 0x003c, # LESS-THAN SIGN
+ 0x003d: 0x003d, # EQUALS SIGN
+ 0x003e: 0x003e, # GREATER-THAN SIGN
+ 0x003f: 0x003f, # QUESTION MARK
+ 0x0040: 0x0040, # COMMERCIAL AT
+ 0x0041: 0x0041, # LATIN CAPITAL LETTER A
+ 0x0042: 0x0042, # LATIN CAPITAL LETTER B
+ 0x0043: 0x0043, # LATIN CAPITAL LETTER C
+ 0x0044: 0x0044, # LATIN CAPITAL LETTER D
+ 0x0045: 0x0045, # LATIN CAPITAL LETTER E
+ 0x0046: 0x0046, # LATIN CAPITAL LETTER F
+ 0x0047: 0x0047, # LATIN CAPITAL LETTER G
+ 0x0048: 0x0048, # LATIN CAPITAL LETTER H
+ 0x0049: 0x0049, # LATIN CAPITAL LETTER I
+ 0x004a: 0x004a, # LATIN CAPITAL LETTER J
+ 0x004b: 0x004b, # LATIN CAPITAL LETTER K
+ 0x004c: 0x004c, # LATIN CAPITAL LETTER L
+ 0x004d: 0x004d, # LATIN CAPITAL LETTER M
+ 0x004e: 0x004e, # LATIN CAPITAL LETTER N
+ 0x004f: 0x004f, # LATIN CAPITAL LETTER O
+ 0x0050: 0x0050, # LATIN CAPITAL LETTER P
+ 0x0051: 0x0051, # LATIN CAPITAL LETTER Q
+ 0x0052: 0x0052, # LATIN CAPITAL LETTER R
+ 0x0053: 0x0053, # LATIN CAPITAL LETTER S
+ 0x0054: 0x0054, # LATIN CAPITAL LETTER T
+ 0x0055: 0x0055, # LATIN CAPITAL LETTER U
+ 0x0056: 0x0056, # LATIN CAPITAL LETTER V
+ 0x0057: 0x0057, # LATIN CAPITAL LETTER W
+ 0x0058: 0x0058, # LATIN CAPITAL LETTER X
+ 0x0059: 0x0059, # LATIN CAPITAL LETTER Y
+ 0x005a: 0x005a, # LATIN CAPITAL LETTER Z
+ 0x005b: 0x005b, # LEFT SQUARE BRACKET
+ 0x005c: 0x005c, # REVERSE SOLIDUS
+ 0x005d: 0x005d, # RIGHT SQUARE BRACKET
+ 0x005e: 0x005e, # CIRCUMFLEX ACCENT
+ 0x005f: 0x005f, # LOW LINE
+ 0x0060: 0x0060, # GRAVE ACCENT
+ 0x0061: 0x0061, # LATIN SMALL LETTER A
+ 0x0062: 0x0062, # LATIN SMALL LETTER B
+ 0x0063: 0x0063, # LATIN SMALL LETTER C
+ 0x0064: 0x0064, # LATIN SMALL LETTER D
+ 0x0065: 0x0065, # LATIN SMALL LETTER E
+ 0x0066: 0x0066, # LATIN SMALL LETTER F
+ 0x0067: 0x0067, # LATIN SMALL LETTER G
+ 0x0068: 0x0068, # LATIN SMALL LETTER H
+ 0x0069: 0x0069, # LATIN SMALL LETTER I
+ 0x006a: 0x006a, # LATIN SMALL LETTER J
+ 0x006b: 0x006b, # LATIN SMALL LETTER K
+ 0x006c: 0x006c, # LATIN SMALL LETTER L
+ 0x006d: 0x006d, # LATIN SMALL LETTER M
+ 0x006e: 0x006e, # LATIN SMALL LETTER N
+ 0x006f: 0x006f, # LATIN SMALL LETTER O
+ 0x0070: 0x0070, # LATIN SMALL LETTER P
+ 0x0071: 0x0071, # LATIN SMALL LETTER Q
+ 0x0072: 0x0072, # LATIN SMALL LETTER R
+ 0x0073: 0x0073, # LATIN SMALL LETTER S
+ 0x0074: 0x0074, # LATIN SMALL LETTER T
+ 0x0075: 0x0075, # LATIN SMALL LETTER U
+ 0x0076: 0x0076, # LATIN SMALL LETTER V
+ 0x0077: 0x0077, # LATIN SMALL LETTER W
+ 0x0078: 0x0078, # LATIN SMALL LETTER X
+ 0x0079: 0x0079, # LATIN SMALL LETTER Y
+ 0x007a: 0x007a, # LATIN SMALL LETTER Z
+ 0x007b: 0x007b, # LEFT CURLY BRACKET
+ 0x007c: 0x007c, # VERTICAL LINE
+ 0x007d: 0x007d, # RIGHT CURLY BRACKET
+ 0x007e: 0x007e, # TILDE
+ 0x007f: 0x007f, # DELETE
+ 0x00a0: 0x00ff, # NO-BREAK SPACE
+ 0x00a1: 0x00ad, # INVERTED EXCLAMATION MARK
+ 0x00a3: 0x009c, # POUND SIGN
+ 0x00a4: 0x00af, # CURRENCY SIGN
+ 0x00aa: 0x00a6, # FEMININE ORDINAL INDICATOR
+ 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00ac: 0x00aa, # NOT SIGN
+ 0x00b0: 0x00f8, # DEGREE SIGN
+ 0x00b1: 0x00f1, # PLUS-MINUS SIGN
+ 0x00b2: 0x00fd, # SUPERSCRIPT TWO
+ 0x00b5: 0x00e6, # MICRO SIGN
+ 0x00b7: 0x00fa, # MIDDLE DOT
+ 0x00ba: 0x00a7, # MASCULINE ORDINAL INDICATOR
+ 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER
+ 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF
+ 0x00bf: 0x00a8, # INVERTED QUESTION MARK
+ 0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x00c5: 0x008f, # LATIN CAPITAL LETTER A WITH RING ABOVE
+ 0x00c6: 0x0092, # LATIN CAPITAL LIGATURE AE
+ 0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x00d1: 0x00a5, # LATIN CAPITAL LETTER N WITH TILDE
+ 0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x00d8: 0x009d, # LATIN CAPITAL LETTER O WITH STROKE
+ 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S
+ 0x00e0: 0x0085, # LATIN SMALL LETTER A WITH GRAVE
+ 0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x00e5: 0x0086, # LATIN SMALL LETTER A WITH RING ABOVE
+ 0x00e6: 0x0091, # LATIN SMALL LIGATURE AE
+ 0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x00e8: 0x008a, # LATIN SMALL LETTER E WITH GRAVE
+ 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE
+ 0x00ea: 0x0088, # LATIN SMALL LETTER E WITH CIRCUMFLEX
+ 0x00eb: 0x0089, # LATIN SMALL LETTER E WITH DIAERESIS
+ 0x00ec: 0x008d, # LATIN SMALL LETTER I WITH GRAVE
+ 0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00ee: 0x008c, # LATIN SMALL LETTER I WITH CIRCUMFLEX
+ 0x00ef: 0x008b, # LATIN SMALL LETTER I WITH DIAERESIS
+ 0x00f1: 0x00a4, # LATIN SMALL LETTER N WITH TILDE
+ 0x00f2: 0x0095, # LATIN SMALL LETTER O WITH GRAVE
+ 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x00f7: 0x00f6, # DIVISION SIGN
+ 0x00f8: 0x009b, # LATIN SMALL LETTER O WITH STROKE
+ 0x00f9: 0x0097, # LATIN SMALL LETTER U WITH GRAVE
+ 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00fb: 0x0096, # LATIN SMALL LETTER U WITH CIRCUMFLEX
+ 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x00ff: 0x0098, # LATIN SMALL LETTER Y WITH DIAERESIS
+ 0x0192: 0x009f, # LATIN SMALL LETTER F WITH HOOK
+ 0x0393: 0x00e2, # GREEK CAPITAL LETTER GAMMA
+ 0x0398: 0x00e9, # GREEK CAPITAL LETTER THETA
+ 0x03a3: 0x00e4, # GREEK CAPITAL LETTER SIGMA
+ 0x03a6: 0x00e8, # GREEK CAPITAL LETTER PHI
+ 0x03a9: 0x00ea, # GREEK CAPITAL LETTER OMEGA
+ 0x03b1: 0x00e0, # GREEK SMALL LETTER ALPHA
+ 0x03b4: 0x00eb, # GREEK SMALL LETTER DELTA
+ 0x03b5: 0x00ee, # GREEK SMALL LETTER EPSILON
+ 0x03c0: 0x00e3, # GREEK SMALL LETTER PI
+ 0x03c3: 0x00e5, # GREEK SMALL LETTER SIGMA
+ 0x03c4: 0x00e7, # GREEK SMALL LETTER TAU
+ 0x03c6: 0x00ed, # GREEK SMALL LETTER PHI
+ 0x207f: 0x00fc, # SUPERSCRIPT LATIN SMALL LETTER N
+ 0x20a7: 0x009e, # PESETA SIGN
+ 0x2219: 0x00f9, # BULLET OPERATOR
+ 0x221a: 0x00fb, # SQUARE ROOT
+ 0x221e: 0x00ec, # INFINITY
+ 0x2229: 0x00ef, # INTERSECTION
+ 0x2248: 0x00f7, # ALMOST EQUAL TO
+ 0x2261: 0x00f0, # IDENTICAL TO
+ 0x2264: 0x00f3, # LESS-THAN OR EQUAL TO
+ 0x2265: 0x00f2, # GREATER-THAN OR EQUAL TO
+ 0x2310: 0x00a9, # REVERSED NOT SIGN
+ 0x2320: 0x00f4, # TOP HALF INTEGRAL
+ 0x2321: 0x00f5, # BOTTOM HALF INTEGRAL
+ 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL
+ 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x2552: 0x00d5, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ 0x2553: 0x00d6, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x2555: 0x00b8, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ 0x2556: 0x00b7, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x2558: 0x00d4, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ 0x2559: 0x00d3, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x255b: 0x00be, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ 0x255c: 0x00bd, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x255e: 0x00c6, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ 0x255f: 0x00c7, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x2561: 0x00b5, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ 0x2562: 0x00b6, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x2564: 0x00d1, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ 0x2565: 0x00d2, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x2567: 0x00cf, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ 0x2568: 0x00d0, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x256a: 0x00d8, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ 0x256b: 0x00d7, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x2580: 0x00df, # UPPER HALF BLOCK
+ 0x2584: 0x00dc, # LOWER HALF BLOCK
+ 0x2588: 0x00db, # FULL BLOCK
+ 0x258c: 0x00dd, # LEFT HALF BLOCK
+ 0x2590: 0x00de, # RIGHT HALF BLOCK
+ 0x2591: 0x00b0, # LIGHT SHADE
+ 0x2592: 0x00b1, # MEDIUM SHADE
+ 0x2593: 0x00b2, # DARK SHADE
+ 0x25a0: 0x00fe, # BLACK SQUARE
+}
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
index 0000000000..70e5139838
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp866.py
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP866.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp866',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0080: 0x0410, # CYRILLIC CAPITAL LETTER A
+ 0x0081: 0x0411, # CYRILLIC CAPITAL LETTER BE
+ 0x0082: 0x0412, # CYRILLIC CAPITAL LETTER VE
+ 0x0083: 0x0413, # CYRILLIC CAPITAL LETTER GHE
+ 0x0084: 0x0414, # CYRILLIC CAPITAL LETTER DE
+ 0x0085: 0x0415, # CYRILLIC CAPITAL LETTER IE
+ 0x0086: 0x0416, # CYRILLIC CAPITAL LETTER ZHE
+ 0x0087: 0x0417, # CYRILLIC CAPITAL LETTER ZE
+ 0x0088: 0x0418, # CYRILLIC CAPITAL LETTER I
+ 0x0089: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I
+ 0x008a: 0x041a, # CYRILLIC CAPITAL LETTER KA
+ 0x008b: 0x041b, # CYRILLIC CAPITAL LETTER EL
+ 0x008c: 0x041c, # CYRILLIC CAPITAL LETTER EM
+ 0x008d: 0x041d, # CYRILLIC CAPITAL LETTER EN
+ 0x008e: 0x041e, # CYRILLIC CAPITAL LETTER O
+ 0x008f: 0x041f, # CYRILLIC CAPITAL LETTER PE
+ 0x0090: 0x0420, # CYRILLIC CAPITAL LETTER ER
+ 0x0091: 0x0421, # CYRILLIC CAPITAL LETTER ES
+ 0x0092: 0x0422, # CYRILLIC CAPITAL LETTER TE
+ 0x0093: 0x0423, # CYRILLIC CAPITAL LETTER U
+ 0x0094: 0x0424, # CYRILLIC CAPITAL LETTER EF
+ 0x0095: 0x0425, # CYRILLIC CAPITAL LETTER HA
+ 0x0096: 0x0426, # CYRILLIC CAPITAL LETTER TSE
+ 0x0097: 0x0427, # CYRILLIC CAPITAL LETTER CHE
+ 0x0098: 0x0428, # CYRILLIC CAPITAL LETTER SHA
+ 0x0099: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA
+ 0x009a: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN
+ 0x009b: 0x042b, # CYRILLIC CAPITAL LETTER YERU
+ 0x009c: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN
+ 0x009d: 0x042d, # CYRILLIC CAPITAL LETTER E
+ 0x009e: 0x042e, # CYRILLIC CAPITAL LETTER YU
+ 0x009f: 0x042f, # CYRILLIC CAPITAL LETTER YA
+ 0x00a0: 0x0430, # CYRILLIC SMALL LETTER A
+ 0x00a1: 0x0431, # CYRILLIC SMALL LETTER BE
+ 0x00a2: 0x0432, # CYRILLIC SMALL LETTER VE
+ 0x00a3: 0x0433, # CYRILLIC SMALL LETTER GHE
+ 0x00a4: 0x0434, # CYRILLIC SMALL LETTER DE
+ 0x00a5: 0x0435, # CYRILLIC SMALL LETTER IE
+ 0x00a6: 0x0436, # CYRILLIC SMALL LETTER ZHE
+ 0x00a7: 0x0437, # CYRILLIC SMALL LETTER ZE
+ 0x00a8: 0x0438, # CYRILLIC SMALL LETTER I
+ 0x00a9: 0x0439, # CYRILLIC SMALL LETTER SHORT I
+ 0x00aa: 0x043a, # CYRILLIC SMALL LETTER KA
+ 0x00ab: 0x043b, # CYRILLIC SMALL LETTER EL
+ 0x00ac: 0x043c, # CYRILLIC SMALL LETTER EM
+ 0x00ad: 0x043d, # CYRILLIC SMALL LETTER EN
+ 0x00ae: 0x043e, # CYRILLIC SMALL LETTER O
+ 0x00af: 0x043f, # CYRILLIC SMALL LETTER PE
+ 0x00b0: 0x2591, # LIGHT SHADE
+ 0x00b1: 0x2592, # MEDIUM SHADE
+ 0x00b2: 0x2593, # DARK SHADE
+ 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL
+ 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x00db: 0x2588, # FULL BLOCK
+ 0x00dc: 0x2584, # LOWER HALF BLOCK
+ 0x00dd: 0x258c, # LEFT HALF BLOCK
+ 0x00de: 0x2590, # RIGHT HALF BLOCK
+ 0x00df: 0x2580, # UPPER HALF BLOCK
+ 0x00e0: 0x0440, # CYRILLIC SMALL LETTER ER
+ 0x00e1: 0x0441, # CYRILLIC SMALL LETTER ES
+ 0x00e2: 0x0442, # CYRILLIC SMALL LETTER TE
+ 0x00e3: 0x0443, # CYRILLIC SMALL LETTER U
+ 0x00e4: 0x0444, # CYRILLIC SMALL LETTER EF
+ 0x00e5: 0x0445, # CYRILLIC SMALL LETTER HA
+ 0x00e6: 0x0446, # CYRILLIC SMALL LETTER TSE
+ 0x00e7: 0x0447, # CYRILLIC SMALL LETTER CHE
+ 0x00e8: 0x0448, # CYRILLIC SMALL LETTER SHA
+ 0x00e9: 0x0449, # CYRILLIC SMALL LETTER SHCHA
+ 0x00ea: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN
+ 0x00eb: 0x044b, # CYRILLIC SMALL LETTER YERU
+ 0x00ec: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN
+ 0x00ed: 0x044d, # CYRILLIC SMALL LETTER E
+ 0x00ee: 0x044e, # CYRILLIC SMALL LETTER YU
+ 0x00ef: 0x044f, # CYRILLIC SMALL LETTER YA
+ 0x00f0: 0x0401, # CYRILLIC CAPITAL LETTER IO
+ 0x00f1: 0x0451, # CYRILLIC SMALL LETTER IO
+ 0x00f2: 0x0404, # CYRILLIC CAPITAL LETTER UKRAINIAN IE
+ 0x00f3: 0x0454, # CYRILLIC SMALL LETTER UKRAINIAN IE
+ 0x00f4: 0x0407, # CYRILLIC CAPITAL LETTER YI
+ 0x00f5: 0x0457, # CYRILLIC SMALL LETTER YI
+ 0x00f6: 0x040e, # CYRILLIC CAPITAL LETTER SHORT U
+ 0x00f7: 0x045e, # CYRILLIC SMALL LETTER SHORT U
+ 0x00f8: 0x00b0, # DEGREE SIGN
+ 0x00f9: 0x2219, # BULLET OPERATOR
+ 0x00fa: 0x00b7, # MIDDLE DOT
+ 0x00fb: 0x221a, # SQUARE ROOT
+ 0x00fc: 0x2116, # NUMERO SIGN
+ 0x00fd: 0x00a4, # CURRENCY SIGN
+ 0x00fe: 0x25a0, # BLACK SQUARE
+ 0x00ff: 0x00a0, # NO-BREAK SPACE
+})
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x0000 -> NULL
+ u'\x01' # 0x0001 -> START OF HEADING
+ u'\x02' # 0x0002 -> START OF TEXT
+ u'\x03' # 0x0003 -> END OF TEXT
+ u'\x04' # 0x0004 -> END OF TRANSMISSION
+ u'\x05' # 0x0005 -> ENQUIRY
+ u'\x06' # 0x0006 -> ACKNOWLEDGE
+ u'\x07' # 0x0007 -> BELL
+ u'\x08' # 0x0008 -> BACKSPACE
+ u'\t' # 0x0009 -> HORIZONTAL TABULATION
+ u'\n' # 0x000a -> LINE FEED
+ u'\x0b' # 0x000b -> VERTICAL TABULATION
+ u'\x0c' # 0x000c -> FORM FEED
+ u'\r' # 0x000d -> CARRIAGE RETURN
+ u'\x0e' # 0x000e -> SHIFT OUT
+ u'\x0f' # 0x000f -> SHIFT IN
+ u'\x10' # 0x0010 -> DATA LINK ESCAPE
+ u'\x11' # 0x0011 -> DEVICE CONTROL ONE
+ u'\x12' # 0x0012 -> DEVICE CONTROL TWO
+ u'\x13' # 0x0013 -> DEVICE CONTROL THREE
+ u'\x14' # 0x0014 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x0016 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x0018 -> CANCEL
+ u'\x19' # 0x0019 -> END OF MEDIUM
+ u'\x1a' # 0x001a -> SUBSTITUTE
+ u'\x1b' # 0x001b -> ESCAPE
+ u'\x1c' # 0x001c -> FILE SEPARATOR
+ u'\x1d' # 0x001d -> GROUP SEPARATOR
+ u'\x1e' # 0x001e -> RECORD SEPARATOR
+ u'\x1f' # 0x001f -> UNIT SEPARATOR
+ u' ' # 0x0020 -> SPACE
+ u'!' # 0x0021 -> EXCLAMATION MARK
+ u'"' # 0x0022 -> QUOTATION MARK
+ u'#' # 0x0023 -> NUMBER SIGN
+ u'$' # 0x0024 -> DOLLAR SIGN
+ u'%' # 0x0025 -> PERCENT SIGN
+ u'&' # 0x0026 -> AMPERSAND
+ u"'" # 0x0027 -> APOSTROPHE
+ u'(' # 0x0028 -> LEFT PARENTHESIS
+ u')' # 0x0029 -> RIGHT PARENTHESIS
+ u'*' # 0x002a -> ASTERISK
+ u'+' # 0x002b -> PLUS SIGN
+ u',' # 0x002c -> COMMA
+ u'-' # 0x002d -> HYPHEN-MINUS
+ u'.' # 0x002e -> FULL STOP
+ u'/' # 0x002f -> SOLIDUS
+ u'0' # 0x0030 -> DIGIT ZERO
+ u'1' # 0x0031 -> DIGIT ONE
+ u'2' # 0x0032 -> DIGIT TWO
+ u'3' # 0x0033 -> DIGIT THREE
+ u'4' # 0x0034 -> DIGIT FOUR
+ u'5' # 0x0035 -> DIGIT FIVE
+ u'6' # 0x0036 -> DIGIT SIX
+ u'7' # 0x0037 -> DIGIT SEVEN
+ u'8' # 0x0038 -> DIGIT EIGHT
+ u'9' # 0x0039 -> DIGIT NINE
+ u':' # 0x003a -> COLON
+ u';' # 0x003b -> SEMICOLON
+ u'<' # 0x003c -> LESS-THAN SIGN
+ u'=' # 0x003d -> EQUALS SIGN
+ u'>' # 0x003e -> GREATER-THAN SIGN
+ u'?' # 0x003f -> QUESTION MARK
+ u'@' # 0x0040 -> COMMERCIAL AT
+ u'A' # 0x0041 -> LATIN CAPITAL LETTER A
+ u'B' # 0x0042 -> LATIN CAPITAL LETTER B
+ u'C' # 0x0043 -> LATIN CAPITAL LETTER C
+ u'D' # 0x0044 -> LATIN CAPITAL LETTER D
+ u'E' # 0x0045 -> LATIN CAPITAL LETTER E
+ u'F' # 0x0046 -> LATIN CAPITAL LETTER F
+ u'G' # 0x0047 -> LATIN CAPITAL LETTER G
+ u'H' # 0x0048 -> LATIN CAPITAL LETTER H
+ u'I' # 0x0049 -> LATIN CAPITAL LETTER I
+ u'J' # 0x004a -> LATIN CAPITAL LETTER J
+ u'K' # 0x004b -> LATIN CAPITAL LETTER K
+ u'L' # 0x004c -> LATIN CAPITAL LETTER L
+ u'M' # 0x004d -> LATIN CAPITAL LETTER M
+ u'N' # 0x004e -> LATIN CAPITAL LETTER N
+ u'O' # 0x004f -> LATIN CAPITAL LETTER O
+ u'P' # 0x0050 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x0052 -> LATIN CAPITAL LETTER R
+ u'S' # 0x0053 -> LATIN CAPITAL LETTER S
+ u'T' # 0x0054 -> LATIN CAPITAL LETTER T
+ u'U' # 0x0055 -> LATIN CAPITAL LETTER U
+ u'V' # 0x0056 -> LATIN CAPITAL LETTER V
+ u'W' # 0x0057 -> LATIN CAPITAL LETTER W
+ u'X' # 0x0058 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x005a -> LATIN CAPITAL LETTER Z
+ u'[' # 0x005b -> LEFT SQUARE BRACKET
+ u'\\' # 0x005c -> REVERSE SOLIDUS
+ u']' # 0x005d -> RIGHT SQUARE BRACKET
+ u'^' # 0x005e -> CIRCUMFLEX ACCENT
+ u'_' # 0x005f -> LOW LINE
+ u'`' # 0x0060 -> GRAVE ACCENT
+ u'a' # 0x0061 -> LATIN SMALL LETTER A
+ u'b' # 0x0062 -> LATIN SMALL LETTER B
+ u'c' # 0x0063 -> LATIN SMALL LETTER C
+ u'd' # 0x0064 -> LATIN SMALL LETTER D
+ u'e' # 0x0065 -> LATIN SMALL LETTER E
+ u'f' # 0x0066 -> LATIN SMALL LETTER F
+ u'g' # 0x0067 -> LATIN SMALL LETTER G
+ u'h' # 0x0068 -> LATIN SMALL LETTER H
+ u'i' # 0x0069 -> LATIN SMALL LETTER I
+ u'j' # 0x006a -> LATIN SMALL LETTER J
+ u'k' # 0x006b -> LATIN SMALL LETTER K
+ u'l' # 0x006c -> LATIN SMALL LETTER L
+ u'm' # 0x006d -> LATIN SMALL LETTER M
+ u'n' # 0x006e -> LATIN SMALL LETTER N
+ u'o' # 0x006f -> LATIN SMALL LETTER O
+ u'p' # 0x0070 -> LATIN SMALL LETTER P
+ u'q' # 0x0071 -> LATIN SMALL LETTER Q
+ u'r' # 0x0072 -> LATIN SMALL LETTER R
+ u's' # 0x0073 -> LATIN SMALL LETTER S
+ u't' # 0x0074 -> LATIN SMALL LETTER T
+ u'u' # 0x0075 -> LATIN SMALL LETTER U
+ u'v' # 0x0076 -> LATIN SMALL LETTER V
+ u'w' # 0x0077 -> LATIN SMALL LETTER W
+ u'x' # 0x0078 -> LATIN SMALL LETTER X
+ u'y' # 0x0079 -> LATIN SMALL LETTER Y
+ u'z' # 0x007a -> LATIN SMALL LETTER Z
+ u'{' # 0x007b -> LEFT CURLY BRACKET
+ u'|' # 0x007c -> VERTICAL LINE
+ u'}' # 0x007d -> RIGHT CURLY BRACKET
+ u'~' # 0x007e -> TILDE
+ u'\x7f' # 0x007f -> DELETE
+ u'\u0410' # 0x0080 -> CYRILLIC CAPITAL LETTER A
+ u'\u0411' # 0x0081 -> CYRILLIC CAPITAL LETTER BE
+ u'\u0412' # 0x0082 -> CYRILLIC CAPITAL LETTER VE
+ u'\u0413' # 0x0083 -> CYRILLIC CAPITAL LETTER GHE
+ u'\u0414' # 0x0084 -> CYRILLIC CAPITAL LETTER DE
+ u'\u0415' # 0x0085 -> CYRILLIC CAPITAL LETTER IE
+ u'\u0416' # 0x0086 -> CYRILLIC CAPITAL LETTER ZHE
+ u'\u0417' # 0x0087 -> CYRILLIC CAPITAL LETTER ZE
+ u'\u0418' # 0x0088 -> CYRILLIC CAPITAL LETTER I
+ u'\u0419' # 0x0089 -> CYRILLIC CAPITAL LETTER SHORT I
+ u'\u041a' # 0x008a -> CYRILLIC CAPITAL LETTER KA
+ u'\u041b' # 0x008b -> CYRILLIC CAPITAL LETTER EL
+ u'\u041c' # 0x008c -> CYRILLIC CAPITAL LETTER EM
+ u'\u041d' # 0x008d -> CYRILLIC CAPITAL LETTER EN
+ u'\u041e' # 0x008e -> CYRILLIC CAPITAL LETTER O
+ u'\u041f' # 0x008f -> CYRILLIC CAPITAL LETTER PE
+ u'\u0420' # 0x0090 -> CYRILLIC CAPITAL LETTER ER
+ u'\u0421' # 0x0091 -> CYRILLIC CAPITAL LETTER ES
+ u'\u0422' # 0x0092 -> CYRILLIC CAPITAL LETTER TE
+ u'\u0423' # 0x0093 -> CYRILLIC CAPITAL LETTER U
+ u'\u0424' # 0x0094 -> CYRILLIC CAPITAL LETTER EF
+ u'\u0425' # 0x0095 -> CYRILLIC CAPITAL LETTER HA
+ u'\u0426' # 0x0096 -> CYRILLIC CAPITAL LETTER TSE
+ u'\u0427' # 0x0097 -> CYRILLIC CAPITAL LETTER CHE
+ u'\u0428' # 0x0098 -> CYRILLIC CAPITAL LETTER SHA
+ u'\u0429' # 0x0099 -> CYRILLIC CAPITAL LETTER SHCHA
+ u'\u042a' # 0x009a -> CYRILLIC CAPITAL LETTER HARD SIGN
+ u'\u042b' # 0x009b -> CYRILLIC CAPITAL LETTER YERU
+ u'\u042c' # 0x009c -> CYRILLIC CAPITAL LETTER SOFT SIGN
+ u'\u042d' # 0x009d -> CYRILLIC CAPITAL LETTER E
+ u'\u042e' # 0x009e -> CYRILLIC CAPITAL LETTER YU
+ u'\u042f' # 0x009f -> CYRILLIC CAPITAL LETTER YA
+ u'\u0430' # 0x00a0 -> CYRILLIC SMALL LETTER A
+ u'\u0431' # 0x00a1 -> CYRILLIC SMALL LETTER BE
+ u'\u0432' # 0x00a2 -> CYRILLIC SMALL LETTER VE
+ u'\u0433' # 0x00a3 -> CYRILLIC SMALL LETTER GHE
+ u'\u0434' # 0x00a4 -> CYRILLIC SMALL LETTER DE
+ u'\u0435' # 0x00a5 -> CYRILLIC SMALL LETTER IE
+ u'\u0436' # 0x00a6 -> CYRILLIC SMALL LETTER ZHE
+ u'\u0437' # 0x00a7 -> CYRILLIC SMALL LETTER ZE
+ u'\u0438' # 0x00a8 -> CYRILLIC SMALL LETTER I
+ u'\u0439' # 0x00a9 -> CYRILLIC SMALL LETTER SHORT I
+ u'\u043a' # 0x00aa -> CYRILLIC SMALL LETTER KA
+ u'\u043b' # 0x00ab -> CYRILLIC SMALL LETTER EL
+ u'\u043c' # 0x00ac -> CYRILLIC SMALL LETTER EM
+ u'\u043d' # 0x00ad -> CYRILLIC SMALL LETTER EN
+ u'\u043e' # 0x00ae -> CYRILLIC SMALL LETTER O
+ u'\u043f' # 0x00af -> CYRILLIC SMALL LETTER PE
+ u'\u2591' # 0x00b0 -> LIGHT SHADE
+ u'\u2592' # 0x00b1 -> MEDIUM SHADE
+ u'\u2593' # 0x00b2 -> DARK SHADE
+ u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL
+ u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL
+ u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT
+ u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT
+ u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT
+ u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT
+ u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL
+ u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
+ u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL
+ u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT
+ u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT
+ u'\u2588' # 0x00db -> FULL BLOCK
+ u'\u2584' # 0x00dc -> LOWER HALF BLOCK
+ u'\u258c' # 0x00dd -> LEFT HALF BLOCK
+ u'\u2590' # 0x00de -> RIGHT HALF BLOCK
+ u'\u2580' # 0x00df -> UPPER HALF BLOCK
+ u'\u0440' # 0x00e0 -> CYRILLIC SMALL LETTER ER
+ u'\u0441' # 0x00e1 -> CYRILLIC SMALL LETTER ES
+ u'\u0442' # 0x00e2 -> CYRILLIC SMALL LETTER TE
+ u'\u0443' # 0x00e3 -> CYRILLIC SMALL LETTER U
+ u'\u0444' # 0x00e4 -> CYRILLIC SMALL LETTER EF
+ u'\u0445' # 0x00e5 -> CYRILLIC SMALL LETTER HA
+ u'\u0446' # 0x00e6 -> CYRILLIC SMALL LETTER TSE
+ u'\u0447' # 0x00e7 -> CYRILLIC SMALL LETTER CHE
+ u'\u0448' # 0x00e8 -> CYRILLIC SMALL LETTER SHA
+ u'\u0449' # 0x00e9 -> CYRILLIC SMALL LETTER SHCHA
+ u'\u044a' # 0x00ea -> CYRILLIC SMALL LETTER HARD SIGN
+ u'\u044b' # 0x00eb -> CYRILLIC SMALL LETTER YERU
+ u'\u044c' # 0x00ec -> CYRILLIC SMALL LETTER SOFT SIGN
+ u'\u044d' # 0x00ed -> CYRILLIC SMALL LETTER E
+ u'\u044e' # 0x00ee -> CYRILLIC SMALL LETTER YU
+ u'\u044f' # 0x00ef -> CYRILLIC SMALL LETTER YA
+ u'\u0401' # 0x00f0 -> CYRILLIC CAPITAL LETTER IO
+ u'\u0451' # 0x00f1 -> CYRILLIC SMALL LETTER IO
+ u'\u0404' # 0x00f2 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE
+ u'\u0454' # 0x00f3 -> CYRILLIC SMALL LETTER UKRAINIAN IE
+ u'\u0407' # 0x00f4 -> CYRILLIC CAPITAL LETTER YI
+ u'\u0457' # 0x00f5 -> CYRILLIC SMALL LETTER YI
+ u'\u040e' # 0x00f6 -> CYRILLIC CAPITAL LETTER SHORT U
+ u'\u045e' # 0x00f7 -> CYRILLIC SMALL LETTER SHORT U
+ u'\xb0' # 0x00f8 -> DEGREE SIGN
+ u'\u2219' # 0x00f9 -> BULLET OPERATOR
+ u'\xb7' # 0x00fa -> MIDDLE DOT
+ u'\u221a' # 0x00fb -> SQUARE ROOT
+ u'\u2116' # 0x00fc -> NUMERO SIGN
+ u'\xa4' # 0x00fd -> CURRENCY SIGN
+ u'\u25a0' # 0x00fe -> BLACK SQUARE
+ u'\xa0' # 0x00ff -> NO-BREAK SPACE
+)
+
+### Encoding Map
+
+encoding_map = {
+ 0x0000: 0x0000, # NULL
+ 0x0001: 0x0001, # START OF HEADING
+ 0x0002: 0x0002, # START OF TEXT
+ 0x0003: 0x0003, # END OF TEXT
+ 0x0004: 0x0004, # END OF TRANSMISSION
+ 0x0005: 0x0005, # ENQUIRY
+ 0x0006: 0x0006, # ACKNOWLEDGE
+ 0x0007: 0x0007, # BELL
+ 0x0008: 0x0008, # BACKSPACE
+ 0x0009: 0x0009, # HORIZONTAL TABULATION
+ 0x000a: 0x000a, # LINE FEED
+ 0x000b: 0x000b, # VERTICAL TABULATION
+ 0x000c: 0x000c, # FORM FEED
+ 0x000d: 0x000d, # CARRIAGE RETURN
+ 0x000e: 0x000e, # SHIFT OUT
+ 0x000f: 0x000f, # SHIFT IN
+ 0x0010: 0x0010, # DATA LINK ESCAPE
+ 0x0011: 0x0011, # DEVICE CONTROL ONE
+ 0x0012: 0x0012, # DEVICE CONTROL TWO
+ 0x0013: 0x0013, # DEVICE CONTROL THREE
+ 0x0014: 0x0014, # DEVICE CONTROL FOUR
+ 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE
+ 0x0016: 0x0016, # SYNCHRONOUS IDLE
+ 0x0017: 0x0017, # END OF TRANSMISSION BLOCK
+ 0x0018: 0x0018, # CANCEL
+ 0x0019: 0x0019, # END OF MEDIUM
+ 0x001a: 0x001a, # SUBSTITUTE
+ 0x001b: 0x001b, # ESCAPE
+ 0x001c: 0x001c, # FILE SEPARATOR
+ 0x001d: 0x001d, # GROUP SEPARATOR
+ 0x001e: 0x001e, # RECORD SEPARATOR
+ 0x001f: 0x001f, # UNIT SEPARATOR
+ 0x0020: 0x0020, # SPACE
+ 0x0021: 0x0021, # EXCLAMATION MARK
+ 0x0022: 0x0022, # QUOTATION MARK
+ 0x0023: 0x0023, # NUMBER SIGN
+ 0x0024: 0x0024, # DOLLAR SIGN
+ 0x0025: 0x0025, # PERCENT SIGN
+ 0x0026: 0x0026, # AMPERSAND
+ 0x0027: 0x0027, # APOSTROPHE
+ 0x0028: 0x0028, # LEFT PARENTHESIS
+ 0x0029: 0x0029, # RIGHT PARENTHESIS
+ 0x002a: 0x002a, # ASTERISK
+ 0x002b: 0x002b, # PLUS SIGN
+ 0x002c: 0x002c, # COMMA
+ 0x002d: 0x002d, # HYPHEN-MINUS
+ 0x002e: 0x002e, # FULL STOP
+ 0x002f: 0x002f, # SOLIDUS
+ 0x0030: 0x0030, # DIGIT ZERO
+ 0x0031: 0x0031, # DIGIT ONE
+ 0x0032: 0x0032, # DIGIT TWO
+ 0x0033: 0x0033, # DIGIT THREE
+ 0x0034: 0x0034, # DIGIT FOUR
+ 0x0035: 0x0035, # DIGIT FIVE
+ 0x0036: 0x0036, # DIGIT SIX
+ 0x0037: 0x0037, # DIGIT SEVEN
+ 0x0038: 0x0038, # DIGIT EIGHT
+ 0x0039: 0x0039, # DIGIT NINE
+ 0x003a: 0x003a, # COLON
+ 0x003b: 0x003b, # SEMICOLON
+ 0x003c: 0x003c, # LESS-THAN SIGN
+ 0x003d: 0x003d, # EQUALS SIGN
+ 0x003e: 0x003e, # GREATER-THAN SIGN
+ 0x003f: 0x003f, # QUESTION MARK
+ 0x0040: 0x0040, # COMMERCIAL AT
+ 0x0041: 0x0041, # LATIN CAPITAL LETTER A
+ 0x0042: 0x0042, # LATIN CAPITAL LETTER B
+ 0x0043: 0x0043, # LATIN CAPITAL LETTER C
+ 0x0044: 0x0044, # LATIN CAPITAL LETTER D
+ 0x0045: 0x0045, # LATIN CAPITAL LETTER E
+ 0x0046: 0x0046, # LATIN CAPITAL LETTER F
+ 0x0047: 0x0047, # LATIN CAPITAL LETTER G
+ 0x0048: 0x0048, # LATIN CAPITAL LETTER H
+ 0x0049: 0x0049, # LATIN CAPITAL LETTER I
+ 0x004a: 0x004a, # LATIN CAPITAL LETTER J
+ 0x004b: 0x004b, # LATIN CAPITAL LETTER K
+ 0x004c: 0x004c, # LATIN CAPITAL LETTER L
+ 0x004d: 0x004d, # LATIN CAPITAL LETTER M
+ 0x004e: 0x004e, # LATIN CAPITAL LETTER N
+ 0x004f: 0x004f, # LATIN CAPITAL LETTER O
+ 0x0050: 0x0050, # LATIN CAPITAL LETTER P
+ 0x0051: 0x0051, # LATIN CAPITAL LETTER Q
+ 0x0052: 0x0052, # LATIN CAPITAL LETTER R
+ 0x0053: 0x0053, # LATIN CAPITAL LETTER S
+ 0x0054: 0x0054, # LATIN CAPITAL LETTER T
+ 0x0055: 0x0055, # LATIN CAPITAL LETTER U
+ 0x0056: 0x0056, # LATIN CAPITAL LETTER V
+ 0x0057: 0x0057, # LATIN CAPITAL LETTER W
+ 0x0058: 0x0058, # LATIN CAPITAL LETTER X
+ 0x0059: 0x0059, # LATIN CAPITAL LETTER Y
+ 0x005a: 0x005a, # LATIN CAPITAL LETTER Z
+ 0x005b: 0x005b, # LEFT SQUARE BRACKET
+ 0x005c: 0x005c, # REVERSE SOLIDUS
+ 0x005d: 0x005d, # RIGHT SQUARE BRACKET
+ 0x005e: 0x005e, # CIRCUMFLEX ACCENT
+ 0x005f: 0x005f, # LOW LINE
+ 0x0060: 0x0060, # GRAVE ACCENT
+ 0x0061: 0x0061, # LATIN SMALL LETTER A
+ 0x0062: 0x0062, # LATIN SMALL LETTER B
+ 0x0063: 0x0063, # LATIN SMALL LETTER C
+ 0x0064: 0x0064, # LATIN SMALL LETTER D
+ 0x0065: 0x0065, # LATIN SMALL LETTER E
+ 0x0066: 0x0066, # LATIN SMALL LETTER F
+ 0x0067: 0x0067, # LATIN SMALL LETTER G
+ 0x0068: 0x0068, # LATIN SMALL LETTER H
+ 0x0069: 0x0069, # LATIN SMALL LETTER I
+ 0x006a: 0x006a, # LATIN SMALL LETTER J
+ 0x006b: 0x006b, # LATIN SMALL LETTER K
+ 0x006c: 0x006c, # LATIN SMALL LETTER L
+ 0x006d: 0x006d, # LATIN SMALL LETTER M
+ 0x006e: 0x006e, # LATIN SMALL LETTER N
+ 0x006f: 0x006f, # LATIN SMALL LETTER O
+ 0x0070: 0x0070, # LATIN SMALL LETTER P
+ 0x0071: 0x0071, # LATIN SMALL LETTER Q
+ 0x0072: 0x0072, # LATIN SMALL LETTER R
+ 0x0073: 0x0073, # LATIN SMALL LETTER S
+ 0x0074: 0x0074, # LATIN SMALL LETTER T
+ 0x0075: 0x0075, # LATIN SMALL LETTER U
+ 0x0076: 0x0076, # LATIN SMALL LETTER V
+ 0x0077: 0x0077, # LATIN SMALL LETTER W
+ 0x0078: 0x0078, # LATIN SMALL LETTER X
+ 0x0079: 0x0079, # LATIN SMALL LETTER Y
+ 0x007a: 0x007a, # LATIN SMALL LETTER Z
+ 0x007b: 0x007b, # LEFT CURLY BRACKET
+ 0x007c: 0x007c, # VERTICAL LINE
+ 0x007d: 0x007d, # RIGHT CURLY BRACKET
+ 0x007e: 0x007e, # TILDE
+ 0x007f: 0x007f, # DELETE
+ 0x00a0: 0x00ff, # NO-BREAK SPACE
+ 0x00a4: 0x00fd, # CURRENCY SIGN
+ 0x00b0: 0x00f8, # DEGREE SIGN
+ 0x00b7: 0x00fa, # MIDDLE DOT
+ 0x0401: 0x00f0, # CYRILLIC CAPITAL LETTER IO
+ 0x0404: 0x00f2, # CYRILLIC CAPITAL LETTER UKRAINIAN IE
+ 0x0407: 0x00f4, # CYRILLIC CAPITAL LETTER YI
+ 0x040e: 0x00f6, # CYRILLIC CAPITAL LETTER SHORT U
+ 0x0410: 0x0080, # CYRILLIC CAPITAL LETTER A
+ 0x0411: 0x0081, # CYRILLIC CAPITAL LETTER BE
+ 0x0412: 0x0082, # CYRILLIC CAPITAL LETTER VE
+ 0x0413: 0x0083, # CYRILLIC CAPITAL LETTER GHE
+ 0x0414: 0x0084, # CYRILLIC CAPITAL LETTER DE
+ 0x0415: 0x0085, # CYRILLIC CAPITAL LETTER IE
+ 0x0416: 0x0086, # CYRILLIC CAPITAL LETTER ZHE
+ 0x0417: 0x0087, # CYRILLIC CAPITAL LETTER ZE
+ 0x0418: 0x0088, # CYRILLIC CAPITAL LETTER I
+ 0x0419: 0x0089, # CYRILLIC CAPITAL LETTER SHORT I
+ 0x041a: 0x008a, # CYRILLIC CAPITAL LETTER KA
+ 0x041b: 0x008b, # CYRILLIC CAPITAL LETTER EL
+ 0x041c: 0x008c, # CYRILLIC CAPITAL LETTER EM
+ 0x041d: 0x008d, # CYRILLIC CAPITAL LETTER EN
+ 0x041e: 0x008e, # CYRILLIC CAPITAL LETTER O
+ 0x041f: 0x008f, # CYRILLIC CAPITAL LETTER PE
+ 0x0420: 0x0090, # CYRILLIC CAPITAL LETTER ER
+ 0x0421: 0x0091, # CYRILLIC CAPITAL LETTER ES
+ 0x0422: 0x0092, # CYRILLIC CAPITAL LETTER TE
+ 0x0423: 0x0093, # CYRILLIC CAPITAL LETTER U
+ 0x0424: 0x0094, # CYRILLIC CAPITAL LETTER EF
+ 0x0425: 0x0095, # CYRILLIC CAPITAL LETTER HA
+ 0x0426: 0x0096, # CYRILLIC CAPITAL LETTER TSE
+ 0x0427: 0x0097, # CYRILLIC CAPITAL LETTER CHE
+ 0x0428: 0x0098, # CYRILLIC CAPITAL LETTER SHA
+ 0x0429: 0x0099, # CYRILLIC CAPITAL LETTER SHCHA
+ 0x042a: 0x009a, # CYRILLIC CAPITAL LETTER HARD SIGN
+ 0x042b: 0x009b, # CYRILLIC CAPITAL LETTER YERU
+ 0x042c: 0x009c, # CYRILLIC CAPITAL LETTER SOFT SIGN
+ 0x042d: 0x009d, # CYRILLIC CAPITAL LETTER E
+ 0x042e: 0x009e, # CYRILLIC CAPITAL LETTER YU
+ 0x042f: 0x009f, # CYRILLIC CAPITAL LETTER YA
+ 0x0430: 0x00a0, # CYRILLIC SMALL LETTER A
+ 0x0431: 0x00a1, # CYRILLIC SMALL LETTER BE
+ 0x0432: 0x00a2, # CYRILLIC SMALL LETTER VE
+ 0x0433: 0x00a3, # CYRILLIC SMALL LETTER GHE
+ 0x0434: 0x00a4, # CYRILLIC SMALL LETTER DE
+ 0x0435: 0x00a5, # CYRILLIC SMALL LETTER IE
+ 0x0436: 0x00a6, # CYRILLIC SMALL LETTER ZHE
+ 0x0437: 0x00a7, # CYRILLIC SMALL LETTER ZE
+ 0x0438: 0x00a8, # CYRILLIC SMALL LETTER I
+ 0x0439: 0x00a9, # CYRILLIC SMALL LETTER SHORT I
+ 0x043a: 0x00aa, # CYRILLIC SMALL LETTER KA
+ 0x043b: 0x00ab, # CYRILLIC SMALL LETTER EL
+ 0x043c: 0x00ac, # CYRILLIC SMALL LETTER EM
+ 0x043d: 0x00ad, # CYRILLIC SMALL LETTER EN
+ 0x043e: 0x00ae, # CYRILLIC SMALL LETTER O
+ 0x043f: 0x00af, # CYRILLIC SMALL LETTER PE
+ 0x0440: 0x00e0, # CYRILLIC SMALL LETTER ER
+ 0x0441: 0x00e1, # CYRILLIC SMALL LETTER ES
+ 0x0442: 0x00e2, # CYRILLIC SMALL LETTER TE
+ 0x0443: 0x00e3, # CYRILLIC SMALL LETTER U
+ 0x0444: 0x00e4, # CYRILLIC SMALL LETTER EF
+ 0x0445: 0x00e5, # CYRILLIC SMALL LETTER HA
+ 0x0446: 0x00e6, # CYRILLIC SMALL LETTER TSE
+ 0x0447: 0x00e7, # CYRILLIC SMALL LETTER CHE
+ 0x0448: 0x00e8, # CYRILLIC SMALL LETTER SHA
+ 0x0449: 0x00e9, # CYRILLIC SMALL LETTER SHCHA
+ 0x044a: 0x00ea, # CYRILLIC SMALL LETTER HARD SIGN
+ 0x044b: 0x00eb, # CYRILLIC SMALL LETTER YERU
+ 0x044c: 0x00ec, # CYRILLIC SMALL LETTER SOFT SIGN
+ 0x044d: 0x00ed, # CYRILLIC SMALL LETTER E
+ 0x044e: 0x00ee, # CYRILLIC SMALL LETTER YU
+ 0x044f: 0x00ef, # CYRILLIC SMALL LETTER YA
+ 0x0451: 0x00f1, # CYRILLIC SMALL LETTER IO
+ 0x0454: 0x00f3, # CYRILLIC SMALL LETTER UKRAINIAN IE
+ 0x0457: 0x00f5, # CYRILLIC SMALL LETTER YI
+ 0x045e: 0x00f7, # CYRILLIC SMALL LETTER SHORT U
+ 0x2116: 0x00fc, # NUMERO SIGN
+ 0x2219: 0x00f9, # BULLET OPERATOR
+ 0x221a: 0x00fb, # SQUARE ROOT
+ 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL
+ 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x2552: 0x00d5, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ 0x2553: 0x00d6, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x2555: 0x00b8, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ 0x2556: 0x00b7, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x2558: 0x00d4, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ 0x2559: 0x00d3, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x255b: 0x00be, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ 0x255c: 0x00bd, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x255e: 0x00c6, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ 0x255f: 0x00c7, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x2561: 0x00b5, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ 0x2562: 0x00b6, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x2564: 0x00d1, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ 0x2565: 0x00d2, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x2567: 0x00cf, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ 0x2568: 0x00d0, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x256a: 0x00d8, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ 0x256b: 0x00d7, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x2580: 0x00df, # UPPER HALF BLOCK
+ 0x2584: 0x00dc, # LOWER HALF BLOCK
+ 0x2588: 0x00db, # FULL BLOCK
+ 0x258c: 0x00dd, # LEFT HALF BLOCK
+ 0x2590: 0x00de, # RIGHT HALF BLOCK
+ 0x2591: 0x00b0, # LIGHT SHADE
+ 0x2592: 0x00b1, # MEDIUM SHADE
+ 0x2593: 0x00b2, # DARK SHADE
+ 0x25a0: 0x00fe, # BLACK SQUARE
+}
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
index 0000000000..59e33186e9
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp869.py
@@ -0,0 +1,689 @@
+""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP869.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp869',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0080: None, # UNDEFINED
+ 0x0081: None, # UNDEFINED
+ 0x0082: None, # UNDEFINED
+ 0x0083: None, # UNDEFINED
+ 0x0084: None, # UNDEFINED
+ 0x0085: None, # UNDEFINED
+ 0x0086: 0x0386, # GREEK CAPITAL LETTER ALPHA WITH TONOS
+ 0x0087: None, # UNDEFINED
+ 0x0088: 0x00b7, # MIDDLE DOT
+ 0x0089: 0x00ac, # NOT SIGN
+ 0x008a: 0x00a6, # BROKEN BAR
+ 0x008b: 0x2018, # LEFT SINGLE QUOTATION MARK
+ 0x008c: 0x2019, # RIGHT SINGLE QUOTATION MARK
+ 0x008d: 0x0388, # GREEK CAPITAL LETTER EPSILON WITH TONOS
+ 0x008e: 0x2015, # HORIZONTAL BAR
+ 0x008f: 0x0389, # GREEK CAPITAL LETTER ETA WITH TONOS
+ 0x0090: 0x038a, # GREEK CAPITAL LETTER IOTA WITH TONOS
+ 0x0091: 0x03aa, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA
+ 0x0092: 0x038c, # GREEK CAPITAL LETTER OMICRON WITH TONOS
+ 0x0093: None, # UNDEFINED
+ 0x0094: None, # UNDEFINED
+ 0x0095: 0x038e, # GREEK CAPITAL LETTER UPSILON WITH TONOS
+ 0x0096: 0x03ab, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
+ 0x0097: 0x00a9, # COPYRIGHT SIGN
+ 0x0098: 0x038f, # GREEK CAPITAL LETTER OMEGA WITH TONOS
+ 0x0099: 0x00b2, # SUPERSCRIPT TWO
+ 0x009a: 0x00b3, # SUPERSCRIPT THREE
+ 0x009b: 0x03ac, # GREEK SMALL LETTER ALPHA WITH TONOS
+ 0x009c: 0x00a3, # POUND SIGN
+ 0x009d: 0x03ad, # GREEK SMALL LETTER EPSILON WITH TONOS
+ 0x009e: 0x03ae, # GREEK SMALL LETTER ETA WITH TONOS
+ 0x009f: 0x03af, # GREEK SMALL LETTER IOTA WITH TONOS
+ 0x00a0: 0x03ca, # GREEK SMALL LETTER IOTA WITH DIALYTIKA
+ 0x00a1: 0x0390, # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS
+ 0x00a2: 0x03cc, # GREEK SMALL LETTER OMICRON WITH TONOS
+ 0x00a3: 0x03cd, # GREEK SMALL LETTER UPSILON WITH TONOS
+ 0x00a4: 0x0391, # GREEK CAPITAL LETTER ALPHA
+ 0x00a5: 0x0392, # GREEK CAPITAL LETTER BETA
+ 0x00a6: 0x0393, # GREEK CAPITAL LETTER GAMMA
+ 0x00a7: 0x0394, # GREEK CAPITAL LETTER DELTA
+ 0x00a8: 0x0395, # GREEK CAPITAL LETTER EPSILON
+ 0x00a9: 0x0396, # GREEK CAPITAL LETTER ZETA
+ 0x00aa: 0x0397, # GREEK CAPITAL LETTER ETA
+ 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF
+ 0x00ac: 0x0398, # GREEK CAPITAL LETTER THETA
+ 0x00ad: 0x0399, # GREEK CAPITAL LETTER IOTA
+ 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00b0: 0x2591, # LIGHT SHADE
+ 0x00b1: 0x2592, # MEDIUM SHADE
+ 0x00b2: 0x2593, # DARK SHADE
+ 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL
+ 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x00b5: 0x039a, # GREEK CAPITAL LETTER KAPPA
+ 0x00b6: 0x039b, # GREEK CAPITAL LETTER LAMDA
+ 0x00b7: 0x039c, # GREEK CAPITAL LETTER MU
+ 0x00b8: 0x039d, # GREEK CAPITAL LETTER NU
+ 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x00bd: 0x039e, # GREEK CAPITAL LETTER XI
+ 0x00be: 0x039f, # GREEK CAPITAL LETTER OMICRON
+ 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x00c6: 0x03a0, # GREEK CAPITAL LETTER PI
+ 0x00c7: 0x03a1, # GREEK CAPITAL LETTER RHO
+ 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x00cf: 0x03a3, # GREEK CAPITAL LETTER SIGMA
+ 0x00d0: 0x03a4, # GREEK CAPITAL LETTER TAU
+ 0x00d1: 0x03a5, # GREEK CAPITAL LETTER UPSILON
+ 0x00d2: 0x03a6, # GREEK CAPITAL LETTER PHI
+ 0x00d3: 0x03a7, # GREEK CAPITAL LETTER CHI
+ 0x00d4: 0x03a8, # GREEK CAPITAL LETTER PSI
+ 0x00d5: 0x03a9, # GREEK CAPITAL LETTER OMEGA
+ 0x00d6: 0x03b1, # GREEK SMALL LETTER ALPHA
+ 0x00d7: 0x03b2, # GREEK SMALL LETTER BETA
+ 0x00d8: 0x03b3, # GREEK SMALL LETTER GAMMA
+ 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x00db: 0x2588, # FULL BLOCK
+ 0x00dc: 0x2584, # LOWER HALF BLOCK
+ 0x00dd: 0x03b4, # GREEK SMALL LETTER DELTA
+ 0x00de: 0x03b5, # GREEK SMALL LETTER EPSILON
+ 0x00df: 0x2580, # UPPER HALF BLOCK
+ 0x00e0: 0x03b6, # GREEK SMALL LETTER ZETA
+ 0x00e1: 0x03b7, # GREEK SMALL LETTER ETA
+ 0x00e2: 0x03b8, # GREEK SMALL LETTER THETA
+ 0x00e3: 0x03b9, # GREEK SMALL LETTER IOTA
+ 0x00e4: 0x03ba, # GREEK SMALL LETTER KAPPA
+ 0x00e5: 0x03bb, # GREEK SMALL LETTER LAMDA
+ 0x00e6: 0x03bc, # GREEK SMALL LETTER MU
+ 0x00e7: 0x03bd, # GREEK SMALL LETTER NU
+ 0x00e8: 0x03be, # GREEK SMALL LETTER XI
+ 0x00e9: 0x03bf, # GREEK SMALL LETTER OMICRON
+ 0x00ea: 0x03c0, # GREEK SMALL LETTER PI
+ 0x00eb: 0x03c1, # GREEK SMALL LETTER RHO
+ 0x00ec: 0x03c3, # GREEK SMALL LETTER SIGMA
+ 0x00ed: 0x03c2, # GREEK SMALL LETTER FINAL SIGMA
+ 0x00ee: 0x03c4, # GREEK SMALL LETTER TAU
+ 0x00ef: 0x0384, # GREEK TONOS
+ 0x00f0: 0x00ad, # SOFT HYPHEN
+ 0x00f1: 0x00b1, # PLUS-MINUS SIGN
+ 0x00f2: 0x03c5, # GREEK SMALL LETTER UPSILON
+ 0x00f3: 0x03c6, # GREEK SMALL LETTER PHI
+ 0x00f4: 0x03c7, # GREEK SMALL LETTER CHI
+ 0x00f5: 0x00a7, # SECTION SIGN
+ 0x00f6: 0x03c8, # GREEK SMALL LETTER PSI
+ 0x00f7: 0x0385, # GREEK DIALYTIKA TONOS
+ 0x00f8: 0x00b0, # DEGREE SIGN
+ 0x00f9: 0x00a8, # DIAERESIS
+ 0x00fa: 0x03c9, # GREEK SMALL LETTER OMEGA
+ 0x00fb: 0x03cb, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA
+ 0x00fc: 0x03b0, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS
+ 0x00fd: 0x03ce, # GREEK SMALL LETTER OMEGA WITH TONOS
+ 0x00fe: 0x25a0, # BLACK SQUARE
+ 0x00ff: 0x00a0, # NO-BREAK SPACE
+})
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x0000 -> NULL
+ u'\x01' # 0x0001 -> START OF HEADING
+ u'\x02' # 0x0002 -> START OF TEXT
+ u'\x03' # 0x0003 -> END OF TEXT
+ u'\x04' # 0x0004 -> END OF TRANSMISSION
+ u'\x05' # 0x0005 -> ENQUIRY
+ u'\x06' # 0x0006 -> ACKNOWLEDGE
+ u'\x07' # 0x0007 -> BELL
+ u'\x08' # 0x0008 -> BACKSPACE
+ u'\t' # 0x0009 -> HORIZONTAL TABULATION
+ u'\n' # 0x000a -> LINE FEED
+ u'\x0b' # 0x000b -> VERTICAL TABULATION
+ u'\x0c' # 0x000c -> FORM FEED
+ u'\r' # 0x000d -> CARRIAGE RETURN
+ u'\x0e' # 0x000e -> SHIFT OUT
+ u'\x0f' # 0x000f -> SHIFT IN
+ u'\x10' # 0x0010 -> DATA LINK ESCAPE
+ u'\x11' # 0x0011 -> DEVICE CONTROL ONE
+ u'\x12' # 0x0012 -> DEVICE CONTROL TWO
+ u'\x13' # 0x0013 -> DEVICE CONTROL THREE
+ u'\x14' # 0x0014 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x0016 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x0018 -> CANCEL
+ u'\x19' # 0x0019 -> END OF MEDIUM
+ u'\x1a' # 0x001a -> SUBSTITUTE
+ u'\x1b' # 0x001b -> ESCAPE
+ u'\x1c' # 0x001c -> FILE SEPARATOR
+ u'\x1d' # 0x001d -> GROUP SEPARATOR
+ u'\x1e' # 0x001e -> RECORD SEPARATOR
+ u'\x1f' # 0x001f -> UNIT SEPARATOR
+ u' ' # 0x0020 -> SPACE
+ u'!' # 0x0021 -> EXCLAMATION MARK
+ u'"' # 0x0022 -> QUOTATION MARK
+ u'#' # 0x0023 -> NUMBER SIGN
+ u'$' # 0x0024 -> DOLLAR SIGN
+ u'%' # 0x0025 -> PERCENT SIGN
+ u'&' # 0x0026 -> AMPERSAND
+ u"'" # 0x0027 -> APOSTROPHE
+ u'(' # 0x0028 -> LEFT PARENTHESIS
+ u')' # 0x0029 -> RIGHT PARENTHESIS
+ u'*' # 0x002a -> ASTERISK
+ u'+' # 0x002b -> PLUS SIGN
+ u',' # 0x002c -> COMMA
+ u'-' # 0x002d -> HYPHEN-MINUS
+ u'.' # 0x002e -> FULL STOP
+ u'/' # 0x002f -> SOLIDUS
+ u'0' # 0x0030 -> DIGIT ZERO
+ u'1' # 0x0031 -> DIGIT ONE
+ u'2' # 0x0032 -> DIGIT TWO
+ u'3' # 0x0033 -> DIGIT THREE
+ u'4' # 0x0034 -> DIGIT FOUR
+ u'5' # 0x0035 -> DIGIT FIVE
+ u'6' # 0x0036 -> DIGIT SIX
+ u'7' # 0x0037 -> DIGIT SEVEN
+ u'8' # 0x0038 -> DIGIT EIGHT
+ u'9' # 0x0039 -> DIGIT NINE
+ u':' # 0x003a -> COLON
+ u';' # 0x003b -> SEMICOLON
+ u'<' # 0x003c -> LESS-THAN SIGN
+ u'=' # 0x003d -> EQUALS SIGN
+ u'>' # 0x003e -> GREATER-THAN SIGN
+ u'?' # 0x003f -> QUESTION MARK
+ u'@' # 0x0040 -> COMMERCIAL AT
+ u'A' # 0x0041 -> LATIN CAPITAL LETTER A
+ u'B' # 0x0042 -> LATIN CAPITAL LETTER B
+ u'C' # 0x0043 -> LATIN CAPITAL LETTER C
+ u'D' # 0x0044 -> LATIN CAPITAL LETTER D
+ u'E' # 0x0045 -> LATIN CAPITAL LETTER E
+ u'F' # 0x0046 -> LATIN CAPITAL LETTER F
+ u'G' # 0x0047 -> LATIN CAPITAL LETTER G
+ u'H' # 0x0048 -> LATIN CAPITAL LETTER H
+ u'I' # 0x0049 -> LATIN CAPITAL LETTER I
+ u'J' # 0x004a -> LATIN CAPITAL LETTER J
+ u'K' # 0x004b -> LATIN CAPITAL LETTER K
+ u'L' # 0x004c -> LATIN CAPITAL LETTER L
+ u'M' # 0x004d -> LATIN CAPITAL LETTER M
+ u'N' # 0x004e -> LATIN CAPITAL LETTER N
+ u'O' # 0x004f -> LATIN CAPITAL LETTER O
+ u'P' # 0x0050 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x0052 -> LATIN CAPITAL LETTER R
+ u'S' # 0x0053 -> LATIN CAPITAL LETTER S
+ u'T' # 0x0054 -> LATIN CAPITAL LETTER T
+ u'U' # 0x0055 -> LATIN CAPITAL LETTER U
+ u'V' # 0x0056 -> LATIN CAPITAL LETTER V
+ u'W' # 0x0057 -> LATIN CAPITAL LETTER W
+ u'X' # 0x0058 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x005a -> LATIN CAPITAL LETTER Z
+ u'[' # 0x005b -> LEFT SQUARE BRACKET
+ u'\\' # 0x005c -> REVERSE SOLIDUS
+ u']' # 0x005d -> RIGHT SQUARE BRACKET
+ u'^' # 0x005e -> CIRCUMFLEX ACCENT
+ u'_' # 0x005f -> LOW LINE
+ u'`' # 0x0060 -> GRAVE ACCENT
+ u'a' # 0x0061 -> LATIN SMALL LETTER A
+ u'b' # 0x0062 -> LATIN SMALL LETTER B
+ u'c' # 0x0063 -> LATIN SMALL LETTER C
+ u'd' # 0x0064 -> LATIN SMALL LETTER D
+ u'e' # 0x0065 -> LATIN SMALL LETTER E
+ u'f' # 0x0066 -> LATIN SMALL LETTER F
+ u'g' # 0x0067 -> LATIN SMALL LETTER G
+ u'h' # 0x0068 -> LATIN SMALL LETTER H
+ u'i' # 0x0069 -> LATIN SMALL LETTER I
+ u'j' # 0x006a -> LATIN SMALL LETTER J
+ u'k' # 0x006b -> LATIN SMALL LETTER K
+ u'l' # 0x006c -> LATIN SMALL LETTER L
+ u'm' # 0x006d -> LATIN SMALL LETTER M
+ u'n' # 0x006e -> LATIN SMALL LETTER N
+ u'o' # 0x006f -> LATIN SMALL LETTER O
+ u'p' # 0x0070 -> LATIN SMALL LETTER P
+ u'q' # 0x0071 -> LATIN SMALL LETTER Q
+ u'r' # 0x0072 -> LATIN SMALL LETTER R
+ u's' # 0x0073 -> LATIN SMALL LETTER S
+ u't' # 0x0074 -> LATIN SMALL LETTER T
+ u'u' # 0x0075 -> LATIN SMALL LETTER U
+ u'v' # 0x0076 -> LATIN SMALL LETTER V
+ u'w' # 0x0077 -> LATIN SMALL LETTER W
+ u'x' # 0x0078 -> LATIN SMALL LETTER X
+ u'y' # 0x0079 -> LATIN SMALL LETTER Y
+ u'z' # 0x007a -> LATIN SMALL LETTER Z
+ u'{' # 0x007b -> LEFT CURLY BRACKET
+ u'|' # 0x007c -> VERTICAL LINE
+ u'}' # 0x007d -> RIGHT CURLY BRACKET
+ u'~' # 0x007e -> TILDE
+ u'\x7f' # 0x007f -> DELETE
+ u'\ufffe' # 0x0080 -> UNDEFINED
+ u'\ufffe' # 0x0081 -> UNDEFINED
+ u'\ufffe' # 0x0082 -> UNDEFINED
+ u'\ufffe' # 0x0083 -> UNDEFINED
+ u'\ufffe' # 0x0084 -> UNDEFINED
+ u'\ufffe' # 0x0085 -> UNDEFINED
+ u'\u0386' # 0x0086 -> GREEK CAPITAL LETTER ALPHA WITH TONOS
+ u'\ufffe' # 0x0087 -> UNDEFINED
+ u'\xb7' # 0x0088 -> MIDDLE DOT
+ u'\xac' # 0x0089 -> NOT SIGN
+ u'\xa6' # 0x008a -> BROKEN BAR
+ u'\u2018' # 0x008b -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0x008c -> RIGHT SINGLE QUOTATION MARK
+ u'\u0388' # 0x008d -> GREEK CAPITAL LETTER EPSILON WITH TONOS
+ u'\u2015' # 0x008e -> HORIZONTAL BAR
+ u'\u0389' # 0x008f -> GREEK CAPITAL LETTER ETA WITH TONOS
+ u'\u038a' # 0x0090 -> GREEK CAPITAL LETTER IOTA WITH TONOS
+ u'\u03aa' # 0x0091 -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA
+ u'\u038c' # 0x0092 -> GREEK CAPITAL LETTER OMICRON WITH TONOS
+ u'\ufffe' # 0x0093 -> UNDEFINED
+ u'\ufffe' # 0x0094 -> UNDEFINED
+ u'\u038e' # 0x0095 -> GREEK CAPITAL LETTER UPSILON WITH TONOS
+ u'\u03ab' # 0x0096 -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
+ u'\xa9' # 0x0097 -> COPYRIGHT SIGN
+ u'\u038f' # 0x0098 -> GREEK CAPITAL LETTER OMEGA WITH TONOS
+ u'\xb2' # 0x0099 -> SUPERSCRIPT TWO
+ u'\xb3' # 0x009a -> SUPERSCRIPT THREE
+ u'\u03ac' # 0x009b -> GREEK SMALL LETTER ALPHA WITH TONOS
+ u'\xa3' # 0x009c -> POUND SIGN
+ u'\u03ad' # 0x009d -> GREEK SMALL LETTER EPSILON WITH TONOS
+ u'\u03ae' # 0x009e -> GREEK SMALL LETTER ETA WITH TONOS
+ u'\u03af' # 0x009f -> GREEK SMALL LETTER IOTA WITH TONOS
+ u'\u03ca' # 0x00a0 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA
+ u'\u0390' # 0x00a1 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS
+ u'\u03cc' # 0x00a2 -> GREEK SMALL LETTER OMICRON WITH TONOS
+ u'\u03cd' # 0x00a3 -> GREEK SMALL LETTER UPSILON WITH TONOS
+ u'\u0391' # 0x00a4 -> GREEK CAPITAL LETTER ALPHA
+ u'\u0392' # 0x00a5 -> GREEK CAPITAL LETTER BETA
+ u'\u0393' # 0x00a6 -> GREEK CAPITAL LETTER GAMMA
+ u'\u0394' # 0x00a7 -> GREEK CAPITAL LETTER DELTA
+ u'\u0395' # 0x00a8 -> GREEK CAPITAL LETTER EPSILON
+ u'\u0396' # 0x00a9 -> GREEK CAPITAL LETTER ZETA
+ u'\u0397' # 0x00aa -> GREEK CAPITAL LETTER ETA
+ u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF
+ u'\u0398' # 0x00ac -> GREEK CAPITAL LETTER THETA
+ u'\u0399' # 0x00ad -> GREEK CAPITAL LETTER IOTA
+ u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2591' # 0x00b0 -> LIGHT SHADE
+ u'\u2592' # 0x00b1 -> MEDIUM SHADE
+ u'\u2593' # 0x00b2 -> DARK SHADE
+ u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL
+ u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ u'\u039a' # 0x00b5 -> GREEK CAPITAL LETTER KAPPA
+ u'\u039b' # 0x00b6 -> GREEK CAPITAL LETTER LAMDA
+ u'\u039c' # 0x00b7 -> GREEK CAPITAL LETTER MU
+ u'\u039d' # 0x00b8 -> GREEK CAPITAL LETTER NU
+ u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL
+ u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT
+ u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT
+ u'\u039e' # 0x00bd -> GREEK CAPITAL LETTER XI
+ u'\u039f' # 0x00be -> GREEK CAPITAL LETTER OMICRON
+ u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT
+ u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT
+ u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL
+ u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ u'\u03a0' # 0x00c6 -> GREEK CAPITAL LETTER PI
+ u'\u03a1' # 0x00c7 -> GREEK CAPITAL LETTER RHO
+ u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT
+ u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL
+ u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ u'\u03a3' # 0x00cf -> GREEK CAPITAL LETTER SIGMA
+ u'\u03a4' # 0x00d0 -> GREEK CAPITAL LETTER TAU
+ u'\u03a5' # 0x00d1 -> GREEK CAPITAL LETTER UPSILON
+ u'\u03a6' # 0x00d2 -> GREEK CAPITAL LETTER PHI
+ u'\u03a7' # 0x00d3 -> GREEK CAPITAL LETTER CHI
+ u'\u03a8' # 0x00d4 -> GREEK CAPITAL LETTER PSI
+ u'\u03a9' # 0x00d5 -> GREEK CAPITAL LETTER OMEGA
+ u'\u03b1' # 0x00d6 -> GREEK SMALL LETTER ALPHA
+ u'\u03b2' # 0x00d7 -> GREEK SMALL LETTER BETA
+ u'\u03b3' # 0x00d8 -> GREEK SMALL LETTER GAMMA
+ u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT
+ u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT
+ u'\u2588' # 0x00db -> FULL BLOCK
+ u'\u2584' # 0x00dc -> LOWER HALF BLOCK
+ u'\u03b4' # 0x00dd -> GREEK SMALL LETTER DELTA
+ u'\u03b5' # 0x00de -> GREEK SMALL LETTER EPSILON
+ u'\u2580' # 0x00df -> UPPER HALF BLOCK
+ u'\u03b6' # 0x00e0 -> GREEK SMALL LETTER ZETA
+ u'\u03b7' # 0x00e1 -> GREEK SMALL LETTER ETA
+ u'\u03b8' # 0x00e2 -> GREEK SMALL LETTER THETA
+ u'\u03b9' # 0x00e3 -> GREEK SMALL LETTER IOTA
+ u'\u03ba' # 0x00e4 -> GREEK SMALL LETTER KAPPA
+ u'\u03bb' # 0x00e5 -> GREEK SMALL LETTER LAMDA
+ u'\u03bc' # 0x00e6 -> GREEK SMALL LETTER MU
+ u'\u03bd' # 0x00e7 -> GREEK SMALL LETTER NU
+ u'\u03be' # 0x00e8 -> GREEK SMALL LETTER XI
+ u'\u03bf' # 0x00e9 -> GREEK SMALL LETTER OMICRON
+ u'\u03c0' # 0x00ea -> GREEK SMALL LETTER PI
+ u'\u03c1' # 0x00eb -> GREEK SMALL LETTER RHO
+ u'\u03c3' # 0x00ec -> GREEK SMALL LETTER SIGMA
+ u'\u03c2' # 0x00ed -> GREEK SMALL LETTER FINAL SIGMA
+ u'\u03c4' # 0x00ee -> GREEK SMALL LETTER TAU
+ u'\u0384' # 0x00ef -> GREEK TONOS
+ u'\xad' # 0x00f0 -> SOFT HYPHEN
+ u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN
+ u'\u03c5' # 0x00f2 -> GREEK SMALL LETTER UPSILON
+ u'\u03c6' # 0x00f3 -> GREEK SMALL LETTER PHI
+ u'\u03c7' # 0x00f4 -> GREEK SMALL LETTER CHI
+ u'\xa7' # 0x00f5 -> SECTION SIGN
+ u'\u03c8' # 0x00f6 -> GREEK SMALL LETTER PSI
+ u'\u0385' # 0x00f7 -> GREEK DIALYTIKA TONOS
+ u'\xb0' # 0x00f8 -> DEGREE SIGN
+ u'\xa8' # 0x00f9 -> DIAERESIS
+ u'\u03c9' # 0x00fa -> GREEK SMALL LETTER OMEGA
+ u'\u03cb' # 0x00fb -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA
+ u'\u03b0' # 0x00fc -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS
+ u'\u03ce' # 0x00fd -> GREEK SMALL LETTER OMEGA WITH TONOS
+ u'\u25a0' # 0x00fe -> BLACK SQUARE
+ u'\xa0' # 0x00ff -> NO-BREAK SPACE
+)
+
+### Encoding Map
+
+encoding_map = {
+ 0x0000: 0x0000, # NULL
+ 0x0001: 0x0001, # START OF HEADING
+ 0x0002: 0x0002, # START OF TEXT
+ 0x0003: 0x0003, # END OF TEXT
+ 0x0004: 0x0004, # END OF TRANSMISSION
+ 0x0005: 0x0005, # ENQUIRY
+ 0x0006: 0x0006, # ACKNOWLEDGE
+ 0x0007: 0x0007, # BELL
+ 0x0008: 0x0008, # BACKSPACE
+ 0x0009: 0x0009, # HORIZONTAL TABULATION
+ 0x000a: 0x000a, # LINE FEED
+ 0x000b: 0x000b, # VERTICAL TABULATION
+ 0x000c: 0x000c, # FORM FEED
+ 0x000d: 0x000d, # CARRIAGE RETURN
+ 0x000e: 0x000e, # SHIFT OUT
+ 0x000f: 0x000f, # SHIFT IN
+ 0x0010: 0x0010, # DATA LINK ESCAPE
+ 0x0011: 0x0011, # DEVICE CONTROL ONE
+ 0x0012: 0x0012, # DEVICE CONTROL TWO
+ 0x0013: 0x0013, # DEVICE CONTROL THREE
+ 0x0014: 0x0014, # DEVICE CONTROL FOUR
+ 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE
+ 0x0016: 0x0016, # SYNCHRONOUS IDLE
+ 0x0017: 0x0017, # END OF TRANSMISSION BLOCK
+ 0x0018: 0x0018, # CANCEL
+ 0x0019: 0x0019, # END OF MEDIUM
+ 0x001a: 0x001a, # SUBSTITUTE
+ 0x001b: 0x001b, # ESCAPE
+ 0x001c: 0x001c, # FILE SEPARATOR
+ 0x001d: 0x001d, # GROUP SEPARATOR
+ 0x001e: 0x001e, # RECORD SEPARATOR
+ 0x001f: 0x001f, # UNIT SEPARATOR
+ 0x0020: 0x0020, # SPACE
+ 0x0021: 0x0021, # EXCLAMATION MARK
+ 0x0022: 0x0022, # QUOTATION MARK
+ 0x0023: 0x0023, # NUMBER SIGN
+ 0x0024: 0x0024, # DOLLAR SIGN
+ 0x0025: 0x0025, # PERCENT SIGN
+ 0x0026: 0x0026, # AMPERSAND
+ 0x0027: 0x0027, # APOSTROPHE
+ 0x0028: 0x0028, # LEFT PARENTHESIS
+ 0x0029: 0x0029, # RIGHT PARENTHESIS
+ 0x002a: 0x002a, # ASTERISK
+ 0x002b: 0x002b, # PLUS SIGN
+ 0x002c: 0x002c, # COMMA
+ 0x002d: 0x002d, # HYPHEN-MINUS
+ 0x002e: 0x002e, # FULL STOP
+ 0x002f: 0x002f, # SOLIDUS
+ 0x0030: 0x0030, # DIGIT ZERO
+ 0x0031: 0x0031, # DIGIT ONE
+ 0x0032: 0x0032, # DIGIT TWO
+ 0x0033: 0x0033, # DIGIT THREE
+ 0x0034: 0x0034, # DIGIT FOUR
+ 0x0035: 0x0035, # DIGIT FIVE
+ 0x0036: 0x0036, # DIGIT SIX
+ 0x0037: 0x0037, # DIGIT SEVEN
+ 0x0038: 0x0038, # DIGIT EIGHT
+ 0x0039: 0x0039, # DIGIT NINE
+ 0x003a: 0x003a, # COLON
+ 0x003b: 0x003b, # SEMICOLON
+ 0x003c: 0x003c, # LESS-THAN SIGN
+ 0x003d: 0x003d, # EQUALS SIGN
+ 0x003e: 0x003e, # GREATER-THAN SIGN
+ 0x003f: 0x003f, # QUESTION MARK
+ 0x0040: 0x0040, # COMMERCIAL AT
+ 0x0041: 0x0041, # LATIN CAPITAL LETTER A
+ 0x0042: 0x0042, # LATIN CAPITAL LETTER B
+ 0x0043: 0x0043, # LATIN CAPITAL LETTER C
+ 0x0044: 0x0044, # LATIN CAPITAL LETTER D
+ 0x0045: 0x0045, # LATIN CAPITAL LETTER E
+ 0x0046: 0x0046, # LATIN CAPITAL LETTER F
+ 0x0047: 0x0047, # LATIN CAPITAL LETTER G
+ 0x0048: 0x0048, # LATIN CAPITAL LETTER H
+ 0x0049: 0x0049, # LATIN CAPITAL LETTER I
+ 0x004a: 0x004a, # LATIN CAPITAL LETTER J
+ 0x004b: 0x004b, # LATIN CAPITAL LETTER K
+ 0x004c: 0x004c, # LATIN CAPITAL LETTER L
+ 0x004d: 0x004d, # LATIN CAPITAL LETTER M
+ 0x004e: 0x004e, # LATIN CAPITAL LETTER N
+ 0x004f: 0x004f, # LATIN CAPITAL LETTER O
+ 0x0050: 0x0050, # LATIN CAPITAL LETTER P
+ 0x0051: 0x0051, # LATIN CAPITAL LETTER Q
+ 0x0052: 0x0052, # LATIN CAPITAL LETTER R
+ 0x0053: 0x0053, # LATIN CAPITAL LETTER S
+ 0x0054: 0x0054, # LATIN CAPITAL LETTER T
+ 0x0055: 0x0055, # LATIN CAPITAL LETTER U
+ 0x0056: 0x0056, # LATIN CAPITAL LETTER V
+ 0x0057: 0x0057, # LATIN CAPITAL LETTER W
+ 0x0058: 0x0058, # LATIN CAPITAL LETTER X
+ 0x0059: 0x0059, # LATIN CAPITAL LETTER Y
+ 0x005a: 0x005a, # LATIN CAPITAL LETTER Z
+ 0x005b: 0x005b, # LEFT SQUARE BRACKET
+ 0x005c: 0x005c, # REVERSE SOLIDUS
+ 0x005d: 0x005d, # RIGHT SQUARE BRACKET
+ 0x005e: 0x005e, # CIRCUMFLEX ACCENT
+ 0x005f: 0x005f, # LOW LINE
+ 0x0060: 0x0060, # GRAVE ACCENT
+ 0x0061: 0x0061, # LATIN SMALL LETTER A
+ 0x0062: 0x0062, # LATIN SMALL LETTER B
+ 0x0063: 0x0063, # LATIN SMALL LETTER C
+ 0x0064: 0x0064, # LATIN SMALL LETTER D
+ 0x0065: 0x0065, # LATIN SMALL LETTER E
+ 0x0066: 0x0066, # LATIN SMALL LETTER F
+ 0x0067: 0x0067, # LATIN SMALL LETTER G
+ 0x0068: 0x0068, # LATIN SMALL LETTER H
+ 0x0069: 0x0069, # LATIN SMALL LETTER I
+ 0x006a: 0x006a, # LATIN SMALL LETTER J
+ 0x006b: 0x006b, # LATIN SMALL LETTER K
+ 0x006c: 0x006c, # LATIN SMALL LETTER L
+ 0x006d: 0x006d, # LATIN SMALL LETTER M
+ 0x006e: 0x006e, # LATIN SMALL LETTER N
+ 0x006f: 0x006f, # LATIN SMALL LETTER O
+ 0x0070: 0x0070, # LATIN SMALL LETTER P
+ 0x0071: 0x0071, # LATIN SMALL LETTER Q
+ 0x0072: 0x0072, # LATIN SMALL LETTER R
+ 0x0073: 0x0073, # LATIN SMALL LETTER S
+ 0x0074: 0x0074, # LATIN SMALL LETTER T
+ 0x0075: 0x0075, # LATIN SMALL LETTER U
+ 0x0076: 0x0076, # LATIN SMALL LETTER V
+ 0x0077: 0x0077, # LATIN SMALL LETTER W
+ 0x0078: 0x0078, # LATIN SMALL LETTER X
+ 0x0079: 0x0079, # LATIN SMALL LETTER Y
+ 0x007a: 0x007a, # LATIN SMALL LETTER Z
+ 0x007b: 0x007b, # LEFT CURLY BRACKET
+ 0x007c: 0x007c, # VERTICAL LINE
+ 0x007d: 0x007d, # RIGHT CURLY BRACKET
+ 0x007e: 0x007e, # TILDE
+ 0x007f: 0x007f, # DELETE
+ 0x00a0: 0x00ff, # NO-BREAK SPACE
+ 0x00a3: 0x009c, # POUND SIGN
+ 0x00a6: 0x008a, # BROKEN BAR
+ 0x00a7: 0x00f5, # SECTION SIGN
+ 0x00a8: 0x00f9, # DIAERESIS
+ 0x00a9: 0x0097, # COPYRIGHT SIGN
+ 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00ac: 0x0089, # NOT SIGN
+ 0x00ad: 0x00f0, # SOFT HYPHEN
+ 0x00b0: 0x00f8, # DEGREE SIGN
+ 0x00b1: 0x00f1, # PLUS-MINUS SIGN
+ 0x00b2: 0x0099, # SUPERSCRIPT TWO
+ 0x00b3: 0x009a, # SUPERSCRIPT THREE
+ 0x00b7: 0x0088, # MIDDLE DOT
+ 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF
+ 0x0384: 0x00ef, # GREEK TONOS
+ 0x0385: 0x00f7, # GREEK DIALYTIKA TONOS
+ 0x0386: 0x0086, # GREEK CAPITAL LETTER ALPHA WITH TONOS
+ 0x0388: 0x008d, # GREEK CAPITAL LETTER EPSILON WITH TONOS
+ 0x0389: 0x008f, # GREEK CAPITAL LETTER ETA WITH TONOS
+ 0x038a: 0x0090, # GREEK CAPITAL LETTER IOTA WITH TONOS
+ 0x038c: 0x0092, # GREEK CAPITAL LETTER OMICRON WITH TONOS
+ 0x038e: 0x0095, # GREEK CAPITAL LETTER UPSILON WITH TONOS
+ 0x038f: 0x0098, # GREEK CAPITAL LETTER OMEGA WITH TONOS
+ 0x0390: 0x00a1, # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS
+ 0x0391: 0x00a4, # GREEK CAPITAL LETTER ALPHA
+ 0x0392: 0x00a5, # GREEK CAPITAL LETTER BETA
+ 0x0393: 0x00a6, # GREEK CAPITAL LETTER GAMMA
+ 0x0394: 0x00a7, # GREEK CAPITAL LETTER DELTA
+ 0x0395: 0x00a8, # GREEK CAPITAL LETTER EPSILON
+ 0x0396: 0x00a9, # GREEK CAPITAL LETTER ZETA
+ 0x0397: 0x00aa, # GREEK CAPITAL LETTER ETA
+ 0x0398: 0x00ac, # GREEK CAPITAL LETTER THETA
+ 0x0399: 0x00ad, # GREEK CAPITAL LETTER IOTA
+ 0x039a: 0x00b5, # GREEK CAPITAL LETTER KAPPA
+ 0x039b: 0x00b6, # GREEK CAPITAL LETTER LAMDA
+ 0x039c: 0x00b7, # GREEK CAPITAL LETTER MU
+ 0x039d: 0x00b8, # GREEK CAPITAL LETTER NU
+ 0x039e: 0x00bd, # GREEK CAPITAL LETTER XI
+ 0x039f: 0x00be, # GREEK CAPITAL LETTER OMICRON
+ 0x03a0: 0x00c6, # GREEK CAPITAL LETTER PI
+ 0x03a1: 0x00c7, # GREEK CAPITAL LETTER RHO
+ 0x03a3: 0x00cf, # GREEK CAPITAL LETTER SIGMA
+ 0x03a4: 0x00d0, # GREEK CAPITAL LETTER TAU
+ 0x03a5: 0x00d1, # GREEK CAPITAL LETTER UPSILON
+ 0x03a6: 0x00d2, # GREEK CAPITAL LETTER PHI
+ 0x03a7: 0x00d3, # GREEK CAPITAL LETTER CHI
+ 0x03a8: 0x00d4, # GREEK CAPITAL LETTER PSI
+ 0x03a9: 0x00d5, # GREEK CAPITAL LETTER OMEGA
+ 0x03aa: 0x0091, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA
+ 0x03ab: 0x0096, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
+ 0x03ac: 0x009b, # GREEK SMALL LETTER ALPHA WITH TONOS
+ 0x03ad: 0x009d, # GREEK SMALL LETTER EPSILON WITH TONOS
+ 0x03ae: 0x009e, # GREEK SMALL LETTER ETA WITH TONOS
+ 0x03af: 0x009f, # GREEK SMALL LETTER IOTA WITH TONOS
+ 0x03b0: 0x00fc, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS
+ 0x03b1: 0x00d6, # GREEK SMALL LETTER ALPHA
+ 0x03b2: 0x00d7, # GREEK SMALL LETTER BETA
+ 0x03b3: 0x00d8, # GREEK SMALL LETTER GAMMA
+ 0x03b4: 0x00dd, # GREEK SMALL LETTER DELTA
+ 0x03b5: 0x00de, # GREEK SMALL LETTER EPSILON
+ 0x03b6: 0x00e0, # GREEK SMALL LETTER ZETA
+ 0x03b7: 0x00e1, # GREEK SMALL LETTER ETA
+ 0x03b8: 0x00e2, # GREEK SMALL LETTER THETA
+ 0x03b9: 0x00e3, # GREEK SMALL LETTER IOTA
+ 0x03ba: 0x00e4, # GREEK SMALL LETTER KAPPA
+ 0x03bb: 0x00e5, # GREEK SMALL LETTER LAMDA
+ 0x03bc: 0x00e6, # GREEK SMALL LETTER MU
+ 0x03bd: 0x00e7, # GREEK SMALL LETTER NU
+ 0x03be: 0x00e8, # GREEK SMALL LETTER XI
+ 0x03bf: 0x00e9, # GREEK SMALL LETTER OMICRON
+ 0x03c0: 0x00ea, # GREEK SMALL LETTER PI
+ 0x03c1: 0x00eb, # GREEK SMALL LETTER RHO
+ 0x03c2: 0x00ed, # GREEK SMALL LETTER FINAL SIGMA
+ 0x03c3: 0x00ec, # GREEK SMALL LETTER SIGMA
+ 0x03c4: 0x00ee, # GREEK SMALL LETTER TAU
+ 0x03c5: 0x00f2, # GREEK SMALL LETTER UPSILON
+ 0x03c6: 0x00f3, # GREEK SMALL LETTER PHI
+ 0x03c7: 0x00f4, # GREEK SMALL LETTER CHI
+ 0x03c8: 0x00f6, # GREEK SMALL LETTER PSI
+ 0x03c9: 0x00fa, # GREEK SMALL LETTER OMEGA
+ 0x03ca: 0x00a0, # GREEK SMALL LETTER IOTA WITH DIALYTIKA
+ 0x03cb: 0x00fb, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA
+ 0x03cc: 0x00a2, # GREEK SMALL LETTER OMICRON WITH TONOS
+ 0x03cd: 0x00a3, # GREEK SMALL LETTER UPSILON WITH TONOS
+ 0x03ce: 0x00fd, # GREEK SMALL LETTER OMEGA WITH TONOS
+ 0x2015: 0x008e, # HORIZONTAL BAR
+ 0x2018: 0x008b, # LEFT SINGLE QUOTATION MARK
+ 0x2019: 0x008c, # RIGHT SINGLE QUOTATION MARK
+ 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL
+ 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL
+ 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT
+ 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT
+ 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT
+ 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT
+ 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL
+ 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL
+ 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT
+ 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT
+ 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT
+ 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ 0x2580: 0x00df, # UPPER HALF BLOCK
+ 0x2584: 0x00dc, # LOWER HALF BLOCK
+ 0x2588: 0x00db, # FULL BLOCK
+ 0x2591: 0x00b0, # LIGHT SHADE
+ 0x2592: 0x00b1, # MEDIUM SHADE
+ 0x2593: 0x00b2, # DARK SHADE
+ 0x25a0: 0x00fe, # BLACK SQUARE
+}
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
index 0000000000..66f112fb3d
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp874.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp874 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP874.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp874',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\u20ac' # 0x80 -> EURO SIGN
+ u'\ufffe' # 0x81 -> UNDEFINED
+ u'\ufffe' # 0x82 -> UNDEFINED
+ u'\ufffe' # 0x83 -> UNDEFINED
+ u'\ufffe' # 0x84 -> UNDEFINED
+ u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS
+ u'\ufffe' # 0x86 -> UNDEFINED
+ u'\ufffe' # 0x87 -> UNDEFINED
+ u'\ufffe' # 0x88 -> UNDEFINED
+ u'\ufffe' # 0x89 -> UNDEFINED
+ u'\ufffe' # 0x8A -> UNDEFINED
+ u'\ufffe' # 0x8B -> UNDEFINED
+ u'\ufffe' # 0x8C -> UNDEFINED
+ u'\ufffe' # 0x8D -> UNDEFINED
+ u'\ufffe' # 0x8E -> UNDEFINED
+ u'\ufffe' # 0x8F -> UNDEFINED
+ u'\ufffe' # 0x90 -> UNDEFINED
+ u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK
+ u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK
+ u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK
+ u'\u2022' # 0x95 -> BULLET
+ u'\u2013' # 0x96 -> EN DASH
+ u'\u2014' # 0x97 -> EM DASH
+ u'\ufffe' # 0x98 -> UNDEFINED
+ u'\ufffe' # 0x99 -> UNDEFINED
+ u'\ufffe' # 0x9A -> UNDEFINED
+ u'\ufffe' # 0x9B -> UNDEFINED
+ u'\ufffe' # 0x9C -> UNDEFINED
+ u'\ufffe' # 0x9D -> UNDEFINED
+ u'\ufffe' # 0x9E -> UNDEFINED
+ u'\ufffe' # 0x9F -> UNDEFINED
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\u0e01' # 0xA1 -> THAI CHARACTER KO KAI
+ u'\u0e02' # 0xA2 -> THAI CHARACTER KHO KHAI
+ u'\u0e03' # 0xA3 -> THAI CHARACTER KHO KHUAT
+ u'\u0e04' # 0xA4 -> THAI CHARACTER KHO KHWAI
+ u'\u0e05' # 0xA5 -> THAI CHARACTER KHO KHON
+ u'\u0e06' # 0xA6 -> THAI CHARACTER KHO RAKHANG
+ u'\u0e07' # 0xA7 -> THAI CHARACTER NGO NGU
+ u'\u0e08' # 0xA8 -> THAI CHARACTER CHO CHAN
+ u'\u0e09' # 0xA9 -> THAI CHARACTER CHO CHING
+ u'\u0e0a' # 0xAA -> THAI CHARACTER CHO CHANG
+ u'\u0e0b' # 0xAB -> THAI CHARACTER SO SO
+ u'\u0e0c' # 0xAC -> THAI CHARACTER CHO CHOE
+ u'\u0e0d' # 0xAD -> THAI CHARACTER YO YING
+ u'\u0e0e' # 0xAE -> THAI CHARACTER DO CHADA
+ u'\u0e0f' # 0xAF -> THAI CHARACTER TO PATAK
+ u'\u0e10' # 0xB0 -> THAI CHARACTER THO THAN
+ u'\u0e11' # 0xB1 -> THAI CHARACTER THO NANGMONTHO
+ u'\u0e12' # 0xB2 -> THAI CHARACTER THO PHUTHAO
+ u'\u0e13' # 0xB3 -> THAI CHARACTER NO NEN
+ u'\u0e14' # 0xB4 -> THAI CHARACTER DO DEK
+ u'\u0e15' # 0xB5 -> THAI CHARACTER TO TAO
+ u'\u0e16' # 0xB6 -> THAI CHARACTER THO THUNG
+ u'\u0e17' # 0xB7 -> THAI CHARACTER THO THAHAN
+ u'\u0e18' # 0xB8 -> THAI CHARACTER THO THONG
+ u'\u0e19' # 0xB9 -> THAI CHARACTER NO NU
+ u'\u0e1a' # 0xBA -> THAI CHARACTER BO BAIMAI
+ u'\u0e1b' # 0xBB -> THAI CHARACTER PO PLA
+ u'\u0e1c' # 0xBC -> THAI CHARACTER PHO PHUNG
+ u'\u0e1d' # 0xBD -> THAI CHARACTER FO FA
+ u'\u0e1e' # 0xBE -> THAI CHARACTER PHO PHAN
+ u'\u0e1f' # 0xBF -> THAI CHARACTER FO FAN
+ u'\u0e20' # 0xC0 -> THAI CHARACTER PHO SAMPHAO
+ u'\u0e21' # 0xC1 -> THAI CHARACTER MO MA
+ u'\u0e22' # 0xC2 -> THAI CHARACTER YO YAK
+ u'\u0e23' # 0xC3 -> THAI CHARACTER RO RUA
+ u'\u0e24' # 0xC4 -> THAI CHARACTER RU
+ u'\u0e25' # 0xC5 -> THAI CHARACTER LO LING
+ u'\u0e26' # 0xC6 -> THAI CHARACTER LU
+ u'\u0e27' # 0xC7 -> THAI CHARACTER WO WAEN
+ u'\u0e28' # 0xC8 -> THAI CHARACTER SO SALA
+ u'\u0e29' # 0xC9 -> THAI CHARACTER SO RUSI
+ u'\u0e2a' # 0xCA -> THAI CHARACTER SO SUA
+ u'\u0e2b' # 0xCB -> THAI CHARACTER HO HIP
+ u'\u0e2c' # 0xCC -> THAI CHARACTER LO CHULA
+ u'\u0e2d' # 0xCD -> THAI CHARACTER O ANG
+ u'\u0e2e' # 0xCE -> THAI CHARACTER HO NOKHUK
+ u'\u0e2f' # 0xCF -> THAI CHARACTER PAIYANNOI
+ u'\u0e30' # 0xD0 -> THAI CHARACTER SARA A
+ u'\u0e31' # 0xD1 -> THAI CHARACTER MAI HAN-AKAT
+ u'\u0e32' # 0xD2 -> THAI CHARACTER SARA AA
+ u'\u0e33' # 0xD3 -> THAI CHARACTER SARA AM
+ u'\u0e34' # 0xD4 -> THAI CHARACTER SARA I
+ u'\u0e35' # 0xD5 -> THAI CHARACTER SARA II
+ u'\u0e36' # 0xD6 -> THAI CHARACTER SARA UE
+ u'\u0e37' # 0xD7 -> THAI CHARACTER SARA UEE
+ u'\u0e38' # 0xD8 -> THAI CHARACTER SARA U
+ u'\u0e39' # 0xD9 -> THAI CHARACTER SARA UU
+ u'\u0e3a' # 0xDA -> THAI CHARACTER PHINTHU
+ u'\ufffe' # 0xDB -> UNDEFINED
+ u'\ufffe' # 0xDC -> UNDEFINED
+ u'\ufffe' # 0xDD -> UNDEFINED
+ u'\ufffe' # 0xDE -> UNDEFINED
+ u'\u0e3f' # 0xDF -> THAI CURRENCY SYMBOL BAHT
+ u'\u0e40' # 0xE0 -> THAI CHARACTER SARA E
+ u'\u0e41' # 0xE1 -> THAI CHARACTER SARA AE
+ u'\u0e42' # 0xE2 -> THAI CHARACTER SARA O
+ u'\u0e43' # 0xE3 -> THAI CHARACTER SARA AI MAIMUAN
+ u'\u0e44' # 0xE4 -> THAI CHARACTER SARA AI MAIMALAI
+ u'\u0e45' # 0xE5 -> THAI CHARACTER LAKKHANGYAO
+ u'\u0e46' # 0xE6 -> THAI CHARACTER MAIYAMOK
+ u'\u0e47' # 0xE7 -> THAI CHARACTER MAITAIKHU
+ u'\u0e48' # 0xE8 -> THAI CHARACTER MAI EK
+ u'\u0e49' # 0xE9 -> THAI CHARACTER MAI THO
+ u'\u0e4a' # 0xEA -> THAI CHARACTER MAI TRI
+ u'\u0e4b' # 0xEB -> THAI CHARACTER MAI CHATTAWA
+ u'\u0e4c' # 0xEC -> THAI CHARACTER THANTHAKHAT
+ u'\u0e4d' # 0xED -> THAI CHARACTER NIKHAHIT
+ u'\u0e4e' # 0xEE -> THAI CHARACTER YAMAKKAN
+ u'\u0e4f' # 0xEF -> THAI CHARACTER FONGMAN
+ u'\u0e50' # 0xF0 -> THAI DIGIT ZERO
+ u'\u0e51' # 0xF1 -> THAI DIGIT ONE
+ u'\u0e52' # 0xF2 -> THAI DIGIT TWO
+ u'\u0e53' # 0xF3 -> THAI DIGIT THREE
+ u'\u0e54' # 0xF4 -> THAI DIGIT FOUR
+ u'\u0e55' # 0xF5 -> THAI DIGIT FIVE
+ u'\u0e56' # 0xF6 -> THAI DIGIT SIX
+ u'\u0e57' # 0xF7 -> THAI DIGIT SEVEN
+ u'\u0e58' # 0xF8 -> THAI DIGIT EIGHT
+ u'\u0e59' # 0xF9 -> THAI DIGIT NINE
+ u'\u0e5a' # 0xFA -> THAI CHARACTER ANGKHANKHU
+ u'\u0e5b' # 0xFB -> THAI CHARACTER KHOMUT
+ u'\ufffe' # 0xFC -> UNDEFINED
+ u'\ufffe' # 0xFD -> UNDEFINED
+ u'\ufffe' # 0xFE -> UNDEFINED
+ u'\ufffe' # 0xFF -> UNDEFINED
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..50bbef32b6
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp875.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec cp875 generated from 'MAPPINGS/VENDORS/MICSFT/EBCDIC/CP875.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp875',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x9c' # 0x04 -> CONTROL
+ u'\t' # 0x05 -> HORIZONTAL TABULATION
+ u'\x86' # 0x06 -> CONTROL
+ u'\x7f' # 0x07 -> DELETE
+ u'\x97' # 0x08 -> CONTROL
+ u'\x8d' # 0x09 -> CONTROL
+ u'\x8e' # 0x0A -> CONTROL
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x9d' # 0x14 -> CONTROL
+ u'\x85' # 0x15 -> CONTROL
+ u'\x08' # 0x16 -> BACKSPACE
+ u'\x87' # 0x17 -> CONTROL
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x92' # 0x1A -> CONTROL
+ u'\x8f' # 0x1B -> CONTROL
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u'\x80' # 0x20 -> CONTROL
+ u'\x81' # 0x21 -> CONTROL
+ u'\x82' # 0x22 -> CONTROL
+ u'\x83' # 0x23 -> CONTROL
+ u'\x84' # 0x24 -> CONTROL
+ u'\n' # 0x25 -> LINE FEED
+ u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK
+ u'\x1b' # 0x27 -> ESCAPE
+ u'\x88' # 0x28 -> CONTROL
+ u'\x89' # 0x29 -> CONTROL
+ u'\x8a' # 0x2A -> CONTROL
+ u'\x8b' # 0x2B -> CONTROL
+ u'\x8c' # 0x2C -> CONTROL
+ u'\x05' # 0x2D -> ENQUIRY
+ u'\x06' # 0x2E -> ACKNOWLEDGE
+ u'\x07' # 0x2F -> BELL
+ u'\x90' # 0x30 -> CONTROL
+ u'\x91' # 0x31 -> CONTROL
+ u'\x16' # 0x32 -> SYNCHRONOUS IDLE
+ u'\x93' # 0x33 -> CONTROL
+ u'\x94' # 0x34 -> CONTROL
+ u'\x95' # 0x35 -> CONTROL
+ u'\x96' # 0x36 -> CONTROL
+ u'\x04' # 0x37 -> END OF TRANSMISSION
+ u'\x98' # 0x38 -> CONTROL
+ u'\x99' # 0x39 -> CONTROL
+ u'\x9a' # 0x3A -> CONTROL
+ u'\x9b' # 0x3B -> CONTROL
+ u'\x14' # 0x3C -> DEVICE CONTROL FOUR
+ u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE
+ u'\x9e' # 0x3E -> CONTROL
+ u'\x1a' # 0x3F -> SUBSTITUTE
+ u' ' # 0x40 -> SPACE
+ u'\u0391' # 0x41 -> GREEK CAPITAL LETTER ALPHA
+ u'\u0392' # 0x42 -> GREEK CAPITAL LETTER BETA
+ u'\u0393' # 0x43 -> GREEK CAPITAL LETTER GAMMA
+ u'\u0394' # 0x44 -> GREEK CAPITAL LETTER DELTA
+ u'\u0395' # 0x45 -> GREEK CAPITAL LETTER EPSILON
+ u'\u0396' # 0x46 -> GREEK CAPITAL LETTER ZETA
+ u'\u0397' # 0x47 -> GREEK CAPITAL LETTER ETA
+ u'\u0398' # 0x48 -> GREEK CAPITAL LETTER THETA
+ u'\u0399' # 0x49 -> GREEK CAPITAL LETTER IOTA
+ u'[' # 0x4A -> LEFT SQUARE BRACKET
+ u'.' # 0x4B -> FULL STOP
+ u'<' # 0x4C -> LESS-THAN SIGN
+ u'(' # 0x4D -> LEFT PARENTHESIS
+ u'+' # 0x4E -> PLUS SIGN
+ u'!' # 0x4F -> EXCLAMATION MARK
+ u'&' # 0x50 -> AMPERSAND
+ u'\u039a' # 0x51 -> GREEK CAPITAL LETTER KAPPA
+ u'\u039b' # 0x52 -> GREEK CAPITAL LETTER LAMDA
+ u'\u039c' # 0x53 -> GREEK CAPITAL LETTER MU
+ u'\u039d' # 0x54 -> GREEK CAPITAL LETTER NU
+ u'\u039e' # 0x55 -> GREEK CAPITAL LETTER XI
+ u'\u039f' # 0x56 -> GREEK CAPITAL LETTER OMICRON
+ u'\u03a0' # 0x57 -> GREEK CAPITAL LETTER PI
+ u'\u03a1' # 0x58 -> GREEK CAPITAL LETTER RHO
+ u'\u03a3' # 0x59 -> GREEK CAPITAL LETTER SIGMA
+ u']' # 0x5A -> RIGHT SQUARE BRACKET
+ u'$' # 0x5B -> DOLLAR SIGN
+ u'*' # 0x5C -> ASTERISK
+ u')' # 0x5D -> RIGHT PARENTHESIS
+ u';' # 0x5E -> SEMICOLON
+ u'^' # 0x5F -> CIRCUMFLEX ACCENT
+ u'-' # 0x60 -> HYPHEN-MINUS
+ u'/' # 0x61 -> SOLIDUS
+ u'\u03a4' # 0x62 -> GREEK CAPITAL LETTER TAU
+ u'\u03a5' # 0x63 -> GREEK CAPITAL LETTER UPSILON
+ u'\u03a6' # 0x64 -> GREEK CAPITAL LETTER PHI
+ u'\u03a7' # 0x65 -> GREEK CAPITAL LETTER CHI
+ u'\u03a8' # 0x66 -> GREEK CAPITAL LETTER PSI
+ u'\u03a9' # 0x67 -> GREEK CAPITAL LETTER OMEGA
+ u'\u03aa' # 0x68 -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA
+ u'\u03ab' # 0x69 -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
+ u'|' # 0x6A -> VERTICAL LINE
+ u',' # 0x6B -> COMMA
+ u'%' # 0x6C -> PERCENT SIGN
+ u'_' # 0x6D -> LOW LINE
+ u'>' # 0x6E -> GREATER-THAN SIGN
+ u'?' # 0x6F -> QUESTION MARK
+ u'\xa8' # 0x70 -> DIAERESIS
+ u'\u0386' # 0x71 -> GREEK CAPITAL LETTER ALPHA WITH TONOS
+ u'\u0388' # 0x72 -> GREEK CAPITAL LETTER EPSILON WITH TONOS
+ u'\u0389' # 0x73 -> GREEK CAPITAL LETTER ETA WITH TONOS
+ u'\xa0' # 0x74 -> NO-BREAK SPACE
+ u'\u038a' # 0x75 -> GREEK CAPITAL LETTER IOTA WITH TONOS
+ u'\u038c' # 0x76 -> GREEK CAPITAL LETTER OMICRON WITH TONOS
+ u'\u038e' # 0x77 -> GREEK CAPITAL LETTER UPSILON WITH TONOS
+ u'\u038f' # 0x78 -> GREEK CAPITAL LETTER OMEGA WITH TONOS
+ u'`' # 0x79 -> GRAVE ACCENT
+ u':' # 0x7A -> COLON
+ u'#' # 0x7B -> NUMBER SIGN
+ u'@' # 0x7C -> COMMERCIAL AT
+ u"'" # 0x7D -> APOSTROPHE
+ u'=' # 0x7E -> EQUALS SIGN
+ u'"' # 0x7F -> QUOTATION MARK
+ u'\u0385' # 0x80 -> GREEK DIALYTIKA TONOS
+ u'a' # 0x81 -> LATIN SMALL LETTER A
+ u'b' # 0x82 -> LATIN SMALL LETTER B
+ u'c' # 0x83 -> LATIN SMALL LETTER C
+ u'd' # 0x84 -> LATIN SMALL LETTER D
+ u'e' # 0x85 -> LATIN SMALL LETTER E
+ u'f' # 0x86 -> LATIN SMALL LETTER F
+ u'g' # 0x87 -> LATIN SMALL LETTER G
+ u'h' # 0x88 -> LATIN SMALL LETTER H
+ u'i' # 0x89 -> LATIN SMALL LETTER I
+ u'\u03b1' # 0x8A -> GREEK SMALL LETTER ALPHA
+ u'\u03b2' # 0x8B -> GREEK SMALL LETTER BETA
+ u'\u03b3' # 0x8C -> GREEK SMALL LETTER GAMMA
+ u'\u03b4' # 0x8D -> GREEK SMALL LETTER DELTA
+ u'\u03b5' # 0x8E -> GREEK SMALL LETTER EPSILON
+ u'\u03b6' # 0x8F -> GREEK SMALL LETTER ZETA
+ u'\xb0' # 0x90 -> DEGREE SIGN
+ u'j' # 0x91 -> LATIN SMALL LETTER J
+ u'k' # 0x92 -> LATIN SMALL LETTER K
+ u'l' # 0x93 -> LATIN SMALL LETTER L
+ u'm' # 0x94 -> LATIN SMALL LETTER M
+ u'n' # 0x95 -> LATIN SMALL LETTER N
+ u'o' # 0x96 -> LATIN SMALL LETTER O
+ u'p' # 0x97 -> LATIN SMALL LETTER P
+ u'q' # 0x98 -> LATIN SMALL LETTER Q
+ u'r' # 0x99 -> LATIN SMALL LETTER R
+ u'\u03b7' # 0x9A -> GREEK SMALL LETTER ETA
+ u'\u03b8' # 0x9B -> GREEK SMALL LETTER THETA
+ u'\u03b9' # 0x9C -> GREEK SMALL LETTER IOTA
+ u'\u03ba' # 0x9D -> GREEK SMALL LETTER KAPPA
+ u'\u03bb' # 0x9E -> GREEK SMALL LETTER LAMDA
+ u'\u03bc' # 0x9F -> GREEK SMALL LETTER MU
+ u'\xb4' # 0xA0 -> ACUTE ACCENT
+ u'~' # 0xA1 -> TILDE
+ u's' # 0xA2 -> LATIN SMALL LETTER S
+ u't' # 0xA3 -> LATIN SMALL LETTER T
+ u'u' # 0xA4 -> LATIN SMALL LETTER U
+ u'v' # 0xA5 -> LATIN SMALL LETTER V
+ u'w' # 0xA6 -> LATIN SMALL LETTER W
+ u'x' # 0xA7 -> LATIN SMALL LETTER X
+ u'y' # 0xA8 -> LATIN SMALL LETTER Y
+ u'z' # 0xA9 -> LATIN SMALL LETTER Z
+ u'\u03bd' # 0xAA -> GREEK SMALL LETTER NU
+ u'\u03be' # 0xAB -> GREEK SMALL LETTER XI
+ u'\u03bf' # 0xAC -> GREEK SMALL LETTER OMICRON
+ u'\u03c0' # 0xAD -> GREEK SMALL LETTER PI
+ u'\u03c1' # 0xAE -> GREEK SMALL LETTER RHO
+ u'\u03c3' # 0xAF -> GREEK SMALL LETTER SIGMA
+ u'\xa3' # 0xB0 -> POUND SIGN
+ u'\u03ac' # 0xB1 -> GREEK SMALL LETTER ALPHA WITH TONOS
+ u'\u03ad' # 0xB2 -> GREEK SMALL LETTER EPSILON WITH TONOS
+ u'\u03ae' # 0xB3 -> GREEK SMALL LETTER ETA WITH TONOS
+ u'\u03ca' # 0xB4 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA
+ u'\u03af' # 0xB5 -> GREEK SMALL LETTER IOTA WITH TONOS
+ u'\u03cc' # 0xB6 -> GREEK SMALL LETTER OMICRON WITH TONOS
+ u'\u03cd' # 0xB7 -> GREEK SMALL LETTER UPSILON WITH TONOS
+ u'\u03cb' # 0xB8 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA
+ u'\u03ce' # 0xB9 -> GREEK SMALL LETTER OMEGA WITH TONOS
+ u'\u03c2' # 0xBA -> GREEK SMALL LETTER FINAL SIGMA
+ u'\u03c4' # 0xBB -> GREEK SMALL LETTER TAU
+ u'\u03c5' # 0xBC -> GREEK SMALL LETTER UPSILON
+ u'\u03c6' # 0xBD -> GREEK SMALL LETTER PHI
+ u'\u03c7' # 0xBE -> GREEK SMALL LETTER CHI
+ u'\u03c8' # 0xBF -> GREEK SMALL LETTER PSI
+ u'{' # 0xC0 -> LEFT CURLY BRACKET
+ u'A' # 0xC1 -> LATIN CAPITAL LETTER A
+ u'B' # 0xC2 -> LATIN CAPITAL LETTER B
+ u'C' # 0xC3 -> LATIN CAPITAL LETTER C
+ u'D' # 0xC4 -> LATIN CAPITAL LETTER D
+ u'E' # 0xC5 -> LATIN CAPITAL LETTER E
+ u'F' # 0xC6 -> LATIN CAPITAL LETTER F
+ u'G' # 0xC7 -> LATIN CAPITAL LETTER G
+ u'H' # 0xC8 -> LATIN CAPITAL LETTER H
+ u'I' # 0xC9 -> LATIN CAPITAL LETTER I
+ u'\xad' # 0xCA -> SOFT HYPHEN
+ u'\u03c9' # 0xCB -> GREEK SMALL LETTER OMEGA
+ u'\u0390' # 0xCC -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS
+ u'\u03b0' # 0xCD -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS
+ u'\u2018' # 0xCE -> LEFT SINGLE QUOTATION MARK
+ u'\u2015' # 0xCF -> HORIZONTAL BAR
+ u'}' # 0xD0 -> RIGHT CURLY BRACKET
+ u'J' # 0xD1 -> LATIN CAPITAL LETTER J
+ u'K' # 0xD2 -> LATIN CAPITAL LETTER K
+ u'L' # 0xD3 -> LATIN CAPITAL LETTER L
+ u'M' # 0xD4 -> LATIN CAPITAL LETTER M
+ u'N' # 0xD5 -> LATIN CAPITAL LETTER N
+ u'O' # 0xD6 -> LATIN CAPITAL LETTER O
+ u'P' # 0xD7 -> LATIN CAPITAL LETTER P
+ u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q
+ u'R' # 0xD9 -> LATIN CAPITAL LETTER R
+ u'\xb1' # 0xDA -> PLUS-MINUS SIGN
+ u'\xbd' # 0xDB -> VULGAR FRACTION ONE HALF
+ u'\x1a' # 0xDC -> SUBSTITUTE
+ u'\u0387' # 0xDD -> GREEK ANO TELEIA
+ u'\u2019' # 0xDE -> RIGHT SINGLE QUOTATION MARK
+ u'\xa6' # 0xDF -> BROKEN BAR
+ u'\\' # 0xE0 -> REVERSE SOLIDUS
+ u'\x1a' # 0xE1 -> SUBSTITUTE
+ u'S' # 0xE2 -> LATIN CAPITAL LETTER S
+ u'T' # 0xE3 -> LATIN CAPITAL LETTER T
+ u'U' # 0xE4 -> LATIN CAPITAL LETTER U
+ u'V' # 0xE5 -> LATIN CAPITAL LETTER V
+ u'W' # 0xE6 -> LATIN CAPITAL LETTER W
+ u'X' # 0xE7 -> LATIN CAPITAL LETTER X
+ u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z
+ u'\xb2' # 0xEA -> SUPERSCRIPT TWO
+ u'\xa7' # 0xEB -> SECTION SIGN
+ u'\x1a' # 0xEC -> SUBSTITUTE
+ u'\x1a' # 0xED -> SUBSTITUTE
+ u'\xab' # 0xEE -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xac' # 0xEF -> NOT SIGN
+ u'0' # 0xF0 -> DIGIT ZERO
+ u'1' # 0xF1 -> DIGIT ONE
+ u'2' # 0xF2 -> DIGIT TWO
+ u'3' # 0xF3 -> DIGIT THREE
+ u'4' # 0xF4 -> DIGIT FOUR
+ u'5' # 0xF5 -> DIGIT FIVE
+ u'6' # 0xF6 -> DIGIT SIX
+ u'7' # 0xF7 -> DIGIT SEVEN
+ u'8' # 0xF8 -> DIGIT EIGHT
+ u'9' # 0xF9 -> DIGIT NINE
+ u'\xb3' # 0xFA -> SUPERSCRIPT THREE
+ u'\xa9' # 0xFB -> COPYRIGHT SIGN
+ u'\x1a' # 0xFC -> SUBSTITUTE
+ u'\x1a' # 0xFD -> SUBSTITUTE
+ u'\xbb' # 0xFE -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\x9f' # 0xFF -> CONTROL
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..6321c2043f
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp932.py
@@ -0,0 +1,39 @@
+#
+# cp932.py: Python Unicode Codec for CP932
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_jp, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_jp.getcodec('cp932')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp932',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..1d9725decf
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp949.py
@@ -0,0 +1,39 @@
+#
+# cp949.py: Python Unicode Codec for CP949
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_kr, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_kr.getcodec('cp949')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp949',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..e7772b1592
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp950.py
@@ -0,0 +1,39 @@
+#
+# cp950.py: Python Unicode Codec for CP950
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_tw, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_tw.getcodec('cp950')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='cp950',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..bb35520069
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jis_2004.py
@@ -0,0 +1,39 @@
+#
+# euc_jis_2004.py: Python Unicode Codec for EUC_JIS_2004
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_jp, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_jp.getcodec('euc_jis_2004')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='euc_jis_2004',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..9914c4feb0
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jisx0213.py
@@ -0,0 +1,39 @@
+#
+# euc_jisx0213.py: Python Unicode Codec for EUC_JISX0213
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_jp, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_jp.getcodec('euc_jisx0213')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='euc_jisx0213',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..29406b6e2c
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jp.py
@@ -0,0 +1,39 @@
+#
+# euc_jp.py: Python Unicode Codec for EUC_JP
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_jp, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_jp.getcodec('euc_jp')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='euc_jp',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..7d5eca4e2f
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_kr.py
@@ -0,0 +1,39 @@
+#
+# euc_kr.py: Python Unicode Codec for EUC_KR
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_kr, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_kr.getcodec('euc_kr')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='euc_kr',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..99059ffdc2
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gb18030.py
@@ -0,0 +1,39 @@
+#
+# gb18030.py: Python Unicode Codec for GB18030
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_cn, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_cn.getcodec('gb18030')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='gb18030',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..4e396fa7f9
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gb2312.py
@@ -0,0 +1,39 @@
+#
+# gb2312.py: Python Unicode Codec for GB2312
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_cn, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_cn.getcodec('gb2312')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='gb2312',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..0fd27341e9
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gbk.py
@@ -0,0 +1,39 @@
+#
+# gbk.py: Python Unicode Codec for GBK
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_cn, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_cn.getcodec('gbk')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='gbk',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..5262bffd13
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hex_codec.py
@@ -0,0 +1,79 @@
+""" Python 'hex_codec' Codec - 2-digit hex content transfer encoding
+
+ Unlike most of the other codecs which target Unicode, this codec
+ will return Python string objects for both encode and decode.
+
+ Written by Marc-Andre Lemburg (mal@lemburg.com).
+
+"""
+import codecs, binascii
+
+### Codec APIs
+
+def hex_encode(input,errors='strict'):
+
+ """ Encodes the object input and returns a tuple (output
+ object, length consumed).
+
+ errors defines the error handling to apply. It defaults to
+ 'strict' handling which is the only currently supported
+ error handling for this codec.
+
+ """
+ assert errors == 'strict'
+ output = binascii.b2a_hex(input)
+ return (output, len(input))
+
+def hex_decode(input,errors='strict'):
+
+ """ Decodes the object input and returns a tuple (output
+ object, length consumed).
+
+ input must be an object which provides the bf_getreadbuf
+ buffer slot. Python strings, buffer objects and memory
+ mapped files are examples of objects providing this slot.
+
+ errors defines the error handling to apply. It defaults to
+ 'strict' handling which is the only currently supported
+ error handling for this codec.
+
+ """
+ assert errors == 'strict'
+ output = binascii.a2b_hex(input)
+ return (output, len(input))
+
+class Codec(codecs.Codec):
+
+ def encode(self, input,errors='strict'):
+ return hex_encode(input,errors)
+ def decode(self, input,errors='strict'):
+ return hex_decode(input,errors)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ assert self.errors == 'strict'
+ return binascii.b2a_hex(input)
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ assert self.errors == 'strict'
+ return binascii.a2b_hex(input)
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='hex',
+ encode=hex_encode,
+ decode=hex_decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamwriter=StreamWriter,
+ streamreader=StreamReader,
+ )
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
index 0000000000..70c1ccc54b
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hp_roman8.py
@@ -0,0 +1,152 @@
+""" Python Character Mapping Codec generated from 'hp_roman8.txt' with gencodec.py.
+
+ Based on data from ftp://dkuug.dk/i18n/charmaps/HP-ROMAN8 (Keld Simonsen)
+
+ Original source: LaserJet IIP Printer User's Manual HP part no
+ 33471-90901, Hewlet-Packard, June 1989.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_map)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_map)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='hp-roman8',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamwriter=StreamWriter,
+ streamreader=StreamReader,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x00a1: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE
+ 0x00a2: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ 0x00a3: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE
+ 0x00a4: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ 0x00a5: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS
+ 0x00a6: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ 0x00a7: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS
+ 0x00a8: 0x00b4, # ACUTE ACCENT
+ 0x00a9: 0x02cb, # MODIFIER LETTER GRAVE ACCENT (Mandarin Chinese fourth tone)
+ 0x00aa: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT
+ 0x00ab: 0x00a8, # DIAERESIS
+ 0x00ac: 0x02dc, # SMALL TILDE
+ 0x00ad: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE
+ 0x00ae: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ 0x00af: 0x20a4, # LIRA SIGN
+ 0x00b0: 0x00af, # MACRON
+ 0x00b1: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE
+ 0x00b2: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE
+ 0x00b3: 0x00b0, # DEGREE SIGN
+ 0x00b4: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x00b5: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x00b6: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE
+ 0x00b7: 0x00f1, # LATIN SMALL LETTER N WITH TILDE
+ 0x00b8: 0x00a1, # INVERTED EXCLAMATION MARK
+ 0x00b9: 0x00bf, # INVERTED QUESTION MARK
+ 0x00ba: 0x00a4, # CURRENCY SIGN
+ 0x00bb: 0x00a3, # POUND SIGN
+ 0x00bc: 0x00a5, # YEN SIGN
+ 0x00bd: 0x00a7, # SECTION SIGN
+ 0x00be: 0x0192, # LATIN SMALL LETTER F WITH HOOK
+ 0x00bf: 0x00a2, # CENT SIGN
+ 0x00c0: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x00c1: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX
+ 0x00c2: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x00c3: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX
+ 0x00c4: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00c5: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE
+ 0x00c6: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00c7: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00c8: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE
+ 0x00c9: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE
+ 0x00ca: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE
+ 0x00cb: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE
+ 0x00cc: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x00cd: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS
+ 0x00ce: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x00cf: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x00d0: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE
+ 0x00d1: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX
+ 0x00d2: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE
+ 0x00d3: 0x00c6, # LATIN CAPITAL LETTER AE
+ 0x00d4: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE
+ 0x00d5: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00d6: 0x00f8, # LATIN SMALL LETTER O WITH STROKE
+ 0x00d7: 0x00e6, # LATIN SMALL LETTER AE
+ 0x00d8: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x00d9: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE
+ 0x00da: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x00db: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x00dc: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x00dd: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS
+ 0x00de: 0x00df, # LATIN SMALL LETTER SHARP S (German)
+ 0x00df: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ 0x00e0: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE
+ 0x00e1: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE
+ 0x00e2: 0x00e3, # LATIN SMALL LETTER A WITH TILDE
+ 0x00e3: 0x00d0, # LATIN CAPITAL LETTER ETH (Icelandic)
+ 0x00e4: 0x00f0, # LATIN SMALL LETTER ETH (Icelandic)
+ 0x00e5: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE
+ 0x00e6: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE
+ 0x00e7: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE
+ 0x00e8: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE
+ 0x00e9: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE
+ 0x00ea: 0x00f5, # LATIN SMALL LETTER O WITH TILDE
+ 0x00eb: 0x0160, # LATIN CAPITAL LETTER S WITH CARON
+ 0x00ec: 0x0161, # LATIN SMALL LETTER S WITH CARON
+ 0x00ed: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE
+ 0x00ee: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS
+ 0x00ef: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS
+ 0x00f0: 0x00de, # LATIN CAPITAL LETTER THORN (Icelandic)
+ 0x00f1: 0x00fe, # LATIN SMALL LETTER THORN (Icelandic)
+ 0x00f2: 0x00b7, # MIDDLE DOT
+ 0x00f3: 0x00b5, # MICRO SIGN
+ 0x00f4: 0x00b6, # PILCROW SIGN
+ 0x00f5: 0x00be, # VULGAR FRACTION THREE QUARTERS
+ 0x00f6: 0x2014, # EM DASH
+ 0x00f7: 0x00bc, # VULGAR FRACTION ONE QUARTER
+ 0x00f8: 0x00bd, # VULGAR FRACTION ONE HALF
+ 0x00f9: 0x00aa, # FEMININE ORDINAL INDICATOR
+ 0x00fa: 0x00ba, # MASCULINE ORDINAL INDICATOR
+ 0x00fb: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00fc: 0x25a0, # BLACK SQUARE
+ 0x00fd: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00fe: 0x00b1, # PLUS-MINUS SIGN
+ 0x00ff: None,
+})
+
+### Encoding Map
+
+encoding_map = codecs.make_encoding_map(decoding_map)
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
index 0000000000..027c4fb504
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hz.py
@@ -0,0 +1,39 @@
+#
+# hz.py: Python Unicode Codec for HZ
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_cn, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_cn.getcodec('hz')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='hz',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..ecbf2bed3f
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/idna.py
@@ -0,0 +1,288 @@
+# This module implements the RFCs 3490 (IDNA) and 3491 (Nameprep)
+
+import stringprep, re, codecs
+from unicodedata import ucd_3_2_0 as unicodedata
+
+# IDNA section 3.1
+dots = re.compile(u"[\u002E\u3002\uFF0E\uFF61]")
+
+# IDNA section 5
+ace_prefix = "xn--"
+uace_prefix = unicode(ace_prefix, "ascii")
+
+# This assumes query strings, so AllowUnassigned is true
+def nameprep(label):
+ # Map
+ newlabel = []
+ for c in label:
+ if stringprep.in_table_b1(c):
+ # Map to nothing
+ continue
+ newlabel.append(stringprep.map_table_b2(c))
+ label = u"".join(newlabel)
+
+ # Normalize
+ label = unicodedata.normalize("NFKC", label)
+
+ # Prohibit
+ for c in label:
+ if stringprep.in_table_c12(c) or \
+ stringprep.in_table_c22(c) or \
+ stringprep.in_table_c3(c) or \
+ stringprep.in_table_c4(c) or \
+ stringprep.in_table_c5(c) or \
+ stringprep.in_table_c6(c) or \
+ stringprep.in_table_c7(c) or \
+ stringprep.in_table_c8(c) or \
+ stringprep.in_table_c9(c):
+ raise UnicodeError("Invalid character %r" % c)
+
+ # Check bidi
+ RandAL = map(stringprep.in_table_d1, label)
+ for c in RandAL:
+ if c:
+ # There is a RandAL char in the string. Must perform further
+ # tests:
+ # 1) The characters in section 5.8 MUST be prohibited.
+ # This is table C.8, which was already checked
+ # 2) If a string contains any RandALCat character, the string
+ # MUST NOT contain any LCat character.
+ if filter(stringprep.in_table_d2, label):
+ raise UnicodeError("Violation of BIDI requirement 2")
+
+ # 3) If a string contains any RandALCat character, a
+ # RandALCat character MUST be the first character of the
+ # string, and a RandALCat character MUST be the last
+ # character of the string.
+ if not RandAL[0] or not RandAL[-1]:
+ raise UnicodeError("Violation of BIDI requirement 3")
+
+ return label
+
+def ToASCII(label):
+ try:
+ # Step 1: try ASCII
+ label = label.encode("ascii")
+ except UnicodeError:
+ pass
+ else:
+ # Skip to step 3: UseSTD3ASCIIRules is false, so
+ # Skip to step 8.
+ if 0 < len(label) < 64:
+ return label
+ raise UnicodeError("label empty or too long")
+
+ # Step 2: nameprep
+ label = nameprep(label)
+
+ # Step 3: UseSTD3ASCIIRules is false
+ # Step 4: try ASCII
+ try:
+ label = label.encode("ascii")
+ except UnicodeError:
+ pass
+ else:
+ # Skip to step 8.
+ if 0 < len(label) < 64:
+ return label
+ raise UnicodeError("label empty or too long")
+
+ # Step 5: Check ACE prefix
+ if label.startswith(uace_prefix):
+ raise UnicodeError("Label starts with ACE prefix")
+
+ # Step 6: Encode with PUNYCODE
+ label = label.encode("punycode")
+
+ # Step 7: Prepend ACE prefix
+ label = ace_prefix + label
+
+ # Step 8: Check size
+ if 0 < len(label) < 64:
+ return label
+ raise UnicodeError("label empty or too long")
+
+def ToUnicode(label):
+ # Step 1: Check for ASCII
+ if isinstance(label, str):
+ pure_ascii = True
+ else:
+ try:
+ label = label.encode("ascii")
+ pure_ascii = True
+ except UnicodeError:
+ pure_ascii = False
+ if not pure_ascii:
+ # Step 2: Perform nameprep
+ label = nameprep(label)
+ # It doesn't say this, but apparently, it should be ASCII now
+ try:
+ label = label.encode("ascii")
+ except UnicodeError:
+ raise UnicodeError("Invalid character in IDN label")
+ # Step 3: Check for ACE prefix
+ if not label.startswith(ace_prefix):
+ return unicode(label, "ascii")
+
+ # Step 4: Remove ACE prefix
+ label1 = label[len(ace_prefix):]
+
+ # Step 5: Decode using PUNYCODE
+ result = label1.decode("punycode")
+
+ # Step 6: Apply ToASCII
+ label2 = ToASCII(result)
+
+ # Step 7: Compare the result of step 6 with the one of step 3
+ # label2 will already be in lower case.
+ if label.lower() != label2:
+ raise UnicodeError("IDNA does not round-trip", label, label2)
+
+ # Step 8: return the result of step 5
+ return result
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+ def encode(self,input,errors='strict'):
+
+ if errors != 'strict':
+ # IDNA is quite clear that implementations must be strict
+ raise UnicodeError("unsupported error handling "+errors)
+
+ if not input:
+ return "", 0
+
+ result = []
+ labels = dots.split(input)
+ if labels and len(labels[-1])==0:
+ trailing_dot = '.'
+ del labels[-1]
+ else:
+ trailing_dot = ''
+ for label in labels:
+ result.append(ToASCII(label))
+ # Join with U+002E
+ return ".".join(result)+trailing_dot, len(input)
+
+ def decode(self,input,errors='strict'):
+
+ if errors != 'strict':
+ raise UnicodeError("Unsupported error handling "+errors)
+
+ if not input:
+ return u"", 0
+
+ # IDNA allows decoding to operate on Unicode strings, too.
+ if isinstance(input, unicode):
+ labels = dots.split(input)
+ else:
+ # Must be ASCII string
+ input = str(input)
+ unicode(input, "ascii")
+ labels = input.split(".")
+
+ if labels and len(labels[-1]) == 0:
+ trailing_dot = u'.'
+ del labels[-1]
+ else:
+ trailing_dot = u''
+
+ result = []
+ for label in labels:
+ result.append(ToUnicode(label))
+
+ return u".".join(result)+trailing_dot, len(input)
+
+class IncrementalEncoder(codecs.BufferedIncrementalEncoder):
+ def _buffer_encode(self, input, errors, final):
+ if errors != 'strict':
+ # IDNA is quite clear that implementations must be strict
+ raise UnicodeError("unsupported error handling "+errors)
+
+ if not input:
+ return ("", 0)
+
+ labels = dots.split(input)
+ trailing_dot = u''
+ if labels:
+ if not labels[-1]:
+ trailing_dot = '.'
+ del labels[-1]
+ elif not final:
+ # Keep potentially unfinished label until the next call
+ del labels[-1]
+ if labels:
+ trailing_dot = '.'
+
+ result = []
+ size = 0
+ for label in labels:
+ result.append(ToASCII(label))
+ if size:
+ size += 1
+ size += len(label)
+
+ # Join with U+002E
+ result = ".".join(result) + trailing_dot
+ size += len(trailing_dot)
+ return (result, size)
+
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
+ def _buffer_decode(self, input, errors, final):
+ if errors != 'strict':
+ raise UnicodeError("Unsupported error handling "+errors)
+
+ if not input:
+ return (u"", 0)
+
+ # IDNA allows decoding to operate on Unicode strings, too.
+ if isinstance(input, unicode):
+ labels = dots.split(input)
+ else:
+ # Must be ASCII string
+ input = str(input)
+ unicode(input, "ascii")
+ labels = input.split(".")
+
+ trailing_dot = u''
+ if labels:
+ if not labels[-1]:
+ trailing_dot = u'.'
+ del labels[-1]
+ elif not final:
+ # Keep potentially unfinished label until the next call
+ del labels[-1]
+ if labels:
+ trailing_dot = u'.'
+
+ result = []
+ size = 0
+ for label in labels:
+ result.append(ToUnicode(label))
+ if size:
+ size += 1
+ size += len(label)
+
+ result = u".".join(result) + trailing_dot
+ size += len(trailing_dot)
+ return (result, size)
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='idna',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamwriter=StreamWriter,
+ streamreader=StreamReader,
+ )
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
index 0000000000..34719998cd
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp.py
@@ -0,0 +1,39 @@
+#
+# iso2022_jp.py: Python Unicode Codec for ISO2022_JP
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_iso2022, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_iso2022.getcodec('iso2022_jp')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso2022_jp',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..8b04b847da
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_1.py
@@ -0,0 +1,39 @@
+#
+# iso2022_jp_1.py: Python Unicode Codec for ISO2022_JP_1
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_iso2022, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_iso2022.getcodec('iso2022_jp_1')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso2022_jp_1',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..df926736c2
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_2.py
@@ -0,0 +1,39 @@
+#
+# iso2022_jp_2.py: Python Unicode Codec for ISO2022_JP_2
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_iso2022, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_iso2022.getcodec('iso2022_jp_2')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso2022_jp_2',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..138e628632
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_2004.py
@@ -0,0 +1,39 @@
+#
+# iso2022_jp_2004.py: Python Unicode Codec for ISO2022_JP_2004
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_iso2022, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_iso2022.getcodec('iso2022_jp_2004')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso2022_jp_2004',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..5fd5825650
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_3.py
@@ -0,0 +1,39 @@
+#
+# iso2022_jp_3.py: Python Unicode Codec for ISO2022_JP_3
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_iso2022, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_iso2022.getcodec('iso2022_jp_3')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso2022_jp_3',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..4ac8a0c501
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_ext.py
@@ -0,0 +1,39 @@
+#
+# iso2022_jp_ext.py: Python Unicode Codec for ISO2022_JP_EXT
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_iso2022, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_iso2022.getcodec('iso2022_jp_ext')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso2022_jp_ext',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..3dfe986c3a
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_kr.py
@@ -0,0 +1,39 @@
+#
+# iso2022_kr.py: Python Unicode Codec for ISO2022_KR
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_iso2022, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_iso2022.getcodec('iso2022_kr')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso2022_kr',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..7f6be30c86
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_1.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_1 generated from 'MAPPINGS/ISO8859/8859-1.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso8859-1',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\x80' # 0x80 -> <control>
+ u'\x81' # 0x81 -> <control>
+ u'\x82' # 0x82 -> <control>
+ u'\x83' # 0x83 -> <control>
+ u'\x84' # 0x84 -> <control>
+ u'\x85' # 0x85 -> <control>
+ u'\x86' # 0x86 -> <control>
+ u'\x87' # 0x87 -> <control>
+ u'\x88' # 0x88 -> <control>
+ u'\x89' # 0x89 -> <control>
+ u'\x8a' # 0x8A -> <control>
+ u'\x8b' # 0x8B -> <control>
+ u'\x8c' # 0x8C -> <control>
+ u'\x8d' # 0x8D -> <control>
+ u'\x8e' # 0x8E -> <control>
+ u'\x8f' # 0x8F -> <control>
+ u'\x90' # 0x90 -> <control>
+ u'\x91' # 0x91 -> <control>
+ u'\x92' # 0x92 -> <control>
+ u'\x93' # 0x93 -> <control>
+ u'\x94' # 0x94 -> <control>
+ u'\x95' # 0x95 -> <control>
+ u'\x96' # 0x96 -> <control>
+ u'\x97' # 0x97 -> <control>
+ u'\x98' # 0x98 -> <control>
+ u'\x99' # 0x99 -> <control>
+ u'\x9a' # 0x9A -> <control>
+ u'\x9b' # 0x9B -> <control>
+ u'\x9c' # 0x9C -> <control>
+ u'\x9d' # 0x9D -> <control>
+ u'\x9e' # 0x9E -> <control>
+ u'\x9f' # 0x9F -> <control>
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK
+ u'\xa2' # 0xA2 -> CENT SIGN
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\xa4' # 0xA4 -> CURRENCY SIGN
+ u'\xa5' # 0xA5 -> YEN SIGN
+ u'\xa6' # 0xA6 -> BROKEN BAR
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\xa8' # 0xA8 -> DIAERESIS
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR
+ u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xac' # 0xAC -> NOT SIGN
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\xae' # 0xAE -> REGISTERED SIGN
+ u'\xaf' # 0xAF -> MACRON
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\xb2' # 0xB2 -> SUPERSCRIPT TWO
+ u'\xb3' # 0xB3 -> SUPERSCRIPT THREE
+ u'\xb4' # 0xB4 -> ACUTE ACCENT
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xb7' # 0xB7 -> MIDDLE DOT
+ u'\xb8' # 0xB8 -> CEDILLA
+ u'\xb9' # 0xB9 -> SUPERSCRIPT ONE
+ u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR
+ u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER
+ u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF
+ u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS
+ u'\xbf' # 0xBF -> INVERTED QUESTION MARK
+ u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE
+ u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\xd0' # 0xD0 -> LATIN CAPITAL LETTER ETH (Icelandic)
+ u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xd7' # 0xD7 -> MULTIPLICATION SIGN
+ u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE
+ u'\xde' # 0xDE -> LATIN CAPITAL LETTER THORN (Icelandic)
+ u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S (German)
+ u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE
+ u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE
+ u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xf0' # 0xF0 -> LATIN SMALL LETTER ETH (Icelandic)
+ u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE
+ u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf7' # 0xF7 -> DIVISION SIGN
+ u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE
+ u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE
+ u'\xfe' # 0xFE -> LATIN SMALL LETTER THORN (Icelandic)
+ u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..d2a7a512d7
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_10.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_10 generated from 'MAPPINGS/ISO8859/8859-10.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso8859-10',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\x80' # 0x80 -> <control>
+ u'\x81' # 0x81 -> <control>
+ u'\x82' # 0x82 -> <control>
+ u'\x83' # 0x83 -> <control>
+ u'\x84' # 0x84 -> <control>
+ u'\x85' # 0x85 -> <control>
+ u'\x86' # 0x86 -> <control>
+ u'\x87' # 0x87 -> <control>
+ u'\x88' # 0x88 -> <control>
+ u'\x89' # 0x89 -> <control>
+ u'\x8a' # 0x8A -> <control>
+ u'\x8b' # 0x8B -> <control>
+ u'\x8c' # 0x8C -> <control>
+ u'\x8d' # 0x8D -> <control>
+ u'\x8e' # 0x8E -> <control>
+ u'\x8f' # 0x8F -> <control>
+ u'\x90' # 0x90 -> <control>
+ u'\x91' # 0x91 -> <control>
+ u'\x92' # 0x92 -> <control>
+ u'\x93' # 0x93 -> <control>
+ u'\x94' # 0x94 -> <control>
+ u'\x95' # 0x95 -> <control>
+ u'\x96' # 0x96 -> <control>
+ u'\x97' # 0x97 -> <control>
+ u'\x98' # 0x98 -> <control>
+ u'\x99' # 0x99 -> <control>
+ u'\x9a' # 0x9A -> <control>
+ u'\x9b' # 0x9B -> <control>
+ u'\x9c' # 0x9C -> <control>
+ u'\x9d' # 0x9D -> <control>
+ u'\x9e' # 0x9E -> <control>
+ u'\x9f' # 0x9F -> <control>
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\u0104' # 0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK
+ u'\u0112' # 0xA2 -> LATIN CAPITAL LETTER E WITH MACRON
+ u'\u0122' # 0xA3 -> LATIN CAPITAL LETTER G WITH CEDILLA
+ u'\u012a' # 0xA4 -> LATIN CAPITAL LETTER I WITH MACRON
+ u'\u0128' # 0xA5 -> LATIN CAPITAL LETTER I WITH TILDE
+ u'\u0136' # 0xA6 -> LATIN CAPITAL LETTER K WITH CEDILLA
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\u013b' # 0xA8 -> LATIN CAPITAL LETTER L WITH CEDILLA
+ u'\u0110' # 0xA9 -> LATIN CAPITAL LETTER D WITH STROKE
+ u'\u0160' # 0xAA -> LATIN CAPITAL LETTER S WITH CARON
+ u'\u0166' # 0xAB -> LATIN CAPITAL LETTER T WITH STROKE
+ u'\u017d' # 0xAC -> LATIN CAPITAL LETTER Z WITH CARON
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\u016a' # 0xAE -> LATIN CAPITAL LETTER U WITH MACRON
+ u'\u014a' # 0xAF -> LATIN CAPITAL LETTER ENG
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\u0105' # 0xB1 -> LATIN SMALL LETTER A WITH OGONEK
+ u'\u0113' # 0xB2 -> LATIN SMALL LETTER E WITH MACRON
+ u'\u0123' # 0xB3 -> LATIN SMALL LETTER G WITH CEDILLA
+ u'\u012b' # 0xB4 -> LATIN SMALL LETTER I WITH MACRON
+ u'\u0129' # 0xB5 -> LATIN SMALL LETTER I WITH TILDE
+ u'\u0137' # 0xB6 -> LATIN SMALL LETTER K WITH CEDILLA
+ u'\xb7' # 0xB7 -> MIDDLE DOT
+ u'\u013c' # 0xB8 -> LATIN SMALL LETTER L WITH CEDILLA
+ u'\u0111' # 0xB9 -> LATIN SMALL LETTER D WITH STROKE
+ u'\u0161' # 0xBA -> LATIN SMALL LETTER S WITH CARON
+ u'\u0167' # 0xBB -> LATIN SMALL LETTER T WITH STROKE
+ u'\u017e' # 0xBC -> LATIN SMALL LETTER Z WITH CARON
+ u'\u2015' # 0xBD -> HORIZONTAL BAR
+ u'\u016b' # 0xBE -> LATIN SMALL LETTER U WITH MACRON
+ u'\u014b' # 0xBF -> LATIN SMALL LETTER ENG
+ u'\u0100' # 0xC0 -> LATIN CAPITAL LETTER A WITH MACRON
+ u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE
+ u'\u012e' # 0xC7 -> LATIN CAPITAL LETTER I WITH OGONEK
+ u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON
+ u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\u0118' # 0xCA -> LATIN CAPITAL LETTER E WITH OGONEK
+ u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\u0116' # 0xCC -> LATIN CAPITAL LETTER E WITH DOT ABOVE
+ u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\xd0' # 0xD0 -> LATIN CAPITAL LETTER ETH (Icelandic)
+ u'\u0145' # 0xD1 -> LATIN CAPITAL LETTER N WITH CEDILLA
+ u'\u014c' # 0xD2 -> LATIN CAPITAL LETTER O WITH MACRON
+ u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\u0168' # 0xD7 -> LATIN CAPITAL LETTER U WITH TILDE
+ u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\u0172' # 0xD9 -> LATIN CAPITAL LETTER U WITH OGONEK
+ u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE
+ u'\xde' # 0xDE -> LATIN CAPITAL LETTER THORN (Icelandic)
+ u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S (German)
+ u'\u0101' # 0xE0 -> LATIN SMALL LETTER A WITH MACRON
+ u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE
+ u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE
+ u'\u012f' # 0xE7 -> LATIN SMALL LETTER I WITH OGONEK
+ u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON
+ u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\u0119' # 0xEA -> LATIN SMALL LETTER E WITH OGONEK
+ u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\u0117' # 0xEC -> LATIN SMALL LETTER E WITH DOT ABOVE
+ u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xf0' # 0xF0 -> LATIN SMALL LETTER ETH (Icelandic)
+ u'\u0146' # 0xF1 -> LATIN SMALL LETTER N WITH CEDILLA
+ u'\u014d' # 0xF2 -> LATIN SMALL LETTER O WITH MACRON
+ u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE
+ u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\u0169' # 0xF7 -> LATIN SMALL LETTER U WITH TILDE
+ u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE
+ u'\u0173' # 0xF9 -> LATIN SMALL LETTER U WITH OGONEK
+ u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE
+ u'\xfe' # 0xFE -> LATIN SMALL LETTER THORN (Icelandic)
+ u'\u0138' # 0xFF -> LATIN SMALL LETTER KRA
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..2f6252a82a
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_11.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_11 generated from 'MAPPINGS/ISO8859/8859-11.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso8859-11',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\x80' # 0x80 -> <control>
+ u'\x81' # 0x81 -> <control>
+ u'\x82' # 0x82 -> <control>
+ u'\x83' # 0x83 -> <control>
+ u'\x84' # 0x84 -> <control>
+ u'\x85' # 0x85 -> <control>
+ u'\x86' # 0x86 -> <control>
+ u'\x87' # 0x87 -> <control>
+ u'\x88' # 0x88 -> <control>
+ u'\x89' # 0x89 -> <control>
+ u'\x8a' # 0x8A -> <control>
+ u'\x8b' # 0x8B -> <control>
+ u'\x8c' # 0x8C -> <control>
+ u'\x8d' # 0x8D -> <control>
+ u'\x8e' # 0x8E -> <control>
+ u'\x8f' # 0x8F -> <control>
+ u'\x90' # 0x90 -> <control>
+ u'\x91' # 0x91 -> <control>
+ u'\x92' # 0x92 -> <control>
+ u'\x93' # 0x93 -> <control>
+ u'\x94' # 0x94 -> <control>
+ u'\x95' # 0x95 -> <control>
+ u'\x96' # 0x96 -> <control>
+ u'\x97' # 0x97 -> <control>
+ u'\x98' # 0x98 -> <control>
+ u'\x99' # 0x99 -> <control>
+ u'\x9a' # 0x9A -> <control>
+ u'\x9b' # 0x9B -> <control>
+ u'\x9c' # 0x9C -> <control>
+ u'\x9d' # 0x9D -> <control>
+ u'\x9e' # 0x9E -> <control>
+ u'\x9f' # 0x9F -> <control>
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\u0e01' # 0xA1 -> THAI CHARACTER KO KAI
+ u'\u0e02' # 0xA2 -> THAI CHARACTER KHO KHAI
+ u'\u0e03' # 0xA3 -> THAI CHARACTER KHO KHUAT
+ u'\u0e04' # 0xA4 -> THAI CHARACTER KHO KHWAI
+ u'\u0e05' # 0xA5 -> THAI CHARACTER KHO KHON
+ u'\u0e06' # 0xA6 -> THAI CHARACTER KHO RAKHANG
+ u'\u0e07' # 0xA7 -> THAI CHARACTER NGO NGU
+ u'\u0e08' # 0xA8 -> THAI CHARACTER CHO CHAN
+ u'\u0e09' # 0xA9 -> THAI CHARACTER CHO CHING
+ u'\u0e0a' # 0xAA -> THAI CHARACTER CHO CHANG
+ u'\u0e0b' # 0xAB -> THAI CHARACTER SO SO
+ u'\u0e0c' # 0xAC -> THAI CHARACTER CHO CHOE
+ u'\u0e0d' # 0xAD -> THAI CHARACTER YO YING
+ u'\u0e0e' # 0xAE -> THAI CHARACTER DO CHADA
+ u'\u0e0f' # 0xAF -> THAI CHARACTER TO PATAK
+ u'\u0e10' # 0xB0 -> THAI CHARACTER THO THAN
+ u'\u0e11' # 0xB1 -> THAI CHARACTER THO NANGMONTHO
+ u'\u0e12' # 0xB2 -> THAI CHARACTER THO PHUTHAO
+ u'\u0e13' # 0xB3 -> THAI CHARACTER NO NEN
+ u'\u0e14' # 0xB4 -> THAI CHARACTER DO DEK
+ u'\u0e15' # 0xB5 -> THAI CHARACTER TO TAO
+ u'\u0e16' # 0xB6 -> THAI CHARACTER THO THUNG
+ u'\u0e17' # 0xB7 -> THAI CHARACTER THO THAHAN
+ u'\u0e18' # 0xB8 -> THAI CHARACTER THO THONG
+ u'\u0e19' # 0xB9 -> THAI CHARACTER NO NU
+ u'\u0e1a' # 0xBA -> THAI CHARACTER BO BAIMAI
+ u'\u0e1b' # 0xBB -> THAI CHARACTER PO PLA
+ u'\u0e1c' # 0xBC -> THAI CHARACTER PHO PHUNG
+ u'\u0e1d' # 0xBD -> THAI CHARACTER FO FA
+ u'\u0e1e' # 0xBE -> THAI CHARACTER PHO PHAN
+ u'\u0e1f' # 0xBF -> THAI CHARACTER FO FAN
+ u'\u0e20' # 0xC0 -> THAI CHARACTER PHO SAMPHAO
+ u'\u0e21' # 0xC1 -> THAI CHARACTER MO MA
+ u'\u0e22' # 0xC2 -> THAI CHARACTER YO YAK
+ u'\u0e23' # 0xC3 -> THAI CHARACTER RO RUA
+ u'\u0e24' # 0xC4 -> THAI CHARACTER RU
+ u'\u0e25' # 0xC5 -> THAI CHARACTER LO LING
+ u'\u0e26' # 0xC6 -> THAI CHARACTER LU
+ u'\u0e27' # 0xC7 -> THAI CHARACTER WO WAEN
+ u'\u0e28' # 0xC8 -> THAI CHARACTER SO SALA
+ u'\u0e29' # 0xC9 -> THAI CHARACTER SO RUSI
+ u'\u0e2a' # 0xCA -> THAI CHARACTER SO SUA
+ u'\u0e2b' # 0xCB -> THAI CHARACTER HO HIP
+ u'\u0e2c' # 0xCC -> THAI CHARACTER LO CHULA
+ u'\u0e2d' # 0xCD -> THAI CHARACTER O ANG
+ u'\u0e2e' # 0xCE -> THAI CHARACTER HO NOKHUK
+ u'\u0e2f' # 0xCF -> THAI CHARACTER PAIYANNOI
+ u'\u0e30' # 0xD0 -> THAI CHARACTER SARA A
+ u'\u0e31' # 0xD1 -> THAI CHARACTER MAI HAN-AKAT
+ u'\u0e32' # 0xD2 -> THAI CHARACTER SARA AA
+ u'\u0e33' # 0xD3 -> THAI CHARACTER SARA AM
+ u'\u0e34' # 0xD4 -> THAI CHARACTER SARA I
+ u'\u0e35' # 0xD5 -> THAI CHARACTER SARA II
+ u'\u0e36' # 0xD6 -> THAI CHARACTER SARA UE
+ u'\u0e37' # 0xD7 -> THAI CHARACTER SARA UEE
+ u'\u0e38' # 0xD8 -> THAI CHARACTER SARA U
+ u'\u0e39' # 0xD9 -> THAI CHARACTER SARA UU
+ u'\u0e3a' # 0xDA -> THAI CHARACTER PHINTHU
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\u0e3f' # 0xDF -> THAI CURRENCY SYMBOL BAHT
+ u'\u0e40' # 0xE0 -> THAI CHARACTER SARA E
+ u'\u0e41' # 0xE1 -> THAI CHARACTER SARA AE
+ u'\u0e42' # 0xE2 -> THAI CHARACTER SARA O
+ u'\u0e43' # 0xE3 -> THAI CHARACTER SARA AI MAIMUAN
+ u'\u0e44' # 0xE4 -> THAI CHARACTER SARA AI MAIMALAI
+ u'\u0e45' # 0xE5 -> THAI CHARACTER LAKKHANGYAO
+ u'\u0e46' # 0xE6 -> THAI CHARACTER MAIYAMOK
+ u'\u0e47' # 0xE7 -> THAI CHARACTER MAITAIKHU
+ u'\u0e48' # 0xE8 -> THAI CHARACTER MAI EK
+ u'\u0e49' # 0xE9 -> THAI CHARACTER MAI THO
+ u'\u0e4a' # 0xEA -> THAI CHARACTER MAI TRI
+ u'\u0e4b' # 0xEB -> THAI CHARACTER MAI CHATTAWA
+ u'\u0e4c' # 0xEC -> THAI CHARACTER THANTHAKHAT
+ u'\u0e4d' # 0xED -> THAI CHARACTER NIKHAHIT
+ u'\u0e4e' # 0xEE -> THAI CHARACTER YAMAKKAN
+ u'\u0e4f' # 0xEF -> THAI CHARACTER FONGMAN
+ u'\u0e50' # 0xF0 -> THAI DIGIT ZERO
+ u'\u0e51' # 0xF1 -> THAI DIGIT ONE
+ u'\u0e52' # 0xF2 -> THAI DIGIT TWO
+ u'\u0e53' # 0xF3 -> THAI DIGIT THREE
+ u'\u0e54' # 0xF4 -> THAI DIGIT FOUR
+ u'\u0e55' # 0xF5 -> THAI DIGIT FIVE
+ u'\u0e56' # 0xF6 -> THAI DIGIT SIX
+ u'\u0e57' # 0xF7 -> THAI DIGIT SEVEN
+ u'\u0e58' # 0xF8 -> THAI DIGIT EIGHT
+ u'\u0e59' # 0xF9 -> THAI DIGIT NINE
+ u'\u0e5a' # 0xFA -> THAI CHARACTER ANGKHANKHU
+ u'\u0e5b' # 0xFB -> THAI CHARACTER KHOMUT
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..0523133afb
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_13.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_13 generated from 'MAPPINGS/ISO8859/8859-13.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso8859-13',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\x80' # 0x80 -> <control>
+ u'\x81' # 0x81 -> <control>
+ u'\x82' # 0x82 -> <control>
+ u'\x83' # 0x83 -> <control>
+ u'\x84' # 0x84 -> <control>
+ u'\x85' # 0x85 -> <control>
+ u'\x86' # 0x86 -> <control>
+ u'\x87' # 0x87 -> <control>
+ u'\x88' # 0x88 -> <control>
+ u'\x89' # 0x89 -> <control>
+ u'\x8a' # 0x8A -> <control>
+ u'\x8b' # 0x8B -> <control>
+ u'\x8c' # 0x8C -> <control>
+ u'\x8d' # 0x8D -> <control>
+ u'\x8e' # 0x8E -> <control>
+ u'\x8f' # 0x8F -> <control>
+ u'\x90' # 0x90 -> <control>
+ u'\x91' # 0x91 -> <control>
+ u'\x92' # 0x92 -> <control>
+ u'\x93' # 0x93 -> <control>
+ u'\x94' # 0x94 -> <control>
+ u'\x95' # 0x95 -> <control>
+ u'\x96' # 0x96 -> <control>
+ u'\x97' # 0x97 -> <control>
+ u'\x98' # 0x98 -> <control>
+ u'\x99' # 0x99 -> <control>
+ u'\x9a' # 0x9A -> <control>
+ u'\x9b' # 0x9B -> <control>
+ u'\x9c' # 0x9C -> <control>
+ u'\x9d' # 0x9D -> <control>
+ u'\x9e' # 0x9E -> <control>
+ u'\x9f' # 0x9F -> <control>
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\u201d' # 0xA1 -> RIGHT DOUBLE QUOTATION MARK
+ u'\xa2' # 0xA2 -> CENT SIGN
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\xa4' # 0xA4 -> CURRENCY SIGN
+ u'\u201e' # 0xA5 -> DOUBLE LOW-9 QUOTATION MARK
+ u'\xa6' # 0xA6 -> BROKEN BAR
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\xd8' # 0xA8 -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\u0156' # 0xAA -> LATIN CAPITAL LETTER R WITH CEDILLA
+ u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xac' # 0xAC -> NOT SIGN
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\xae' # 0xAE -> REGISTERED SIGN
+ u'\xc6' # 0xAF -> LATIN CAPITAL LETTER AE
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\xb2' # 0xB2 -> SUPERSCRIPT TWO
+ u'\xb3' # 0xB3 -> SUPERSCRIPT THREE
+ u'\u201c' # 0xB4 -> LEFT DOUBLE QUOTATION MARK
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xb7' # 0xB7 -> MIDDLE DOT
+ u'\xf8' # 0xB8 -> LATIN SMALL LETTER O WITH STROKE
+ u'\xb9' # 0xB9 -> SUPERSCRIPT ONE
+ u'\u0157' # 0xBA -> LATIN SMALL LETTER R WITH CEDILLA
+ u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER
+ u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF
+ u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS
+ u'\xe6' # 0xBF -> LATIN SMALL LETTER AE
+ u'\u0104' # 0xC0 -> LATIN CAPITAL LETTER A WITH OGONEK
+ u'\u012e' # 0xC1 -> LATIN CAPITAL LETTER I WITH OGONEK
+ u'\u0100' # 0xC2 -> LATIN CAPITAL LETTER A WITH MACRON
+ u'\u0106' # 0xC3 -> LATIN CAPITAL LETTER C WITH ACUTE
+ u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\u0118' # 0xC6 -> LATIN CAPITAL LETTER E WITH OGONEK
+ u'\u0112' # 0xC7 -> LATIN CAPITAL LETTER E WITH MACRON
+ u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON
+ u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\u0179' # 0xCA -> LATIN CAPITAL LETTER Z WITH ACUTE
+ u'\u0116' # 0xCB -> LATIN CAPITAL LETTER E WITH DOT ABOVE
+ u'\u0122' # 0xCC -> LATIN CAPITAL LETTER G WITH CEDILLA
+ u'\u0136' # 0xCD -> LATIN CAPITAL LETTER K WITH CEDILLA
+ u'\u012a' # 0xCE -> LATIN CAPITAL LETTER I WITH MACRON
+ u'\u013b' # 0xCF -> LATIN CAPITAL LETTER L WITH CEDILLA
+ u'\u0160' # 0xD0 -> LATIN CAPITAL LETTER S WITH CARON
+ u'\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE
+ u'\u0145' # 0xD2 -> LATIN CAPITAL LETTER N WITH CEDILLA
+ u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\u014c' # 0xD4 -> LATIN CAPITAL LETTER O WITH MACRON
+ u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xd7' # 0xD7 -> MULTIPLICATION SIGN
+ u'\u0172' # 0xD8 -> LATIN CAPITAL LETTER U WITH OGONEK
+ u'\u0141' # 0xD9 -> LATIN CAPITAL LETTER L WITH STROKE
+ u'\u015a' # 0xDA -> LATIN CAPITAL LETTER S WITH ACUTE
+ u'\u016a' # 0xDB -> LATIN CAPITAL LETTER U WITH MACRON
+ u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\u017b' # 0xDD -> LATIN CAPITAL LETTER Z WITH DOT ABOVE
+ u'\u017d' # 0xDE -> LATIN CAPITAL LETTER Z WITH CARON
+ u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S (German)
+ u'\u0105' # 0xE0 -> LATIN SMALL LETTER A WITH OGONEK
+ u'\u012f' # 0xE1 -> LATIN SMALL LETTER I WITH OGONEK
+ u'\u0101' # 0xE2 -> LATIN SMALL LETTER A WITH MACRON
+ u'\u0107' # 0xE3 -> LATIN SMALL LETTER C WITH ACUTE
+ u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\u0119' # 0xE6 -> LATIN SMALL LETTER E WITH OGONEK
+ u'\u0113' # 0xE7 -> LATIN SMALL LETTER E WITH MACRON
+ u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON
+ u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\u017a' # 0xEA -> LATIN SMALL LETTER Z WITH ACUTE
+ u'\u0117' # 0xEB -> LATIN SMALL LETTER E WITH DOT ABOVE
+ u'\u0123' # 0xEC -> LATIN SMALL LETTER G WITH CEDILLA
+ u'\u0137' # 0xED -> LATIN SMALL LETTER K WITH CEDILLA
+ u'\u012b' # 0xEE -> LATIN SMALL LETTER I WITH MACRON
+ u'\u013c' # 0xEF -> LATIN SMALL LETTER L WITH CEDILLA
+ u'\u0161' # 0xF0 -> LATIN SMALL LETTER S WITH CARON
+ u'\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE
+ u'\u0146' # 0xF2 -> LATIN SMALL LETTER N WITH CEDILLA
+ u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\u014d' # 0xF4 -> LATIN SMALL LETTER O WITH MACRON
+ u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE
+ u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf7' # 0xF7 -> DIVISION SIGN
+ u'\u0173' # 0xF8 -> LATIN SMALL LETTER U WITH OGONEK
+ u'\u0142' # 0xF9 -> LATIN SMALL LETTER L WITH STROKE
+ u'\u015b' # 0xFA -> LATIN SMALL LETTER S WITH ACUTE
+ u'\u016b' # 0xFB -> LATIN SMALL LETTER U WITH MACRON
+ u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\u017c' # 0xFD -> LATIN SMALL LETTER Z WITH DOT ABOVE
+ u'\u017e' # 0xFE -> LATIN SMALL LETTER Z WITH CARON
+ u'\u2019' # 0xFF -> RIGHT SINGLE QUOTATION MARK
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..f0ed8fa5be
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_14.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_14 generated from 'MAPPINGS/ISO8859/8859-14.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso8859-14',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\x80' # 0x80 -> <control>
+ u'\x81' # 0x81 -> <control>
+ u'\x82' # 0x82 -> <control>
+ u'\x83' # 0x83 -> <control>
+ u'\x84' # 0x84 -> <control>
+ u'\x85' # 0x85 -> <control>
+ u'\x86' # 0x86 -> <control>
+ u'\x87' # 0x87 -> <control>
+ u'\x88' # 0x88 -> <control>
+ u'\x89' # 0x89 -> <control>
+ u'\x8a' # 0x8A -> <control>
+ u'\x8b' # 0x8B -> <control>
+ u'\x8c' # 0x8C -> <control>
+ u'\x8d' # 0x8D -> <control>
+ u'\x8e' # 0x8E -> <control>
+ u'\x8f' # 0x8F -> <control>
+ u'\x90' # 0x90 -> <control>
+ u'\x91' # 0x91 -> <control>
+ u'\x92' # 0x92 -> <control>
+ u'\x93' # 0x93 -> <control>
+ u'\x94' # 0x94 -> <control>
+ u'\x95' # 0x95 -> <control>
+ u'\x96' # 0x96 -> <control>
+ u'\x97' # 0x97 -> <control>
+ u'\x98' # 0x98 -> <control>
+ u'\x99' # 0x99 -> <control>
+ u'\x9a' # 0x9A -> <control>
+ u'\x9b' # 0x9B -> <control>
+ u'\x9c' # 0x9C -> <control>
+ u'\x9d' # 0x9D -> <control>
+ u'\x9e' # 0x9E -> <control>
+ u'\x9f' # 0x9F -> <control>
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\u1e02' # 0xA1 -> LATIN CAPITAL LETTER B WITH DOT ABOVE
+ u'\u1e03' # 0xA2 -> LATIN SMALL LETTER B WITH DOT ABOVE
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\u010a' # 0xA4 -> LATIN CAPITAL LETTER C WITH DOT ABOVE
+ u'\u010b' # 0xA5 -> LATIN SMALL LETTER C WITH DOT ABOVE
+ u'\u1e0a' # 0xA6 -> LATIN CAPITAL LETTER D WITH DOT ABOVE
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\u1e80' # 0xA8 -> LATIN CAPITAL LETTER W WITH GRAVE
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\u1e82' # 0xAA -> LATIN CAPITAL LETTER W WITH ACUTE
+ u'\u1e0b' # 0xAB -> LATIN SMALL LETTER D WITH DOT ABOVE
+ u'\u1ef2' # 0xAC -> LATIN CAPITAL LETTER Y WITH GRAVE
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\xae' # 0xAE -> REGISTERED SIGN
+ u'\u0178' # 0xAF -> LATIN CAPITAL LETTER Y WITH DIAERESIS
+ u'\u1e1e' # 0xB0 -> LATIN CAPITAL LETTER F WITH DOT ABOVE
+ u'\u1e1f' # 0xB1 -> LATIN SMALL LETTER F WITH DOT ABOVE
+ u'\u0120' # 0xB2 -> LATIN CAPITAL LETTER G WITH DOT ABOVE
+ u'\u0121' # 0xB3 -> LATIN SMALL LETTER G WITH DOT ABOVE
+ u'\u1e40' # 0xB4 -> LATIN CAPITAL LETTER M WITH DOT ABOVE
+ u'\u1e41' # 0xB5 -> LATIN SMALL LETTER M WITH DOT ABOVE
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\u1e56' # 0xB7 -> LATIN CAPITAL LETTER P WITH DOT ABOVE
+ u'\u1e81' # 0xB8 -> LATIN SMALL LETTER W WITH GRAVE
+ u'\u1e57' # 0xB9 -> LATIN SMALL LETTER P WITH DOT ABOVE
+ u'\u1e83' # 0xBA -> LATIN SMALL LETTER W WITH ACUTE
+ u'\u1e60' # 0xBB -> LATIN CAPITAL LETTER S WITH DOT ABOVE
+ u'\u1ef3' # 0xBC -> LATIN SMALL LETTER Y WITH GRAVE
+ u'\u1e84' # 0xBD -> LATIN CAPITAL LETTER W WITH DIAERESIS
+ u'\u1e85' # 0xBE -> LATIN SMALL LETTER W WITH DIAERESIS
+ u'\u1e61' # 0xBF -> LATIN SMALL LETTER S WITH DOT ABOVE
+ u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE
+ u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\u0174' # 0xD0 -> LATIN CAPITAL LETTER W WITH CIRCUMFLEX
+ u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\u1e6a' # 0xD7 -> LATIN CAPITAL LETTER T WITH DOT ABOVE
+ u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE
+ u'\u0176' # 0xDE -> LATIN CAPITAL LETTER Y WITH CIRCUMFLEX
+ u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S
+ u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE
+ u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE
+ u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\u0175' # 0xF0 -> LATIN SMALL LETTER W WITH CIRCUMFLEX
+ u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE
+ u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\u1e6b' # 0xF7 -> LATIN SMALL LETTER T WITH DOT ABOVE
+ u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE
+ u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE
+ u'\u0177' # 0xFE -> LATIN SMALL LETTER Y WITH CIRCUMFLEX
+ u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..4c322bee38
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_15.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_15 generated from 'MAPPINGS/ISO8859/8859-15.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso8859-15',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\x80' # 0x80 -> <control>
+ u'\x81' # 0x81 -> <control>
+ u'\x82' # 0x82 -> <control>
+ u'\x83' # 0x83 -> <control>
+ u'\x84' # 0x84 -> <control>
+ u'\x85' # 0x85 -> <control>
+ u'\x86' # 0x86 -> <control>
+ u'\x87' # 0x87 -> <control>
+ u'\x88' # 0x88 -> <control>
+ u'\x89' # 0x89 -> <control>
+ u'\x8a' # 0x8A -> <control>
+ u'\x8b' # 0x8B -> <control>
+ u'\x8c' # 0x8C -> <control>
+ u'\x8d' # 0x8D -> <control>
+ u'\x8e' # 0x8E -> <control>
+ u'\x8f' # 0x8F -> <control>
+ u'\x90' # 0x90 -> <control>
+ u'\x91' # 0x91 -> <control>
+ u'\x92' # 0x92 -> <control>
+ u'\x93' # 0x93 -> <control>
+ u'\x94' # 0x94 -> <control>
+ u'\x95' # 0x95 -> <control>
+ u'\x96' # 0x96 -> <control>
+ u'\x97' # 0x97 -> <control>
+ u'\x98' # 0x98 -> <control>
+ u'\x99' # 0x99 -> <control>
+ u'\x9a' # 0x9A -> <control>
+ u'\x9b' # 0x9B -> <control>
+ u'\x9c' # 0x9C -> <control>
+ u'\x9d' # 0x9D -> <control>
+ u'\x9e' # 0x9E -> <control>
+ u'\x9f' # 0x9F -> <control>
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK
+ u'\xa2' # 0xA2 -> CENT SIGN
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\u20ac' # 0xA4 -> EURO SIGN
+ u'\xa5' # 0xA5 -> YEN SIGN
+ u'\u0160' # 0xA6 -> LATIN CAPITAL LETTER S WITH CARON
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\u0161' # 0xA8 -> LATIN SMALL LETTER S WITH CARON
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR
+ u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xac' # 0xAC -> NOT SIGN
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\xae' # 0xAE -> REGISTERED SIGN
+ u'\xaf' # 0xAF -> MACRON
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\xb2' # 0xB2 -> SUPERSCRIPT TWO
+ u'\xb3' # 0xB3 -> SUPERSCRIPT THREE
+ u'\u017d' # 0xB4 -> LATIN CAPITAL LETTER Z WITH CARON
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xb7' # 0xB7 -> MIDDLE DOT
+ u'\u017e' # 0xB8 -> LATIN SMALL LETTER Z WITH CARON
+ u'\xb9' # 0xB9 -> SUPERSCRIPT ONE
+ u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR
+ u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u0152' # 0xBC -> LATIN CAPITAL LIGATURE OE
+ u'\u0153' # 0xBD -> LATIN SMALL LIGATURE OE
+ u'\u0178' # 0xBE -> LATIN CAPITAL LETTER Y WITH DIAERESIS
+ u'\xbf' # 0xBF -> INVERTED QUESTION MARK
+ u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE
+ u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\xd0' # 0xD0 -> LATIN CAPITAL LETTER ETH
+ u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xd7' # 0xD7 -> MULTIPLICATION SIGN
+ u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE
+ u'\xde' # 0xDE -> LATIN CAPITAL LETTER THORN
+ u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S
+ u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE
+ u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE
+ u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xf0' # 0xF0 -> LATIN SMALL LETTER ETH
+ u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE
+ u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf7' # 0xF7 -> DIVISION SIGN
+ u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE
+ u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE
+ u'\xfe' # 0xFE -> LATIN SMALL LETTER THORN
+ u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..e1bce0a133
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_16.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_16 generated from 'MAPPINGS/ISO8859/8859-16.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso8859-16',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\x80' # 0x80 -> <control>
+ u'\x81' # 0x81 -> <control>
+ u'\x82' # 0x82 -> <control>
+ u'\x83' # 0x83 -> <control>
+ u'\x84' # 0x84 -> <control>
+ u'\x85' # 0x85 -> <control>
+ u'\x86' # 0x86 -> <control>
+ u'\x87' # 0x87 -> <control>
+ u'\x88' # 0x88 -> <control>
+ u'\x89' # 0x89 -> <control>
+ u'\x8a' # 0x8A -> <control>
+ u'\x8b' # 0x8B -> <control>
+ u'\x8c' # 0x8C -> <control>
+ u'\x8d' # 0x8D -> <control>
+ u'\x8e' # 0x8E -> <control>
+ u'\x8f' # 0x8F -> <control>
+ u'\x90' # 0x90 -> <control>
+ u'\x91' # 0x91 -> <control>
+ u'\x92' # 0x92 -> <control>
+ u'\x93' # 0x93 -> <control>
+ u'\x94' # 0x94 -> <control>
+ u'\x95' # 0x95 -> <control>
+ u'\x96' # 0x96 -> <control>
+ u'\x97' # 0x97 -> <control>
+ u'\x98' # 0x98 -> <control>
+ u'\x99' # 0x99 -> <control>
+ u'\x9a' # 0x9A -> <control>
+ u'\x9b' # 0x9B -> <control>
+ u'\x9c' # 0x9C -> <control>
+ u'\x9d' # 0x9D -> <control>
+ u'\x9e' # 0x9E -> <control>
+ u'\x9f' # 0x9F -> <control>
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\u0104' # 0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK
+ u'\u0105' # 0xA2 -> LATIN SMALL LETTER A WITH OGONEK
+ u'\u0141' # 0xA3 -> LATIN CAPITAL LETTER L WITH STROKE
+ u'\u20ac' # 0xA4 -> EURO SIGN
+ u'\u201e' # 0xA5 -> DOUBLE LOW-9 QUOTATION MARK
+ u'\u0160' # 0xA6 -> LATIN CAPITAL LETTER S WITH CARON
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\u0161' # 0xA8 -> LATIN SMALL LETTER S WITH CARON
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\u0218' # 0xAA -> LATIN CAPITAL LETTER S WITH COMMA BELOW
+ u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u0179' # 0xAC -> LATIN CAPITAL LETTER Z WITH ACUTE
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\u017a' # 0xAE -> LATIN SMALL LETTER Z WITH ACUTE
+ u'\u017b' # 0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\u010c' # 0xB2 -> LATIN CAPITAL LETTER C WITH CARON
+ u'\u0142' # 0xB3 -> LATIN SMALL LETTER L WITH STROKE
+ u'\u017d' # 0xB4 -> LATIN CAPITAL LETTER Z WITH CARON
+ u'\u201d' # 0xB5 -> RIGHT DOUBLE QUOTATION MARK
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xb7' # 0xB7 -> MIDDLE DOT
+ u'\u017e' # 0xB8 -> LATIN SMALL LETTER Z WITH CARON
+ u'\u010d' # 0xB9 -> LATIN SMALL LETTER C WITH CARON
+ u'\u0219' # 0xBA -> LATIN SMALL LETTER S WITH COMMA BELOW
+ u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u0152' # 0xBC -> LATIN CAPITAL LIGATURE OE
+ u'\u0153' # 0xBD -> LATIN SMALL LIGATURE OE
+ u'\u0178' # 0xBE -> LATIN CAPITAL LETTER Y WITH DIAERESIS
+ u'\u017c' # 0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE
+ u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\u0102' # 0xC3 -> LATIN CAPITAL LETTER A WITH BREVE
+ u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\u0106' # 0xC5 -> LATIN CAPITAL LETTER C WITH ACUTE
+ u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE
+ u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE
+ u'\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE
+ u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\u0150' # 0xD5 -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
+ u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\u015a' # 0xD7 -> LATIN CAPITAL LETTER S WITH ACUTE
+ u'\u0170' # 0xD8 -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
+ u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\u0118' # 0xDD -> LATIN CAPITAL LETTER E WITH OGONEK
+ u'\u021a' # 0xDE -> LATIN CAPITAL LETTER T WITH COMMA BELOW
+ u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S
+ u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\u0103' # 0xE3 -> LATIN SMALL LETTER A WITH BREVE
+ u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\u0107' # 0xE5 -> LATIN SMALL LETTER C WITH ACUTE
+ u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE
+ u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE
+ u'\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE
+ u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\u0151' # 0xF5 -> LATIN SMALL LETTER O WITH DOUBLE ACUTE
+ u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\u015b' # 0xF7 -> LATIN SMALL LETTER S WITH ACUTE
+ u'\u0171' # 0xF8 -> LATIN SMALL LETTER U WITH DOUBLE ACUTE
+ u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\u0119' # 0xFD -> LATIN SMALL LETTER E WITH OGONEK
+ u'\u021b' # 0xFE -> LATIN SMALL LETTER T WITH COMMA BELOW
+ u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..fb3606febf
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_2.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_2 generated from 'MAPPINGS/ISO8859/8859-2.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso8859-2',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\x80' # 0x80 -> <control>
+ u'\x81' # 0x81 -> <control>
+ u'\x82' # 0x82 -> <control>
+ u'\x83' # 0x83 -> <control>
+ u'\x84' # 0x84 -> <control>
+ u'\x85' # 0x85 -> <control>
+ u'\x86' # 0x86 -> <control>
+ u'\x87' # 0x87 -> <control>
+ u'\x88' # 0x88 -> <control>
+ u'\x89' # 0x89 -> <control>
+ u'\x8a' # 0x8A -> <control>
+ u'\x8b' # 0x8B -> <control>
+ u'\x8c' # 0x8C -> <control>
+ u'\x8d' # 0x8D -> <control>
+ u'\x8e' # 0x8E -> <control>
+ u'\x8f' # 0x8F -> <control>
+ u'\x90' # 0x90 -> <control>
+ u'\x91' # 0x91 -> <control>
+ u'\x92' # 0x92 -> <control>
+ u'\x93' # 0x93 -> <control>
+ u'\x94' # 0x94 -> <control>
+ u'\x95' # 0x95 -> <control>
+ u'\x96' # 0x96 -> <control>
+ u'\x97' # 0x97 -> <control>
+ u'\x98' # 0x98 -> <control>
+ u'\x99' # 0x99 -> <control>
+ u'\x9a' # 0x9A -> <control>
+ u'\x9b' # 0x9B -> <control>
+ u'\x9c' # 0x9C -> <control>
+ u'\x9d' # 0x9D -> <control>
+ u'\x9e' # 0x9E -> <control>
+ u'\x9f' # 0x9F -> <control>
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\u0104' # 0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK
+ u'\u02d8' # 0xA2 -> BREVE
+ u'\u0141' # 0xA3 -> LATIN CAPITAL LETTER L WITH STROKE
+ u'\xa4' # 0xA4 -> CURRENCY SIGN
+ u'\u013d' # 0xA5 -> LATIN CAPITAL LETTER L WITH CARON
+ u'\u015a' # 0xA6 -> LATIN CAPITAL LETTER S WITH ACUTE
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\xa8' # 0xA8 -> DIAERESIS
+ u'\u0160' # 0xA9 -> LATIN CAPITAL LETTER S WITH CARON
+ u'\u015e' # 0xAA -> LATIN CAPITAL LETTER S WITH CEDILLA
+ u'\u0164' # 0xAB -> LATIN CAPITAL LETTER T WITH CARON
+ u'\u0179' # 0xAC -> LATIN CAPITAL LETTER Z WITH ACUTE
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\u017d' # 0xAE -> LATIN CAPITAL LETTER Z WITH CARON
+ u'\u017b' # 0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\u0105' # 0xB1 -> LATIN SMALL LETTER A WITH OGONEK
+ u'\u02db' # 0xB2 -> OGONEK
+ u'\u0142' # 0xB3 -> LATIN SMALL LETTER L WITH STROKE
+ u'\xb4' # 0xB4 -> ACUTE ACCENT
+ u'\u013e' # 0xB5 -> LATIN SMALL LETTER L WITH CARON
+ u'\u015b' # 0xB6 -> LATIN SMALL LETTER S WITH ACUTE
+ u'\u02c7' # 0xB7 -> CARON
+ u'\xb8' # 0xB8 -> CEDILLA
+ u'\u0161' # 0xB9 -> LATIN SMALL LETTER S WITH CARON
+ u'\u015f' # 0xBA -> LATIN SMALL LETTER S WITH CEDILLA
+ u'\u0165' # 0xBB -> LATIN SMALL LETTER T WITH CARON
+ u'\u017a' # 0xBC -> LATIN SMALL LETTER Z WITH ACUTE
+ u'\u02dd' # 0xBD -> DOUBLE ACUTE ACCENT
+ u'\u017e' # 0xBE -> LATIN SMALL LETTER Z WITH CARON
+ u'\u017c' # 0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE
+ u'\u0154' # 0xC0 -> LATIN CAPITAL LETTER R WITH ACUTE
+ u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\u0102' # 0xC3 -> LATIN CAPITAL LETTER A WITH BREVE
+ u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\u0139' # 0xC5 -> LATIN CAPITAL LETTER L WITH ACUTE
+ u'\u0106' # 0xC6 -> LATIN CAPITAL LETTER C WITH ACUTE
+ u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON
+ u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\u0118' # 0xCA -> LATIN CAPITAL LETTER E WITH OGONEK
+ u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\u011a' # 0xCC -> LATIN CAPITAL LETTER E WITH CARON
+ u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\u010e' # 0xCF -> LATIN CAPITAL LETTER D WITH CARON
+ u'\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE
+ u'\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE
+ u'\u0147' # 0xD2 -> LATIN CAPITAL LETTER N WITH CARON
+ u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\u0150' # 0xD5 -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
+ u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xd7' # 0xD7 -> MULTIPLICATION SIGN
+ u'\u0158' # 0xD8 -> LATIN CAPITAL LETTER R WITH CARON
+ u'\u016e' # 0xD9 -> LATIN CAPITAL LETTER U WITH RING ABOVE
+ u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\u0170' # 0xDB -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
+ u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE
+ u'\u0162' # 0xDE -> LATIN CAPITAL LETTER T WITH CEDILLA
+ u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S
+ u'\u0155' # 0xE0 -> LATIN SMALL LETTER R WITH ACUTE
+ u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\u0103' # 0xE3 -> LATIN SMALL LETTER A WITH BREVE
+ u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\u013a' # 0xE5 -> LATIN SMALL LETTER L WITH ACUTE
+ u'\u0107' # 0xE6 -> LATIN SMALL LETTER C WITH ACUTE
+ u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON
+ u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\u0119' # 0xEA -> LATIN SMALL LETTER E WITH OGONEK
+ u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\u011b' # 0xEC -> LATIN SMALL LETTER E WITH CARON
+ u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\u010f' # 0xEF -> LATIN SMALL LETTER D WITH CARON
+ u'\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE
+ u'\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE
+ u'\u0148' # 0xF2 -> LATIN SMALL LETTER N WITH CARON
+ u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\u0151' # 0xF5 -> LATIN SMALL LETTER O WITH DOUBLE ACUTE
+ u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf7' # 0xF7 -> DIVISION SIGN
+ u'\u0159' # 0xF8 -> LATIN SMALL LETTER R WITH CARON
+ u'\u016f' # 0xF9 -> LATIN SMALL LETTER U WITH RING ABOVE
+ u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE
+ u'\u0171' # 0xFB -> LATIN SMALL LETTER U WITH DOUBLE ACUTE
+ u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE
+ u'\u0163' # 0xFE -> LATIN SMALL LETTER T WITH CEDILLA
+ u'\u02d9' # 0xFF -> DOT ABOVE
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..aaa2f52182
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_3.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_3 generated from 'MAPPINGS/ISO8859/8859-3.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso8859-3',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\x80' # 0x80 -> <control>
+ u'\x81' # 0x81 -> <control>
+ u'\x82' # 0x82 -> <control>
+ u'\x83' # 0x83 -> <control>
+ u'\x84' # 0x84 -> <control>
+ u'\x85' # 0x85 -> <control>
+ u'\x86' # 0x86 -> <control>
+ u'\x87' # 0x87 -> <control>
+ u'\x88' # 0x88 -> <control>
+ u'\x89' # 0x89 -> <control>
+ u'\x8a' # 0x8A -> <control>
+ u'\x8b' # 0x8B -> <control>
+ u'\x8c' # 0x8C -> <control>
+ u'\x8d' # 0x8D -> <control>
+ u'\x8e' # 0x8E -> <control>
+ u'\x8f' # 0x8F -> <control>
+ u'\x90' # 0x90 -> <control>
+ u'\x91' # 0x91 -> <control>
+ u'\x92' # 0x92 -> <control>
+ u'\x93' # 0x93 -> <control>
+ u'\x94' # 0x94 -> <control>
+ u'\x95' # 0x95 -> <control>
+ u'\x96' # 0x96 -> <control>
+ u'\x97' # 0x97 -> <control>
+ u'\x98' # 0x98 -> <control>
+ u'\x99' # 0x99 -> <control>
+ u'\x9a' # 0x9A -> <control>
+ u'\x9b' # 0x9B -> <control>
+ u'\x9c' # 0x9C -> <control>
+ u'\x9d' # 0x9D -> <control>
+ u'\x9e' # 0x9E -> <control>
+ u'\x9f' # 0x9F -> <control>
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\u0126' # 0xA1 -> LATIN CAPITAL LETTER H WITH STROKE
+ u'\u02d8' # 0xA2 -> BREVE
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\xa4' # 0xA4 -> CURRENCY SIGN
+ u'\ufffe'
+ u'\u0124' # 0xA6 -> LATIN CAPITAL LETTER H WITH CIRCUMFLEX
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\xa8' # 0xA8 -> DIAERESIS
+ u'\u0130' # 0xA9 -> LATIN CAPITAL LETTER I WITH DOT ABOVE
+ u'\u015e' # 0xAA -> LATIN CAPITAL LETTER S WITH CEDILLA
+ u'\u011e' # 0xAB -> LATIN CAPITAL LETTER G WITH BREVE
+ u'\u0134' # 0xAC -> LATIN CAPITAL LETTER J WITH CIRCUMFLEX
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\ufffe'
+ u'\u017b' # 0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\u0127' # 0xB1 -> LATIN SMALL LETTER H WITH STROKE
+ u'\xb2' # 0xB2 -> SUPERSCRIPT TWO
+ u'\xb3' # 0xB3 -> SUPERSCRIPT THREE
+ u'\xb4' # 0xB4 -> ACUTE ACCENT
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\u0125' # 0xB6 -> LATIN SMALL LETTER H WITH CIRCUMFLEX
+ u'\xb7' # 0xB7 -> MIDDLE DOT
+ u'\xb8' # 0xB8 -> CEDILLA
+ u'\u0131' # 0xB9 -> LATIN SMALL LETTER DOTLESS I
+ u'\u015f' # 0xBA -> LATIN SMALL LETTER S WITH CEDILLA
+ u'\u011f' # 0xBB -> LATIN SMALL LETTER G WITH BREVE
+ u'\u0135' # 0xBC -> LATIN SMALL LETTER J WITH CIRCUMFLEX
+ u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF
+ u'\ufffe'
+ u'\u017c' # 0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE
+ u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\ufffe'
+ u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\u010a' # 0xC5 -> LATIN CAPITAL LETTER C WITH DOT ABOVE
+ u'\u0108' # 0xC6 -> LATIN CAPITAL LETTER C WITH CIRCUMFLEX
+ u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\ufffe'
+ u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\u0120' # 0xD5 -> LATIN CAPITAL LETTER G WITH DOT ABOVE
+ u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xd7' # 0xD7 -> MULTIPLICATION SIGN
+ u'\u011c' # 0xD8 -> LATIN CAPITAL LETTER G WITH CIRCUMFLEX
+ u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\u016c' # 0xDD -> LATIN CAPITAL LETTER U WITH BREVE
+ u'\u015c' # 0xDE -> LATIN CAPITAL LETTER S WITH CIRCUMFLEX
+ u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S
+ u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\ufffe'
+ u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\u010b' # 0xE5 -> LATIN SMALL LETTER C WITH DOT ABOVE
+ u'\u0109' # 0xE6 -> LATIN SMALL LETTER C WITH CIRCUMFLEX
+ u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\ufffe'
+ u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\u0121' # 0xF5 -> LATIN SMALL LETTER G WITH DOT ABOVE
+ u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf7' # 0xF7 -> DIVISION SIGN
+ u'\u011d' # 0xF8 -> LATIN SMALL LETTER G WITH CIRCUMFLEX
+ u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\u016d' # 0xFD -> LATIN SMALL LETTER U WITH BREVE
+ u'\u015d' # 0xFE -> LATIN SMALL LETTER S WITH CIRCUMFLEX
+ u'\u02d9' # 0xFF -> DOT ABOVE
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..6e86ed1cb7
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_4.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_4 generated from 'MAPPINGS/ISO8859/8859-4.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso8859-4',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\x80' # 0x80 -> <control>
+ u'\x81' # 0x81 -> <control>
+ u'\x82' # 0x82 -> <control>
+ u'\x83' # 0x83 -> <control>
+ u'\x84' # 0x84 -> <control>
+ u'\x85' # 0x85 -> <control>
+ u'\x86' # 0x86 -> <control>
+ u'\x87' # 0x87 -> <control>
+ u'\x88' # 0x88 -> <control>
+ u'\x89' # 0x89 -> <control>
+ u'\x8a' # 0x8A -> <control>
+ u'\x8b' # 0x8B -> <control>
+ u'\x8c' # 0x8C -> <control>
+ u'\x8d' # 0x8D -> <control>
+ u'\x8e' # 0x8E -> <control>
+ u'\x8f' # 0x8F -> <control>
+ u'\x90' # 0x90 -> <control>
+ u'\x91' # 0x91 -> <control>
+ u'\x92' # 0x92 -> <control>
+ u'\x93' # 0x93 -> <control>
+ u'\x94' # 0x94 -> <control>
+ u'\x95' # 0x95 -> <control>
+ u'\x96' # 0x96 -> <control>
+ u'\x97' # 0x97 -> <control>
+ u'\x98' # 0x98 -> <control>
+ u'\x99' # 0x99 -> <control>
+ u'\x9a' # 0x9A -> <control>
+ u'\x9b' # 0x9B -> <control>
+ u'\x9c' # 0x9C -> <control>
+ u'\x9d' # 0x9D -> <control>
+ u'\x9e' # 0x9E -> <control>
+ u'\x9f' # 0x9F -> <control>
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\u0104' # 0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK
+ u'\u0138' # 0xA2 -> LATIN SMALL LETTER KRA
+ u'\u0156' # 0xA3 -> LATIN CAPITAL LETTER R WITH CEDILLA
+ u'\xa4' # 0xA4 -> CURRENCY SIGN
+ u'\u0128' # 0xA5 -> LATIN CAPITAL LETTER I WITH TILDE
+ u'\u013b' # 0xA6 -> LATIN CAPITAL LETTER L WITH CEDILLA
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\xa8' # 0xA8 -> DIAERESIS
+ u'\u0160' # 0xA9 -> LATIN CAPITAL LETTER S WITH CARON
+ u'\u0112' # 0xAA -> LATIN CAPITAL LETTER E WITH MACRON
+ u'\u0122' # 0xAB -> LATIN CAPITAL LETTER G WITH CEDILLA
+ u'\u0166' # 0xAC -> LATIN CAPITAL LETTER T WITH STROKE
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\u017d' # 0xAE -> LATIN CAPITAL LETTER Z WITH CARON
+ u'\xaf' # 0xAF -> MACRON
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\u0105' # 0xB1 -> LATIN SMALL LETTER A WITH OGONEK
+ u'\u02db' # 0xB2 -> OGONEK
+ u'\u0157' # 0xB3 -> LATIN SMALL LETTER R WITH CEDILLA
+ u'\xb4' # 0xB4 -> ACUTE ACCENT
+ u'\u0129' # 0xB5 -> LATIN SMALL LETTER I WITH TILDE
+ u'\u013c' # 0xB6 -> LATIN SMALL LETTER L WITH CEDILLA
+ u'\u02c7' # 0xB7 -> CARON
+ u'\xb8' # 0xB8 -> CEDILLA
+ u'\u0161' # 0xB9 -> LATIN SMALL LETTER S WITH CARON
+ u'\u0113' # 0xBA -> LATIN SMALL LETTER E WITH MACRON
+ u'\u0123' # 0xBB -> LATIN SMALL LETTER G WITH CEDILLA
+ u'\u0167' # 0xBC -> LATIN SMALL LETTER T WITH STROKE
+ u'\u014a' # 0xBD -> LATIN CAPITAL LETTER ENG
+ u'\u017e' # 0xBE -> LATIN SMALL LETTER Z WITH CARON
+ u'\u014b' # 0xBF -> LATIN SMALL LETTER ENG
+ u'\u0100' # 0xC0 -> LATIN CAPITAL LETTER A WITH MACRON
+ u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE
+ u'\u012e' # 0xC7 -> LATIN CAPITAL LETTER I WITH OGONEK
+ u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON
+ u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\u0118' # 0xCA -> LATIN CAPITAL LETTER E WITH OGONEK
+ u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\u0116' # 0xCC -> LATIN CAPITAL LETTER E WITH DOT ABOVE
+ u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\u012a' # 0xCF -> LATIN CAPITAL LETTER I WITH MACRON
+ u'\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE
+ u'\u0145' # 0xD1 -> LATIN CAPITAL LETTER N WITH CEDILLA
+ u'\u014c' # 0xD2 -> LATIN CAPITAL LETTER O WITH MACRON
+ u'\u0136' # 0xD3 -> LATIN CAPITAL LETTER K WITH CEDILLA
+ u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xd7' # 0xD7 -> MULTIPLICATION SIGN
+ u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\u0172' # 0xD9 -> LATIN CAPITAL LETTER U WITH OGONEK
+ u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\u0168' # 0xDD -> LATIN CAPITAL LETTER U WITH TILDE
+ u'\u016a' # 0xDE -> LATIN CAPITAL LETTER U WITH MACRON
+ u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S
+ u'\u0101' # 0xE0 -> LATIN SMALL LETTER A WITH MACRON
+ u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE
+ u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE
+ u'\u012f' # 0xE7 -> LATIN SMALL LETTER I WITH OGONEK
+ u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON
+ u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\u0119' # 0xEA -> LATIN SMALL LETTER E WITH OGONEK
+ u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\u0117' # 0xEC -> LATIN SMALL LETTER E WITH DOT ABOVE
+ u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\u012b' # 0xEF -> LATIN SMALL LETTER I WITH MACRON
+ u'\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE
+ u'\u0146' # 0xF1 -> LATIN SMALL LETTER N WITH CEDILLA
+ u'\u014d' # 0xF2 -> LATIN SMALL LETTER O WITH MACRON
+ u'\u0137' # 0xF3 -> LATIN SMALL LETTER K WITH CEDILLA
+ u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE
+ u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf7' # 0xF7 -> DIVISION SIGN
+ u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE
+ u'\u0173' # 0xF9 -> LATIN SMALL LETTER U WITH OGONEK
+ u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\u0169' # 0xFD -> LATIN SMALL LETTER U WITH TILDE
+ u'\u016b' # 0xFE -> LATIN SMALL LETTER U WITH MACRON
+ u'\u02d9' # 0xFF -> DOT ABOVE
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..c93283e617
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_5.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_5 generated from 'MAPPINGS/ISO8859/8859-5.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso8859-5',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\x80' # 0x80 -> <control>
+ u'\x81' # 0x81 -> <control>
+ u'\x82' # 0x82 -> <control>
+ u'\x83' # 0x83 -> <control>
+ u'\x84' # 0x84 -> <control>
+ u'\x85' # 0x85 -> <control>
+ u'\x86' # 0x86 -> <control>
+ u'\x87' # 0x87 -> <control>
+ u'\x88' # 0x88 -> <control>
+ u'\x89' # 0x89 -> <control>
+ u'\x8a' # 0x8A -> <control>
+ u'\x8b' # 0x8B -> <control>
+ u'\x8c' # 0x8C -> <control>
+ u'\x8d' # 0x8D -> <control>
+ u'\x8e' # 0x8E -> <control>
+ u'\x8f' # 0x8F -> <control>
+ u'\x90' # 0x90 -> <control>
+ u'\x91' # 0x91 -> <control>
+ u'\x92' # 0x92 -> <control>
+ u'\x93' # 0x93 -> <control>
+ u'\x94' # 0x94 -> <control>
+ u'\x95' # 0x95 -> <control>
+ u'\x96' # 0x96 -> <control>
+ u'\x97' # 0x97 -> <control>
+ u'\x98' # 0x98 -> <control>
+ u'\x99' # 0x99 -> <control>
+ u'\x9a' # 0x9A -> <control>
+ u'\x9b' # 0x9B -> <control>
+ u'\x9c' # 0x9C -> <control>
+ u'\x9d' # 0x9D -> <control>
+ u'\x9e' # 0x9E -> <control>
+ u'\x9f' # 0x9F -> <control>
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\u0401' # 0xA1 -> CYRILLIC CAPITAL LETTER IO
+ u'\u0402' # 0xA2 -> CYRILLIC CAPITAL LETTER DJE
+ u'\u0403' # 0xA3 -> CYRILLIC CAPITAL LETTER GJE
+ u'\u0404' # 0xA4 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE
+ u'\u0405' # 0xA5 -> CYRILLIC CAPITAL LETTER DZE
+ u'\u0406' # 0xA6 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
+ u'\u0407' # 0xA7 -> CYRILLIC CAPITAL LETTER YI
+ u'\u0408' # 0xA8 -> CYRILLIC CAPITAL LETTER JE
+ u'\u0409' # 0xA9 -> CYRILLIC CAPITAL LETTER LJE
+ u'\u040a' # 0xAA -> CYRILLIC CAPITAL LETTER NJE
+ u'\u040b' # 0xAB -> CYRILLIC CAPITAL LETTER TSHE
+ u'\u040c' # 0xAC -> CYRILLIC CAPITAL LETTER KJE
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\u040e' # 0xAE -> CYRILLIC CAPITAL LETTER SHORT U
+ u'\u040f' # 0xAF -> CYRILLIC CAPITAL LETTER DZHE
+ u'\u0410' # 0xB0 -> CYRILLIC CAPITAL LETTER A
+ u'\u0411' # 0xB1 -> CYRILLIC CAPITAL LETTER BE
+ u'\u0412' # 0xB2 -> CYRILLIC CAPITAL LETTER VE
+ u'\u0413' # 0xB3 -> CYRILLIC CAPITAL LETTER GHE
+ u'\u0414' # 0xB4 -> CYRILLIC CAPITAL LETTER DE
+ u'\u0415' # 0xB5 -> CYRILLIC CAPITAL LETTER IE
+ u'\u0416' # 0xB6 -> CYRILLIC CAPITAL LETTER ZHE
+ u'\u0417' # 0xB7 -> CYRILLIC CAPITAL LETTER ZE
+ u'\u0418' # 0xB8 -> CYRILLIC CAPITAL LETTER I
+ u'\u0419' # 0xB9 -> CYRILLIC CAPITAL LETTER SHORT I
+ u'\u041a' # 0xBA -> CYRILLIC CAPITAL LETTER KA
+ u'\u041b' # 0xBB -> CYRILLIC CAPITAL LETTER EL
+ u'\u041c' # 0xBC -> CYRILLIC CAPITAL LETTER EM
+ u'\u041d' # 0xBD -> CYRILLIC CAPITAL LETTER EN
+ u'\u041e' # 0xBE -> CYRILLIC CAPITAL LETTER O
+ u'\u041f' # 0xBF -> CYRILLIC CAPITAL LETTER PE
+ u'\u0420' # 0xC0 -> CYRILLIC CAPITAL LETTER ER
+ u'\u0421' # 0xC1 -> CYRILLIC CAPITAL LETTER ES
+ u'\u0422' # 0xC2 -> CYRILLIC CAPITAL LETTER TE
+ u'\u0423' # 0xC3 -> CYRILLIC CAPITAL LETTER U
+ u'\u0424' # 0xC4 -> CYRILLIC CAPITAL LETTER EF
+ u'\u0425' # 0xC5 -> CYRILLIC CAPITAL LETTER HA
+ u'\u0426' # 0xC6 -> CYRILLIC CAPITAL LETTER TSE
+ u'\u0427' # 0xC7 -> CYRILLIC CAPITAL LETTER CHE
+ u'\u0428' # 0xC8 -> CYRILLIC CAPITAL LETTER SHA
+ u'\u0429' # 0xC9 -> CYRILLIC CAPITAL LETTER SHCHA
+ u'\u042a' # 0xCA -> CYRILLIC CAPITAL LETTER HARD SIGN
+ u'\u042b' # 0xCB -> CYRILLIC CAPITAL LETTER YERU
+ u'\u042c' # 0xCC -> CYRILLIC CAPITAL LETTER SOFT SIGN
+ u'\u042d' # 0xCD -> CYRILLIC CAPITAL LETTER E
+ u'\u042e' # 0xCE -> CYRILLIC CAPITAL LETTER YU
+ u'\u042f' # 0xCF -> CYRILLIC CAPITAL LETTER YA
+ u'\u0430' # 0xD0 -> CYRILLIC SMALL LETTER A
+ u'\u0431' # 0xD1 -> CYRILLIC SMALL LETTER BE
+ u'\u0432' # 0xD2 -> CYRILLIC SMALL LETTER VE
+ u'\u0433' # 0xD3 -> CYRILLIC SMALL LETTER GHE
+ u'\u0434' # 0xD4 -> CYRILLIC SMALL LETTER DE
+ u'\u0435' # 0xD5 -> CYRILLIC SMALL LETTER IE
+ u'\u0436' # 0xD6 -> CYRILLIC SMALL LETTER ZHE
+ u'\u0437' # 0xD7 -> CYRILLIC SMALL LETTER ZE
+ u'\u0438' # 0xD8 -> CYRILLIC SMALL LETTER I
+ u'\u0439' # 0xD9 -> CYRILLIC SMALL LETTER SHORT I
+ u'\u043a' # 0xDA -> CYRILLIC SMALL LETTER KA
+ u'\u043b' # 0xDB -> CYRILLIC SMALL LETTER EL
+ u'\u043c' # 0xDC -> CYRILLIC SMALL LETTER EM
+ u'\u043d' # 0xDD -> CYRILLIC SMALL LETTER EN
+ u'\u043e' # 0xDE -> CYRILLIC SMALL LETTER O
+ u'\u043f' # 0xDF -> CYRILLIC SMALL LETTER PE
+ u'\u0440' # 0xE0 -> CYRILLIC SMALL LETTER ER
+ u'\u0441' # 0xE1 -> CYRILLIC SMALL LETTER ES
+ u'\u0442' # 0xE2 -> CYRILLIC SMALL LETTER TE
+ u'\u0443' # 0xE3 -> CYRILLIC SMALL LETTER U
+ u'\u0444' # 0xE4 -> CYRILLIC SMALL LETTER EF
+ u'\u0445' # 0xE5 -> CYRILLIC SMALL LETTER HA
+ u'\u0446' # 0xE6 -> CYRILLIC SMALL LETTER TSE
+ u'\u0447' # 0xE7 -> CYRILLIC SMALL LETTER CHE
+ u'\u0448' # 0xE8 -> CYRILLIC SMALL LETTER SHA
+ u'\u0449' # 0xE9 -> CYRILLIC SMALL LETTER SHCHA
+ u'\u044a' # 0xEA -> CYRILLIC SMALL LETTER HARD SIGN
+ u'\u044b' # 0xEB -> CYRILLIC SMALL LETTER YERU
+ u'\u044c' # 0xEC -> CYRILLIC SMALL LETTER SOFT SIGN
+ u'\u044d' # 0xED -> CYRILLIC SMALL LETTER E
+ u'\u044e' # 0xEE -> CYRILLIC SMALL LETTER YU
+ u'\u044f' # 0xEF -> CYRILLIC SMALL LETTER YA
+ u'\u2116' # 0xF0 -> NUMERO SIGN
+ u'\u0451' # 0xF1 -> CYRILLIC SMALL LETTER IO
+ u'\u0452' # 0xF2 -> CYRILLIC SMALL LETTER DJE
+ u'\u0453' # 0xF3 -> CYRILLIC SMALL LETTER GJE
+ u'\u0454' # 0xF4 -> CYRILLIC SMALL LETTER UKRAINIAN IE
+ u'\u0455' # 0xF5 -> CYRILLIC SMALL LETTER DZE
+ u'\u0456' # 0xF6 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
+ u'\u0457' # 0xF7 -> CYRILLIC SMALL LETTER YI
+ u'\u0458' # 0xF8 -> CYRILLIC SMALL LETTER JE
+ u'\u0459' # 0xF9 -> CYRILLIC SMALL LETTER LJE
+ u'\u045a' # 0xFA -> CYRILLIC SMALL LETTER NJE
+ u'\u045b' # 0xFB -> CYRILLIC SMALL LETTER TSHE
+ u'\u045c' # 0xFC -> CYRILLIC SMALL LETTER KJE
+ u'\xa7' # 0xFD -> SECTION SIGN
+ u'\u045e' # 0xFE -> CYRILLIC SMALL LETTER SHORT U
+ u'\u045f' # 0xFF -> CYRILLIC SMALL LETTER DZHE
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..6fc769af97
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_6.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_6 generated from 'MAPPINGS/ISO8859/8859-6.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso8859-6',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\x80' # 0x80 -> <control>
+ u'\x81' # 0x81 -> <control>
+ u'\x82' # 0x82 -> <control>
+ u'\x83' # 0x83 -> <control>
+ u'\x84' # 0x84 -> <control>
+ u'\x85' # 0x85 -> <control>
+ u'\x86' # 0x86 -> <control>
+ u'\x87' # 0x87 -> <control>
+ u'\x88' # 0x88 -> <control>
+ u'\x89' # 0x89 -> <control>
+ u'\x8a' # 0x8A -> <control>
+ u'\x8b' # 0x8B -> <control>
+ u'\x8c' # 0x8C -> <control>
+ u'\x8d' # 0x8D -> <control>
+ u'\x8e' # 0x8E -> <control>
+ u'\x8f' # 0x8F -> <control>
+ u'\x90' # 0x90 -> <control>
+ u'\x91' # 0x91 -> <control>
+ u'\x92' # 0x92 -> <control>
+ u'\x93' # 0x93 -> <control>
+ u'\x94' # 0x94 -> <control>
+ u'\x95' # 0x95 -> <control>
+ u'\x96' # 0x96 -> <control>
+ u'\x97' # 0x97 -> <control>
+ u'\x98' # 0x98 -> <control>
+ u'\x99' # 0x99 -> <control>
+ u'\x9a' # 0x9A -> <control>
+ u'\x9b' # 0x9B -> <control>
+ u'\x9c' # 0x9C -> <control>
+ u'\x9d' # 0x9D -> <control>
+ u'\x9e' # 0x9E -> <control>
+ u'\x9f' # 0x9F -> <control>
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\xa4' # 0xA4 -> CURRENCY SIGN
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\u060c' # 0xAC -> ARABIC COMMA
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\u061b' # 0xBB -> ARABIC SEMICOLON
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\u061f' # 0xBF -> ARABIC QUESTION MARK
+ u'\ufffe'
+ u'\u0621' # 0xC1 -> ARABIC LETTER HAMZA
+ u'\u0622' # 0xC2 -> ARABIC LETTER ALEF WITH MADDA ABOVE
+ u'\u0623' # 0xC3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE
+ u'\u0624' # 0xC4 -> ARABIC LETTER WAW WITH HAMZA ABOVE
+ u'\u0625' # 0xC5 -> ARABIC LETTER ALEF WITH HAMZA BELOW
+ u'\u0626' # 0xC6 -> ARABIC LETTER YEH WITH HAMZA ABOVE
+ u'\u0627' # 0xC7 -> ARABIC LETTER ALEF
+ u'\u0628' # 0xC8 -> ARABIC LETTER BEH
+ u'\u0629' # 0xC9 -> ARABIC LETTER TEH MARBUTA
+ u'\u062a' # 0xCA -> ARABIC LETTER TEH
+ u'\u062b' # 0xCB -> ARABIC LETTER THEH
+ u'\u062c' # 0xCC -> ARABIC LETTER JEEM
+ u'\u062d' # 0xCD -> ARABIC LETTER HAH
+ u'\u062e' # 0xCE -> ARABIC LETTER KHAH
+ u'\u062f' # 0xCF -> ARABIC LETTER DAL
+ u'\u0630' # 0xD0 -> ARABIC LETTER THAL
+ u'\u0631' # 0xD1 -> ARABIC LETTER REH
+ u'\u0632' # 0xD2 -> ARABIC LETTER ZAIN
+ u'\u0633' # 0xD3 -> ARABIC LETTER SEEN
+ u'\u0634' # 0xD4 -> ARABIC LETTER SHEEN
+ u'\u0635' # 0xD5 -> ARABIC LETTER SAD
+ u'\u0636' # 0xD6 -> ARABIC LETTER DAD
+ u'\u0637' # 0xD7 -> ARABIC LETTER TAH
+ u'\u0638' # 0xD8 -> ARABIC LETTER ZAH
+ u'\u0639' # 0xD9 -> ARABIC LETTER AIN
+ u'\u063a' # 0xDA -> ARABIC LETTER GHAIN
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\u0640' # 0xE0 -> ARABIC TATWEEL
+ u'\u0641' # 0xE1 -> ARABIC LETTER FEH
+ u'\u0642' # 0xE2 -> ARABIC LETTER QAF
+ u'\u0643' # 0xE3 -> ARABIC LETTER KAF
+ u'\u0644' # 0xE4 -> ARABIC LETTER LAM
+ u'\u0645' # 0xE5 -> ARABIC LETTER MEEM
+ u'\u0646' # 0xE6 -> ARABIC LETTER NOON
+ u'\u0647' # 0xE7 -> ARABIC LETTER HEH
+ u'\u0648' # 0xE8 -> ARABIC LETTER WAW
+ u'\u0649' # 0xE9 -> ARABIC LETTER ALEF MAKSURA
+ u'\u064a' # 0xEA -> ARABIC LETTER YEH
+ u'\u064b' # 0xEB -> ARABIC FATHATAN
+ u'\u064c' # 0xEC -> ARABIC DAMMATAN
+ u'\u064d' # 0xED -> ARABIC KASRATAN
+ u'\u064e' # 0xEE -> ARABIC FATHA
+ u'\u064f' # 0xEF -> ARABIC DAMMA
+ u'\u0650' # 0xF0 -> ARABIC KASRA
+ u'\u0651' # 0xF1 -> ARABIC SHADDA
+ u'\u0652' # 0xF2 -> ARABIC SUKUN
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..9fc2785b82
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_7.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_7 generated from 'MAPPINGS/ISO8859/8859-7.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso8859-7',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\x80' # 0x80 -> <control>
+ u'\x81' # 0x81 -> <control>
+ u'\x82' # 0x82 -> <control>
+ u'\x83' # 0x83 -> <control>
+ u'\x84' # 0x84 -> <control>
+ u'\x85' # 0x85 -> <control>
+ u'\x86' # 0x86 -> <control>
+ u'\x87' # 0x87 -> <control>
+ u'\x88' # 0x88 -> <control>
+ u'\x89' # 0x89 -> <control>
+ u'\x8a' # 0x8A -> <control>
+ u'\x8b' # 0x8B -> <control>
+ u'\x8c' # 0x8C -> <control>
+ u'\x8d' # 0x8D -> <control>
+ u'\x8e' # 0x8E -> <control>
+ u'\x8f' # 0x8F -> <control>
+ u'\x90' # 0x90 -> <control>
+ u'\x91' # 0x91 -> <control>
+ u'\x92' # 0x92 -> <control>
+ u'\x93' # 0x93 -> <control>
+ u'\x94' # 0x94 -> <control>
+ u'\x95' # 0x95 -> <control>
+ u'\x96' # 0x96 -> <control>
+ u'\x97' # 0x97 -> <control>
+ u'\x98' # 0x98 -> <control>
+ u'\x99' # 0x99 -> <control>
+ u'\x9a' # 0x9A -> <control>
+ u'\x9b' # 0x9B -> <control>
+ u'\x9c' # 0x9C -> <control>
+ u'\x9d' # 0x9D -> <control>
+ u'\x9e' # 0x9E -> <control>
+ u'\x9f' # 0x9F -> <control>
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\u2018' # 0xA1 -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0xA2 -> RIGHT SINGLE QUOTATION MARK
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\u20ac' # 0xA4 -> EURO SIGN
+ u'\u20af' # 0xA5 -> DRACHMA SIGN
+ u'\xa6' # 0xA6 -> BROKEN BAR
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\xa8' # 0xA8 -> DIAERESIS
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\u037a' # 0xAA -> GREEK YPOGEGRAMMENI
+ u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xac' # 0xAC -> NOT SIGN
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\ufffe'
+ u'\u2015' # 0xAF -> HORIZONTAL BAR
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\xb2' # 0xB2 -> SUPERSCRIPT TWO
+ u'\xb3' # 0xB3 -> SUPERSCRIPT THREE
+ u'\u0384' # 0xB4 -> GREEK TONOS
+ u'\u0385' # 0xB5 -> GREEK DIALYTIKA TONOS
+ u'\u0386' # 0xB6 -> GREEK CAPITAL LETTER ALPHA WITH TONOS
+ u'\xb7' # 0xB7 -> MIDDLE DOT
+ u'\u0388' # 0xB8 -> GREEK CAPITAL LETTER EPSILON WITH TONOS
+ u'\u0389' # 0xB9 -> GREEK CAPITAL LETTER ETA WITH TONOS
+ u'\u038a' # 0xBA -> GREEK CAPITAL LETTER IOTA WITH TONOS
+ u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u038c' # 0xBC -> GREEK CAPITAL LETTER OMICRON WITH TONOS
+ u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF
+ u'\u038e' # 0xBE -> GREEK CAPITAL LETTER UPSILON WITH TONOS
+ u'\u038f' # 0xBF -> GREEK CAPITAL LETTER OMEGA WITH TONOS
+ u'\u0390' # 0xC0 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS
+ u'\u0391' # 0xC1 -> GREEK CAPITAL LETTER ALPHA
+ u'\u0392' # 0xC2 -> GREEK CAPITAL LETTER BETA
+ u'\u0393' # 0xC3 -> GREEK CAPITAL LETTER GAMMA
+ u'\u0394' # 0xC4 -> GREEK CAPITAL LETTER DELTA
+ u'\u0395' # 0xC5 -> GREEK CAPITAL LETTER EPSILON
+ u'\u0396' # 0xC6 -> GREEK CAPITAL LETTER ZETA
+ u'\u0397' # 0xC7 -> GREEK CAPITAL LETTER ETA
+ u'\u0398' # 0xC8 -> GREEK CAPITAL LETTER THETA
+ u'\u0399' # 0xC9 -> GREEK CAPITAL LETTER IOTA
+ u'\u039a' # 0xCA -> GREEK CAPITAL LETTER KAPPA
+ u'\u039b' # 0xCB -> GREEK CAPITAL LETTER LAMDA
+ u'\u039c' # 0xCC -> GREEK CAPITAL LETTER MU
+ u'\u039d' # 0xCD -> GREEK CAPITAL LETTER NU
+ u'\u039e' # 0xCE -> GREEK CAPITAL LETTER XI
+ u'\u039f' # 0xCF -> GREEK CAPITAL LETTER OMICRON
+ u'\u03a0' # 0xD0 -> GREEK CAPITAL LETTER PI
+ u'\u03a1' # 0xD1 -> GREEK CAPITAL LETTER RHO
+ u'\ufffe'
+ u'\u03a3' # 0xD3 -> GREEK CAPITAL LETTER SIGMA
+ u'\u03a4' # 0xD4 -> GREEK CAPITAL LETTER TAU
+ u'\u03a5' # 0xD5 -> GREEK CAPITAL LETTER UPSILON
+ u'\u03a6' # 0xD6 -> GREEK CAPITAL LETTER PHI
+ u'\u03a7' # 0xD7 -> GREEK CAPITAL LETTER CHI
+ u'\u03a8' # 0xD8 -> GREEK CAPITAL LETTER PSI
+ u'\u03a9' # 0xD9 -> GREEK CAPITAL LETTER OMEGA
+ u'\u03aa' # 0xDA -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA
+ u'\u03ab' # 0xDB -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
+ u'\u03ac' # 0xDC -> GREEK SMALL LETTER ALPHA WITH TONOS
+ u'\u03ad' # 0xDD -> GREEK SMALL LETTER EPSILON WITH TONOS
+ u'\u03ae' # 0xDE -> GREEK SMALL LETTER ETA WITH TONOS
+ u'\u03af' # 0xDF -> GREEK SMALL LETTER IOTA WITH TONOS
+ u'\u03b0' # 0xE0 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS
+ u'\u03b1' # 0xE1 -> GREEK SMALL LETTER ALPHA
+ u'\u03b2' # 0xE2 -> GREEK SMALL LETTER BETA
+ u'\u03b3' # 0xE3 -> GREEK SMALL LETTER GAMMA
+ u'\u03b4' # 0xE4 -> GREEK SMALL LETTER DELTA
+ u'\u03b5' # 0xE5 -> GREEK SMALL LETTER EPSILON
+ u'\u03b6' # 0xE6 -> GREEK SMALL LETTER ZETA
+ u'\u03b7' # 0xE7 -> GREEK SMALL LETTER ETA
+ u'\u03b8' # 0xE8 -> GREEK SMALL LETTER THETA
+ u'\u03b9' # 0xE9 -> GREEK SMALL LETTER IOTA
+ u'\u03ba' # 0xEA -> GREEK SMALL LETTER KAPPA
+ u'\u03bb' # 0xEB -> GREEK SMALL LETTER LAMDA
+ u'\u03bc' # 0xEC -> GREEK SMALL LETTER MU
+ u'\u03bd' # 0xED -> GREEK SMALL LETTER NU
+ u'\u03be' # 0xEE -> GREEK SMALL LETTER XI
+ u'\u03bf' # 0xEF -> GREEK SMALL LETTER OMICRON
+ u'\u03c0' # 0xF0 -> GREEK SMALL LETTER PI
+ u'\u03c1' # 0xF1 -> GREEK SMALL LETTER RHO
+ u'\u03c2' # 0xF2 -> GREEK SMALL LETTER FINAL SIGMA
+ u'\u03c3' # 0xF3 -> GREEK SMALL LETTER SIGMA
+ u'\u03c4' # 0xF4 -> GREEK SMALL LETTER TAU
+ u'\u03c5' # 0xF5 -> GREEK SMALL LETTER UPSILON
+ u'\u03c6' # 0xF6 -> GREEK SMALL LETTER PHI
+ u'\u03c7' # 0xF7 -> GREEK SMALL LETTER CHI
+ u'\u03c8' # 0xF8 -> GREEK SMALL LETTER PSI
+ u'\u03c9' # 0xF9 -> GREEK SMALL LETTER OMEGA
+ u'\u03ca' # 0xFA -> GREEK SMALL LETTER IOTA WITH DIALYTIKA
+ u'\u03cb' # 0xFB -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA
+ u'\u03cc' # 0xFC -> GREEK SMALL LETTER OMICRON WITH TONOS
+ u'\u03cd' # 0xFD -> GREEK SMALL LETTER UPSILON WITH TONOS
+ u'\u03ce' # 0xFE -> GREEK SMALL LETTER OMEGA WITH TONOS
+ u'\ufffe'
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..8810aedc74
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_8.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_8 generated from 'MAPPINGS/ISO8859/8859-8.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso8859-8',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\x80' # 0x80 -> <control>
+ u'\x81' # 0x81 -> <control>
+ u'\x82' # 0x82 -> <control>
+ u'\x83' # 0x83 -> <control>
+ u'\x84' # 0x84 -> <control>
+ u'\x85' # 0x85 -> <control>
+ u'\x86' # 0x86 -> <control>
+ u'\x87' # 0x87 -> <control>
+ u'\x88' # 0x88 -> <control>
+ u'\x89' # 0x89 -> <control>
+ u'\x8a' # 0x8A -> <control>
+ u'\x8b' # 0x8B -> <control>
+ u'\x8c' # 0x8C -> <control>
+ u'\x8d' # 0x8D -> <control>
+ u'\x8e' # 0x8E -> <control>
+ u'\x8f' # 0x8F -> <control>
+ u'\x90' # 0x90 -> <control>
+ u'\x91' # 0x91 -> <control>
+ u'\x92' # 0x92 -> <control>
+ u'\x93' # 0x93 -> <control>
+ u'\x94' # 0x94 -> <control>
+ u'\x95' # 0x95 -> <control>
+ u'\x96' # 0x96 -> <control>
+ u'\x97' # 0x97 -> <control>
+ u'\x98' # 0x98 -> <control>
+ u'\x99' # 0x99 -> <control>
+ u'\x9a' # 0x9A -> <control>
+ u'\x9b' # 0x9B -> <control>
+ u'\x9c' # 0x9C -> <control>
+ u'\x9d' # 0x9D -> <control>
+ u'\x9e' # 0x9E -> <control>
+ u'\x9f' # 0x9F -> <control>
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\ufffe'
+ u'\xa2' # 0xA2 -> CENT SIGN
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\xa4' # 0xA4 -> CURRENCY SIGN
+ u'\xa5' # 0xA5 -> YEN SIGN
+ u'\xa6' # 0xA6 -> BROKEN BAR
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\xa8' # 0xA8 -> DIAERESIS
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\xd7' # 0xAA -> MULTIPLICATION SIGN
+ u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xac' # 0xAC -> NOT SIGN
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\xae' # 0xAE -> REGISTERED SIGN
+ u'\xaf' # 0xAF -> MACRON
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\xb2' # 0xB2 -> SUPERSCRIPT TWO
+ u'\xb3' # 0xB3 -> SUPERSCRIPT THREE
+ u'\xb4' # 0xB4 -> ACUTE ACCENT
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xb7' # 0xB7 -> MIDDLE DOT
+ u'\xb8' # 0xB8 -> CEDILLA
+ u'\xb9' # 0xB9 -> SUPERSCRIPT ONE
+ u'\xf7' # 0xBA -> DIVISION SIGN
+ u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER
+ u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF
+ u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\u2017' # 0xDF -> DOUBLE LOW LINE
+ u'\u05d0' # 0xE0 -> HEBREW LETTER ALEF
+ u'\u05d1' # 0xE1 -> HEBREW LETTER BET
+ u'\u05d2' # 0xE2 -> HEBREW LETTER GIMEL
+ u'\u05d3' # 0xE3 -> HEBREW LETTER DALET
+ u'\u05d4' # 0xE4 -> HEBREW LETTER HE
+ u'\u05d5' # 0xE5 -> HEBREW LETTER VAV
+ u'\u05d6' # 0xE6 -> HEBREW LETTER ZAYIN
+ u'\u05d7' # 0xE7 -> HEBREW LETTER HET
+ u'\u05d8' # 0xE8 -> HEBREW LETTER TET
+ u'\u05d9' # 0xE9 -> HEBREW LETTER YOD
+ u'\u05da' # 0xEA -> HEBREW LETTER FINAL KAF
+ u'\u05db' # 0xEB -> HEBREW LETTER KAF
+ u'\u05dc' # 0xEC -> HEBREW LETTER LAMED
+ u'\u05dd' # 0xED -> HEBREW LETTER FINAL MEM
+ u'\u05de' # 0xEE -> HEBREW LETTER MEM
+ u'\u05df' # 0xEF -> HEBREW LETTER FINAL NUN
+ u'\u05e0' # 0xF0 -> HEBREW LETTER NUN
+ u'\u05e1' # 0xF1 -> HEBREW LETTER SAMEKH
+ u'\u05e2' # 0xF2 -> HEBREW LETTER AYIN
+ u'\u05e3' # 0xF3 -> HEBREW LETTER FINAL PE
+ u'\u05e4' # 0xF4 -> HEBREW LETTER PE
+ u'\u05e5' # 0xF5 -> HEBREW LETTER FINAL TSADI
+ u'\u05e6' # 0xF6 -> HEBREW LETTER TSADI
+ u'\u05e7' # 0xF7 -> HEBREW LETTER QOF
+ u'\u05e8' # 0xF8 -> HEBREW LETTER RESH
+ u'\u05e9' # 0xF9 -> HEBREW LETTER SHIN
+ u'\u05ea' # 0xFA -> HEBREW LETTER TAV
+ u'\ufffe'
+ u'\ufffe'
+ u'\u200e' # 0xFD -> LEFT-TO-RIGHT MARK
+ u'\u200f' # 0xFE -> RIGHT-TO-LEFT MARK
+ u'\ufffe'
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..980e99470a
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_9.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec iso8859_9 generated from 'MAPPINGS/ISO8859/8859-9.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso8859-9',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\x80' # 0x80 -> <control>
+ u'\x81' # 0x81 -> <control>
+ u'\x82' # 0x82 -> <control>
+ u'\x83' # 0x83 -> <control>
+ u'\x84' # 0x84 -> <control>
+ u'\x85' # 0x85 -> <control>
+ u'\x86' # 0x86 -> <control>
+ u'\x87' # 0x87 -> <control>
+ u'\x88' # 0x88 -> <control>
+ u'\x89' # 0x89 -> <control>
+ u'\x8a' # 0x8A -> <control>
+ u'\x8b' # 0x8B -> <control>
+ u'\x8c' # 0x8C -> <control>
+ u'\x8d' # 0x8D -> <control>
+ u'\x8e' # 0x8E -> <control>
+ u'\x8f' # 0x8F -> <control>
+ u'\x90' # 0x90 -> <control>
+ u'\x91' # 0x91 -> <control>
+ u'\x92' # 0x92 -> <control>
+ u'\x93' # 0x93 -> <control>
+ u'\x94' # 0x94 -> <control>
+ u'\x95' # 0x95 -> <control>
+ u'\x96' # 0x96 -> <control>
+ u'\x97' # 0x97 -> <control>
+ u'\x98' # 0x98 -> <control>
+ u'\x99' # 0x99 -> <control>
+ u'\x9a' # 0x9A -> <control>
+ u'\x9b' # 0x9B -> <control>
+ u'\x9c' # 0x9C -> <control>
+ u'\x9d' # 0x9D -> <control>
+ u'\x9e' # 0x9E -> <control>
+ u'\x9f' # 0x9F -> <control>
+ u'\xa0' # 0xA0 -> NO-BREAK SPACE
+ u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK
+ u'\xa2' # 0xA2 -> CENT SIGN
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\xa4' # 0xA4 -> CURRENCY SIGN
+ u'\xa5' # 0xA5 -> YEN SIGN
+ u'\xa6' # 0xA6 -> BROKEN BAR
+ u'\xa7' # 0xA7 -> SECTION SIGN
+ u'\xa8' # 0xA8 -> DIAERESIS
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR
+ u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xac' # 0xAC -> NOT SIGN
+ u'\xad' # 0xAD -> SOFT HYPHEN
+ u'\xae' # 0xAE -> REGISTERED SIGN
+ u'\xaf' # 0xAF -> MACRON
+ u'\xb0' # 0xB0 -> DEGREE SIGN
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\xb2' # 0xB2 -> SUPERSCRIPT TWO
+ u'\xb3' # 0xB3 -> SUPERSCRIPT THREE
+ u'\xb4' # 0xB4 -> ACUTE ACCENT
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\xb6' # 0xB6 -> PILCROW SIGN
+ u'\xb7' # 0xB7 -> MIDDLE DOT
+ u'\xb8' # 0xB8 -> CEDILLA
+ u'\xb9' # 0xB9 -> SUPERSCRIPT ONE
+ u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR
+ u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER
+ u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF
+ u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS
+ u'\xbf' # 0xBF -> INVERTED QUESTION MARK
+ u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE
+ u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\u011e' # 0xD0 -> LATIN CAPITAL LETTER G WITH BREVE
+ u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xd7' # 0xD7 -> MULTIPLICATION SIGN
+ u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\u0130' # 0xDD -> LATIN CAPITAL LETTER I WITH DOT ABOVE
+ u'\u015e' # 0xDE -> LATIN CAPITAL LETTER S WITH CEDILLA
+ u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S
+ u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE
+ u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE
+ u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\u011f' # 0xF0 -> LATIN SMALL LETTER G WITH BREVE
+ u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE
+ u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf7' # 0xF7 -> DIVISION SIGN
+ u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE
+ u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\u0131' # 0xFD -> LATIN SMALL LETTER DOTLESS I
+ u'\u015f' # 0xFE -> LATIN SMALL LETTER S WITH CEDILLA
+ u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..5c767cd7ae
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/johab.py
@@ -0,0 +1,39 @@
+#
+# johab.py: Python Unicode Codec for JOHAB
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_kr, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_kr.getcodec('johab')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='johab',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..492a618def
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/koi8_r.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec koi8_r generated from 'MAPPINGS/VENDORS/MISC/KOI8-R.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='koi8-r',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\u2500' # 0x80 -> BOX DRAWINGS LIGHT HORIZONTAL
+ u'\u2502' # 0x81 -> BOX DRAWINGS LIGHT VERTICAL
+ u'\u250c' # 0x82 -> BOX DRAWINGS LIGHT DOWN AND RIGHT
+ u'\u2510' # 0x83 -> BOX DRAWINGS LIGHT DOWN AND LEFT
+ u'\u2514' # 0x84 -> BOX DRAWINGS LIGHT UP AND RIGHT
+ u'\u2518' # 0x85 -> BOX DRAWINGS LIGHT UP AND LEFT
+ u'\u251c' # 0x86 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ u'\u2524' # 0x87 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ u'\u252c' # 0x88 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ u'\u2534' # 0x89 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ u'\u253c' # 0x8A -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ u'\u2580' # 0x8B -> UPPER HALF BLOCK
+ u'\u2584' # 0x8C -> LOWER HALF BLOCK
+ u'\u2588' # 0x8D -> FULL BLOCK
+ u'\u258c' # 0x8E -> LEFT HALF BLOCK
+ u'\u2590' # 0x8F -> RIGHT HALF BLOCK
+ u'\u2591' # 0x90 -> LIGHT SHADE
+ u'\u2592' # 0x91 -> MEDIUM SHADE
+ u'\u2593' # 0x92 -> DARK SHADE
+ u'\u2320' # 0x93 -> TOP HALF INTEGRAL
+ u'\u25a0' # 0x94 -> BLACK SQUARE
+ u'\u2219' # 0x95 -> BULLET OPERATOR
+ u'\u221a' # 0x96 -> SQUARE ROOT
+ u'\u2248' # 0x97 -> ALMOST EQUAL TO
+ u'\u2264' # 0x98 -> LESS-THAN OR EQUAL TO
+ u'\u2265' # 0x99 -> GREATER-THAN OR EQUAL TO
+ u'\xa0' # 0x9A -> NO-BREAK SPACE
+ u'\u2321' # 0x9B -> BOTTOM HALF INTEGRAL
+ u'\xb0' # 0x9C -> DEGREE SIGN
+ u'\xb2' # 0x9D -> SUPERSCRIPT TWO
+ u'\xb7' # 0x9E -> MIDDLE DOT
+ u'\xf7' # 0x9F -> DIVISION SIGN
+ u'\u2550' # 0xA0 -> BOX DRAWINGS DOUBLE HORIZONTAL
+ u'\u2551' # 0xA1 -> BOX DRAWINGS DOUBLE VERTICAL
+ u'\u2552' # 0xA2 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ u'\u0451' # 0xA3 -> CYRILLIC SMALL LETTER IO
+ u'\u2553' # 0xA4 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+ u'\u2554' # 0xA5 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ u'\u2555' # 0xA6 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+ u'\u2556' # 0xA7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+ u'\u2557' # 0xA8 -> BOX DRAWINGS DOUBLE DOWN AND LEFT
+ u'\u2558' # 0xA9 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ u'\u2559' # 0xAA -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ u'\u255a' # 0xAB -> BOX DRAWINGS DOUBLE UP AND RIGHT
+ u'\u255b' # 0xAC -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ u'\u255c' # 0xAD -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+ u'\u255d' # 0xAE -> BOX DRAWINGS DOUBLE UP AND LEFT
+ u'\u255e' # 0xAF -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ u'\u255f' # 0xB0 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ u'\u2560' # 0xB1 -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ u'\u2561' # 0xB2 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ u'\u0401' # 0xB3 -> CYRILLIC CAPITAL LETTER IO
+ u'\u2562' # 0xB4 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+ u'\u2563' # 0xB5 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ u'\u2564' # 0xB6 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+ u'\u2565' # 0xB7 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+ u'\u2566' # 0xB8 -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ u'\u2567' # 0xB9 -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ u'\u2568' # 0xBA -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ u'\u2569' # 0xBB -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ u'\u256a' # 0xBC -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ u'\u256b' # 0xBD -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+ u'\u256c' # 0xBE -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ u'\xa9' # 0xBF -> COPYRIGHT SIGN
+ u'\u044e' # 0xC0 -> CYRILLIC SMALL LETTER YU
+ u'\u0430' # 0xC1 -> CYRILLIC SMALL LETTER A
+ u'\u0431' # 0xC2 -> CYRILLIC SMALL LETTER BE
+ u'\u0446' # 0xC3 -> CYRILLIC SMALL LETTER TSE
+ u'\u0434' # 0xC4 -> CYRILLIC SMALL LETTER DE
+ u'\u0435' # 0xC5 -> CYRILLIC SMALL LETTER IE
+ u'\u0444' # 0xC6 -> CYRILLIC SMALL LETTER EF
+ u'\u0433' # 0xC7 -> CYRILLIC SMALL LETTER GHE
+ u'\u0445' # 0xC8 -> CYRILLIC SMALL LETTER HA
+ u'\u0438' # 0xC9 -> CYRILLIC SMALL LETTER I
+ u'\u0439' # 0xCA -> CYRILLIC SMALL LETTER SHORT I
+ u'\u043a' # 0xCB -> CYRILLIC SMALL LETTER KA
+ u'\u043b' # 0xCC -> CYRILLIC SMALL LETTER EL
+ u'\u043c' # 0xCD -> CYRILLIC SMALL LETTER EM
+ u'\u043d' # 0xCE -> CYRILLIC SMALL LETTER EN
+ u'\u043e' # 0xCF -> CYRILLIC SMALL LETTER O
+ u'\u043f' # 0xD0 -> CYRILLIC SMALL LETTER PE
+ u'\u044f' # 0xD1 -> CYRILLIC SMALL LETTER YA
+ u'\u0440' # 0xD2 -> CYRILLIC SMALL LETTER ER
+ u'\u0441' # 0xD3 -> CYRILLIC SMALL LETTER ES
+ u'\u0442' # 0xD4 -> CYRILLIC SMALL LETTER TE
+ u'\u0443' # 0xD5 -> CYRILLIC SMALL LETTER U
+ u'\u0436' # 0xD6 -> CYRILLIC SMALL LETTER ZHE
+ u'\u0432' # 0xD7 -> CYRILLIC SMALL LETTER VE
+ u'\u044c' # 0xD8 -> CYRILLIC SMALL LETTER SOFT SIGN
+ u'\u044b' # 0xD9 -> CYRILLIC SMALL LETTER YERU
+ u'\u0437' # 0xDA -> CYRILLIC SMALL LETTER ZE
+ u'\u0448' # 0xDB -> CYRILLIC SMALL LETTER SHA
+ u'\u044d' # 0xDC -> CYRILLIC SMALL LETTER E
+ u'\u0449' # 0xDD -> CYRILLIC SMALL LETTER SHCHA
+ u'\u0447' # 0xDE -> CYRILLIC SMALL LETTER CHE
+ u'\u044a' # 0xDF -> CYRILLIC SMALL LETTER HARD SIGN
+ u'\u042e' # 0xE0 -> CYRILLIC CAPITAL LETTER YU
+ u'\u0410' # 0xE1 -> CYRILLIC CAPITAL LETTER A
+ u'\u0411' # 0xE2 -> CYRILLIC CAPITAL LETTER BE
+ u'\u0426' # 0xE3 -> CYRILLIC CAPITAL LETTER TSE
+ u'\u0414' # 0xE4 -> CYRILLIC CAPITAL LETTER DE
+ u'\u0415' # 0xE5 -> CYRILLIC CAPITAL LETTER IE
+ u'\u0424' # 0xE6 -> CYRILLIC CAPITAL LETTER EF
+ u'\u0413' # 0xE7 -> CYRILLIC CAPITAL LETTER GHE
+ u'\u0425' # 0xE8 -> CYRILLIC CAPITAL LETTER HA
+ u'\u0418' # 0xE9 -> CYRILLIC CAPITAL LETTER I
+ u'\u0419' # 0xEA -> CYRILLIC CAPITAL LETTER SHORT I
+ u'\u041a' # 0xEB -> CYRILLIC CAPITAL LETTER KA
+ u'\u041b' # 0xEC -> CYRILLIC CAPITAL LETTER EL
+ u'\u041c' # 0xED -> CYRILLIC CAPITAL LETTER EM
+ u'\u041d' # 0xEE -> CYRILLIC CAPITAL LETTER EN
+ u'\u041e' # 0xEF -> CYRILLIC CAPITAL LETTER O
+ u'\u041f' # 0xF0 -> CYRILLIC CAPITAL LETTER PE
+ u'\u042f' # 0xF1 -> CYRILLIC CAPITAL LETTER YA
+ u'\u0420' # 0xF2 -> CYRILLIC CAPITAL LETTER ER
+ u'\u0421' # 0xF3 -> CYRILLIC CAPITAL LETTER ES
+ u'\u0422' # 0xF4 -> CYRILLIC CAPITAL LETTER TE
+ u'\u0423' # 0xF5 -> CYRILLIC CAPITAL LETTER U
+ u'\u0416' # 0xF6 -> CYRILLIC CAPITAL LETTER ZHE
+ u'\u0412' # 0xF7 -> CYRILLIC CAPITAL LETTER VE
+ u'\u042c' # 0xF8 -> CYRILLIC CAPITAL LETTER SOFT SIGN
+ u'\u042b' # 0xF9 -> CYRILLIC CAPITAL LETTER YERU
+ u'\u0417' # 0xFA -> CYRILLIC CAPITAL LETTER ZE
+ u'\u0428' # 0xFB -> CYRILLIC CAPITAL LETTER SHA
+ u'\u042d' # 0xFC -> CYRILLIC CAPITAL LETTER E
+ u'\u0429' # 0xFD -> CYRILLIC CAPITAL LETTER SHCHA
+ u'\u0427' # 0xFE -> CYRILLIC CAPITAL LETTER CHE
+ u'\u042a' # 0xFF -> CYRILLIC CAPITAL LETTER HARD SIGN
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..edb85f4839
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/koi8_u.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec koi8_u generated from 'python-mappings/KOI8-U.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='koi8-u',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\u2500' # 0x80 -> BOX DRAWINGS LIGHT HORIZONTAL
+ u'\u2502' # 0x81 -> BOX DRAWINGS LIGHT VERTICAL
+ u'\u250c' # 0x82 -> BOX DRAWINGS LIGHT DOWN AND RIGHT
+ u'\u2510' # 0x83 -> BOX DRAWINGS LIGHT DOWN AND LEFT
+ u'\u2514' # 0x84 -> BOX DRAWINGS LIGHT UP AND RIGHT
+ u'\u2518' # 0x85 -> BOX DRAWINGS LIGHT UP AND LEFT
+ u'\u251c' # 0x86 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+ u'\u2524' # 0x87 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT
+ u'\u252c' # 0x88 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+ u'\u2534' # 0x89 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL
+ u'\u253c' # 0x8A -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+ u'\u2580' # 0x8B -> UPPER HALF BLOCK
+ u'\u2584' # 0x8C -> LOWER HALF BLOCK
+ u'\u2588' # 0x8D -> FULL BLOCK
+ u'\u258c' # 0x8E -> LEFT HALF BLOCK
+ u'\u2590' # 0x8F -> RIGHT HALF BLOCK
+ u'\u2591' # 0x90 -> LIGHT SHADE
+ u'\u2592' # 0x91 -> MEDIUM SHADE
+ u'\u2593' # 0x92 -> DARK SHADE
+ u'\u2320' # 0x93 -> TOP HALF INTEGRAL
+ u'\u25a0' # 0x94 -> BLACK SQUARE
+ u'\u2219' # 0x95 -> BULLET OPERATOR
+ u'\u221a' # 0x96 -> SQUARE ROOT
+ u'\u2248' # 0x97 -> ALMOST EQUAL TO
+ u'\u2264' # 0x98 -> LESS-THAN OR EQUAL TO
+ u'\u2265' # 0x99 -> GREATER-THAN OR EQUAL TO
+ u'\xa0' # 0x9A -> NO-BREAK SPACE
+ u'\u2321' # 0x9B -> BOTTOM HALF INTEGRAL
+ u'\xb0' # 0x9C -> DEGREE SIGN
+ u'\xb2' # 0x9D -> SUPERSCRIPT TWO
+ u'\xb7' # 0x9E -> MIDDLE DOT
+ u'\xf7' # 0x9F -> DIVISION SIGN
+ u'\u2550' # 0xA0 -> BOX DRAWINGS DOUBLE HORIZONTAL
+ u'\u2551' # 0xA1 -> BOX DRAWINGS DOUBLE VERTICAL
+ u'\u2552' # 0xA2 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+ u'\u0451' # 0xA3 -> CYRILLIC SMALL LETTER IO
+ u'\u0454' # 0xA4 -> CYRILLIC SMALL LETTER UKRAINIAN IE
+ u'\u2554' # 0xA5 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT
+ u'\u0456' # 0xA6 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
+ u'\u0457' # 0xA7 -> CYRILLIC SMALL LETTER YI (UKRAINIAN)
+ u'\u2557' # 0xA8 -> BOX DRAWINGS DOUBLE DOWN AND LEFT
+ u'\u2558' # 0xA9 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+ u'\u2559' # 0xAA -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+ u'\u255a' # 0xAB -> BOX DRAWINGS DOUBLE UP AND RIGHT
+ u'\u255b' # 0xAC -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+ u'\u0491' # 0xAD -> CYRILLIC SMALL LETTER UKRAINIAN GHE WITH UPTURN
+ u'\u255d' # 0xAE -> BOX DRAWINGS DOUBLE UP AND LEFT
+ u'\u255e' # 0xAF -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+ u'\u255f' # 0xB0 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+ u'\u2560' # 0xB1 -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+ u'\u2561' # 0xB2 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+ u'\u0401' # 0xB3 -> CYRILLIC CAPITAL LETTER IO
+ u'\u0404' # 0xB4 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE
+ u'\u2563' # 0xB5 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+ u'\u0406' # 0xB6 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
+ u'\u0407' # 0xB7 -> CYRILLIC CAPITAL LETTER YI (UKRAINIAN)
+ u'\u2566' # 0xB8 -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+ u'\u2567' # 0xB9 -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+ u'\u2568' # 0xBA -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+ u'\u2569' # 0xBB -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+ u'\u256a' # 0xBC -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+ u'\u0490' # 0xBD -> CYRILLIC CAPITAL LETTER UKRAINIAN GHE WITH UPTURN
+ u'\u256c' # 0xBE -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+ u'\xa9' # 0xBF -> COPYRIGHT SIGN
+ u'\u044e' # 0xC0 -> CYRILLIC SMALL LETTER YU
+ u'\u0430' # 0xC1 -> CYRILLIC SMALL LETTER A
+ u'\u0431' # 0xC2 -> CYRILLIC SMALL LETTER BE
+ u'\u0446' # 0xC3 -> CYRILLIC SMALL LETTER TSE
+ u'\u0434' # 0xC4 -> CYRILLIC SMALL LETTER DE
+ u'\u0435' # 0xC5 -> CYRILLIC SMALL LETTER IE
+ u'\u0444' # 0xC6 -> CYRILLIC SMALL LETTER EF
+ u'\u0433' # 0xC7 -> CYRILLIC SMALL LETTER GHE
+ u'\u0445' # 0xC8 -> CYRILLIC SMALL LETTER HA
+ u'\u0438' # 0xC9 -> CYRILLIC SMALL LETTER I
+ u'\u0439' # 0xCA -> CYRILLIC SMALL LETTER SHORT I
+ u'\u043a' # 0xCB -> CYRILLIC SMALL LETTER KA
+ u'\u043b' # 0xCC -> CYRILLIC SMALL LETTER EL
+ u'\u043c' # 0xCD -> CYRILLIC SMALL LETTER EM
+ u'\u043d' # 0xCE -> CYRILLIC SMALL LETTER EN
+ u'\u043e' # 0xCF -> CYRILLIC SMALL LETTER O
+ u'\u043f' # 0xD0 -> CYRILLIC SMALL LETTER PE
+ u'\u044f' # 0xD1 -> CYRILLIC SMALL LETTER YA
+ u'\u0440' # 0xD2 -> CYRILLIC SMALL LETTER ER
+ u'\u0441' # 0xD3 -> CYRILLIC SMALL LETTER ES
+ u'\u0442' # 0xD4 -> CYRILLIC SMALL LETTER TE
+ u'\u0443' # 0xD5 -> CYRILLIC SMALL LETTER U
+ u'\u0436' # 0xD6 -> CYRILLIC SMALL LETTER ZHE
+ u'\u0432' # 0xD7 -> CYRILLIC SMALL LETTER VE
+ u'\u044c' # 0xD8 -> CYRILLIC SMALL LETTER SOFT SIGN
+ u'\u044b' # 0xD9 -> CYRILLIC SMALL LETTER YERU
+ u'\u0437' # 0xDA -> CYRILLIC SMALL LETTER ZE
+ u'\u0448' # 0xDB -> CYRILLIC SMALL LETTER SHA
+ u'\u044d' # 0xDC -> CYRILLIC SMALL LETTER E
+ u'\u0449' # 0xDD -> CYRILLIC SMALL LETTER SHCHA
+ u'\u0447' # 0xDE -> CYRILLIC SMALL LETTER CHE
+ u'\u044a' # 0xDF -> CYRILLIC SMALL LETTER HARD SIGN
+ u'\u042e' # 0xE0 -> CYRILLIC CAPITAL LETTER YU
+ u'\u0410' # 0xE1 -> CYRILLIC CAPITAL LETTER A
+ u'\u0411' # 0xE2 -> CYRILLIC CAPITAL LETTER BE
+ u'\u0426' # 0xE3 -> CYRILLIC CAPITAL LETTER TSE
+ u'\u0414' # 0xE4 -> CYRILLIC CAPITAL LETTER DE
+ u'\u0415' # 0xE5 -> CYRILLIC CAPITAL LETTER IE
+ u'\u0424' # 0xE6 -> CYRILLIC CAPITAL LETTER EF
+ u'\u0413' # 0xE7 -> CYRILLIC CAPITAL LETTER GHE
+ u'\u0425' # 0xE8 -> CYRILLIC CAPITAL LETTER HA
+ u'\u0418' # 0xE9 -> CYRILLIC CAPITAL LETTER I
+ u'\u0419' # 0xEA -> CYRILLIC CAPITAL LETTER SHORT I
+ u'\u041a' # 0xEB -> CYRILLIC CAPITAL LETTER KA
+ u'\u041b' # 0xEC -> CYRILLIC CAPITAL LETTER EL
+ u'\u041c' # 0xED -> CYRILLIC CAPITAL LETTER EM
+ u'\u041d' # 0xEE -> CYRILLIC CAPITAL LETTER EN
+ u'\u041e' # 0xEF -> CYRILLIC CAPITAL LETTER O
+ u'\u041f' # 0xF0 -> CYRILLIC CAPITAL LETTER PE
+ u'\u042f' # 0xF1 -> CYRILLIC CAPITAL LETTER YA
+ u'\u0420' # 0xF2 -> CYRILLIC CAPITAL LETTER ER
+ u'\u0421' # 0xF3 -> CYRILLIC CAPITAL LETTER ES
+ u'\u0422' # 0xF4 -> CYRILLIC CAPITAL LETTER TE
+ u'\u0423' # 0xF5 -> CYRILLIC CAPITAL LETTER U
+ u'\u0416' # 0xF6 -> CYRILLIC CAPITAL LETTER ZHE
+ u'\u0412' # 0xF7 -> CYRILLIC CAPITAL LETTER VE
+ u'\u042c' # 0xF8 -> CYRILLIC CAPITAL LETTER SOFT SIGN
+ u'\u042b' # 0xF9 -> CYRILLIC CAPITAL LETTER YERU
+ u'\u0417' # 0xFA -> CYRILLIC CAPITAL LETTER ZE
+ u'\u0428' # 0xFB -> CYRILLIC CAPITAL LETTER SHA
+ u'\u042d' # 0xFC -> CYRILLIC CAPITAL LETTER E
+ u'\u0429' # 0xFD -> CYRILLIC CAPITAL LETTER SHCHA
+ u'\u0427' # 0xFE -> CYRILLIC CAPITAL LETTER CHE
+ u'\u042a' # 0xFF -> CYRILLIC CAPITAL LETTER HARD SIGN
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..a6193bc855
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/latin_1.py
@@ -0,0 +1,50 @@
+""" Python 'latin-1' Codec
+
+
+Written by Marc-Andre Lemburg (mal@lemburg.com).
+
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
+
+"""
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ # Note: Binding these as C functions will result in the class not
+ # converting them to methods. This is intended.
+ encode = codecs.latin_1_encode
+ decode = codecs.latin_1_decode
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.latin_1_encode(input,self.errors)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.latin_1_decode(input,self.errors)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+class StreamConverter(StreamWriter,StreamReader):
+
+ encode = codecs.latin_1_decode
+ decode = codecs.latin_1_encode
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='iso8859-1',
+ encode=Codec.encode,
+ decode=Codec.decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..e5e63e3c36
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_arabic.py
@@ -0,0 +1,698 @@
+""" Python Character Mapping Codec generated from 'VENDORS/APPLE/ARABIC.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='mac-arabic',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0080: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x0081: 0x00a0, # NO-BREAK SPACE, right-left
+ 0x0082: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x0083: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x0084: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE
+ 0x0085: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x0086: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x0087: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE
+ 0x0088: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE
+ 0x0089: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x008a: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x008b: 0x06ba, # ARABIC LETTER NOON GHUNNA
+ 0x008c: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left
+ 0x008d: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x008e: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE
+ 0x008f: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE
+ 0x0090: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX
+ 0x0091: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS
+ 0x0092: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE
+ 0x0093: 0x2026, # HORIZONTAL ELLIPSIS, right-left
+ 0x0094: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX
+ 0x0095: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS
+ 0x0096: 0x00f1, # LATIN SMALL LETTER N WITH TILDE
+ 0x0097: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE
+ 0x0098: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left
+ 0x0099: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x009a: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x009b: 0x00f7, # DIVISION SIGN, right-left
+ 0x009c: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE
+ 0x009d: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE
+ 0x009e: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX
+ 0x009f: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x00a0: 0x0020, # SPACE, right-left
+ 0x00a1: 0x0021, # EXCLAMATION MARK, right-left
+ 0x00a2: 0x0022, # QUOTATION MARK, right-left
+ 0x00a3: 0x0023, # NUMBER SIGN, right-left
+ 0x00a4: 0x0024, # DOLLAR SIGN, right-left
+ 0x00a5: 0x066a, # ARABIC PERCENT SIGN
+ 0x00a6: 0x0026, # AMPERSAND, right-left
+ 0x00a7: 0x0027, # APOSTROPHE, right-left
+ 0x00a8: 0x0028, # LEFT PARENTHESIS, right-left
+ 0x00a9: 0x0029, # RIGHT PARENTHESIS, right-left
+ 0x00aa: 0x002a, # ASTERISK, right-left
+ 0x00ab: 0x002b, # PLUS SIGN, right-left
+ 0x00ac: 0x060c, # ARABIC COMMA
+ 0x00ad: 0x002d, # HYPHEN-MINUS, right-left
+ 0x00ae: 0x002e, # FULL STOP, right-left
+ 0x00af: 0x002f, # SOLIDUS, right-left
+ 0x00b0: 0x0660, # ARABIC-INDIC DIGIT ZERO, right-left (need override)
+ 0x00b1: 0x0661, # ARABIC-INDIC DIGIT ONE, right-left (need override)
+ 0x00b2: 0x0662, # ARABIC-INDIC DIGIT TWO, right-left (need override)
+ 0x00b3: 0x0663, # ARABIC-INDIC DIGIT THREE, right-left (need override)
+ 0x00b4: 0x0664, # ARABIC-INDIC DIGIT FOUR, right-left (need override)
+ 0x00b5: 0x0665, # ARABIC-INDIC DIGIT FIVE, right-left (need override)
+ 0x00b6: 0x0666, # ARABIC-INDIC DIGIT SIX, right-left (need override)
+ 0x00b7: 0x0667, # ARABIC-INDIC DIGIT SEVEN, right-left (need override)
+ 0x00b8: 0x0668, # ARABIC-INDIC DIGIT EIGHT, right-left (need override)
+ 0x00b9: 0x0669, # ARABIC-INDIC DIGIT NINE, right-left (need override)
+ 0x00ba: 0x003a, # COLON, right-left
+ 0x00bb: 0x061b, # ARABIC SEMICOLON
+ 0x00bc: 0x003c, # LESS-THAN SIGN, right-left
+ 0x00bd: 0x003d, # EQUALS SIGN, right-left
+ 0x00be: 0x003e, # GREATER-THAN SIGN, right-left
+ 0x00bf: 0x061f, # ARABIC QUESTION MARK
+ 0x00c0: 0x274a, # EIGHT TEARDROP-SPOKED PROPELLER ASTERISK, right-left
+ 0x00c1: 0x0621, # ARABIC LETTER HAMZA
+ 0x00c2: 0x0622, # ARABIC LETTER ALEF WITH MADDA ABOVE
+ 0x00c3: 0x0623, # ARABIC LETTER ALEF WITH HAMZA ABOVE
+ 0x00c4: 0x0624, # ARABIC LETTER WAW WITH HAMZA ABOVE
+ 0x00c5: 0x0625, # ARABIC LETTER ALEF WITH HAMZA BELOW
+ 0x00c6: 0x0626, # ARABIC LETTER YEH WITH HAMZA ABOVE
+ 0x00c7: 0x0627, # ARABIC LETTER ALEF
+ 0x00c8: 0x0628, # ARABIC LETTER BEH
+ 0x00c9: 0x0629, # ARABIC LETTER TEH MARBUTA
+ 0x00ca: 0x062a, # ARABIC LETTER TEH
+ 0x00cb: 0x062b, # ARABIC LETTER THEH
+ 0x00cc: 0x062c, # ARABIC LETTER JEEM
+ 0x00cd: 0x062d, # ARABIC LETTER HAH
+ 0x00ce: 0x062e, # ARABIC LETTER KHAH
+ 0x00cf: 0x062f, # ARABIC LETTER DAL
+ 0x00d0: 0x0630, # ARABIC LETTER THAL
+ 0x00d1: 0x0631, # ARABIC LETTER REH
+ 0x00d2: 0x0632, # ARABIC LETTER ZAIN
+ 0x00d3: 0x0633, # ARABIC LETTER SEEN
+ 0x00d4: 0x0634, # ARABIC LETTER SHEEN
+ 0x00d5: 0x0635, # ARABIC LETTER SAD
+ 0x00d6: 0x0636, # ARABIC LETTER DAD
+ 0x00d7: 0x0637, # ARABIC LETTER TAH
+ 0x00d8: 0x0638, # ARABIC LETTER ZAH
+ 0x00d9: 0x0639, # ARABIC LETTER AIN
+ 0x00da: 0x063a, # ARABIC LETTER GHAIN
+ 0x00db: 0x005b, # LEFT SQUARE BRACKET, right-left
+ 0x00dc: 0x005c, # REVERSE SOLIDUS, right-left
+ 0x00dd: 0x005d, # RIGHT SQUARE BRACKET, right-left
+ 0x00de: 0x005e, # CIRCUMFLEX ACCENT, right-left
+ 0x00df: 0x005f, # LOW LINE, right-left
+ 0x00e0: 0x0640, # ARABIC TATWEEL
+ 0x00e1: 0x0641, # ARABIC LETTER FEH
+ 0x00e2: 0x0642, # ARABIC LETTER QAF
+ 0x00e3: 0x0643, # ARABIC LETTER KAF
+ 0x00e4: 0x0644, # ARABIC LETTER LAM
+ 0x00e5: 0x0645, # ARABIC LETTER MEEM
+ 0x00e6: 0x0646, # ARABIC LETTER NOON
+ 0x00e7: 0x0647, # ARABIC LETTER HEH
+ 0x00e8: 0x0648, # ARABIC LETTER WAW
+ 0x00e9: 0x0649, # ARABIC LETTER ALEF MAKSURA
+ 0x00ea: 0x064a, # ARABIC LETTER YEH
+ 0x00eb: 0x064b, # ARABIC FATHATAN
+ 0x00ec: 0x064c, # ARABIC DAMMATAN
+ 0x00ed: 0x064d, # ARABIC KASRATAN
+ 0x00ee: 0x064e, # ARABIC FATHA
+ 0x00ef: 0x064f, # ARABIC DAMMA
+ 0x00f0: 0x0650, # ARABIC KASRA
+ 0x00f1: 0x0651, # ARABIC SHADDA
+ 0x00f2: 0x0652, # ARABIC SUKUN
+ 0x00f3: 0x067e, # ARABIC LETTER PEH
+ 0x00f4: 0x0679, # ARABIC LETTER TTEH
+ 0x00f5: 0x0686, # ARABIC LETTER TCHEH
+ 0x00f6: 0x06d5, # ARABIC LETTER AE
+ 0x00f7: 0x06a4, # ARABIC LETTER VEH
+ 0x00f8: 0x06af, # ARABIC LETTER GAF
+ 0x00f9: 0x0688, # ARABIC LETTER DDAL
+ 0x00fa: 0x0691, # ARABIC LETTER RREH
+ 0x00fb: 0x007b, # LEFT CURLY BRACKET, right-left
+ 0x00fc: 0x007c, # VERTICAL LINE, right-left
+ 0x00fd: 0x007d, # RIGHT CURLY BRACKET, right-left
+ 0x00fe: 0x0698, # ARABIC LETTER JEH
+ 0x00ff: 0x06d2, # ARABIC LETTER YEH BARREE
+})
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x0000 -> CONTROL CHARACTER
+ u'\x01' # 0x0001 -> CONTROL CHARACTER
+ u'\x02' # 0x0002 -> CONTROL CHARACTER
+ u'\x03' # 0x0003 -> CONTROL CHARACTER
+ u'\x04' # 0x0004 -> CONTROL CHARACTER
+ u'\x05' # 0x0005 -> CONTROL CHARACTER
+ u'\x06' # 0x0006 -> CONTROL CHARACTER
+ u'\x07' # 0x0007 -> CONTROL CHARACTER
+ u'\x08' # 0x0008 -> CONTROL CHARACTER
+ u'\t' # 0x0009 -> CONTROL CHARACTER
+ u'\n' # 0x000a -> CONTROL CHARACTER
+ u'\x0b' # 0x000b -> CONTROL CHARACTER
+ u'\x0c' # 0x000c -> CONTROL CHARACTER
+ u'\r' # 0x000d -> CONTROL CHARACTER
+ u'\x0e' # 0x000e -> CONTROL CHARACTER
+ u'\x0f' # 0x000f -> CONTROL CHARACTER
+ u'\x10' # 0x0010 -> CONTROL CHARACTER
+ u'\x11' # 0x0011 -> CONTROL CHARACTER
+ u'\x12' # 0x0012 -> CONTROL CHARACTER
+ u'\x13' # 0x0013 -> CONTROL CHARACTER
+ u'\x14' # 0x0014 -> CONTROL CHARACTER
+ u'\x15' # 0x0015 -> CONTROL CHARACTER
+ u'\x16' # 0x0016 -> CONTROL CHARACTER
+ u'\x17' # 0x0017 -> CONTROL CHARACTER
+ u'\x18' # 0x0018 -> CONTROL CHARACTER
+ u'\x19' # 0x0019 -> CONTROL CHARACTER
+ u'\x1a' # 0x001a -> CONTROL CHARACTER
+ u'\x1b' # 0x001b -> CONTROL CHARACTER
+ u'\x1c' # 0x001c -> CONTROL CHARACTER
+ u'\x1d' # 0x001d -> CONTROL CHARACTER
+ u'\x1e' # 0x001e -> CONTROL CHARACTER
+ u'\x1f' # 0x001f -> CONTROL CHARACTER
+ u' ' # 0x0020 -> SPACE, left-right
+ u'!' # 0x0021 -> EXCLAMATION MARK, left-right
+ u'"' # 0x0022 -> QUOTATION MARK, left-right
+ u'#' # 0x0023 -> NUMBER SIGN, left-right
+ u'$' # 0x0024 -> DOLLAR SIGN, left-right
+ u'%' # 0x0025 -> PERCENT SIGN, left-right
+ u'&' # 0x0026 -> AMPERSAND, left-right
+ u"'" # 0x0027 -> APOSTROPHE, left-right
+ u'(' # 0x0028 -> LEFT PARENTHESIS, left-right
+ u')' # 0x0029 -> RIGHT PARENTHESIS, left-right
+ u'*' # 0x002a -> ASTERISK, left-right
+ u'+' # 0x002b -> PLUS SIGN, left-right
+ u',' # 0x002c -> COMMA, left-right; in Arabic-script context, displayed as 0x066C ARABIC THOUSANDS SEPARATOR
+ u'-' # 0x002d -> HYPHEN-MINUS, left-right
+ u'.' # 0x002e -> FULL STOP, left-right; in Arabic-script context, displayed as 0x066B ARABIC DECIMAL SEPARATOR
+ u'/' # 0x002f -> SOLIDUS, left-right
+ u'0' # 0x0030 -> DIGIT ZERO; in Arabic-script context, displayed as 0x0660 ARABIC-INDIC DIGIT ZERO
+ u'1' # 0x0031 -> DIGIT ONE; in Arabic-script context, displayed as 0x0661 ARABIC-INDIC DIGIT ONE
+ u'2' # 0x0032 -> DIGIT TWO; in Arabic-script context, displayed as 0x0662 ARABIC-INDIC DIGIT TWO
+ u'3' # 0x0033 -> DIGIT THREE; in Arabic-script context, displayed as 0x0663 ARABIC-INDIC DIGIT THREE
+ u'4' # 0x0034 -> DIGIT FOUR; in Arabic-script context, displayed as 0x0664 ARABIC-INDIC DIGIT FOUR
+ u'5' # 0x0035 -> DIGIT FIVE; in Arabic-script context, displayed as 0x0665 ARABIC-INDIC DIGIT FIVE
+ u'6' # 0x0036 -> DIGIT SIX; in Arabic-script context, displayed as 0x0666 ARABIC-INDIC DIGIT SIX
+ u'7' # 0x0037 -> DIGIT SEVEN; in Arabic-script context, displayed as 0x0667 ARABIC-INDIC DIGIT SEVEN
+ u'8' # 0x0038 -> DIGIT EIGHT; in Arabic-script context, displayed as 0x0668 ARABIC-INDIC DIGIT EIGHT
+ u'9' # 0x0039 -> DIGIT NINE; in Arabic-script context, displayed as 0x0669 ARABIC-INDIC DIGIT NINE
+ u':' # 0x003a -> COLON, left-right
+ u';' # 0x003b -> SEMICOLON, left-right
+ u'<' # 0x003c -> LESS-THAN SIGN, left-right
+ u'=' # 0x003d -> EQUALS SIGN, left-right
+ u'>' # 0x003e -> GREATER-THAN SIGN, left-right
+ u'?' # 0x003f -> QUESTION MARK, left-right
+ u'@' # 0x0040 -> COMMERCIAL AT
+ u'A' # 0x0041 -> LATIN CAPITAL LETTER A
+ u'B' # 0x0042 -> LATIN CAPITAL LETTER B
+ u'C' # 0x0043 -> LATIN CAPITAL LETTER C
+ u'D' # 0x0044 -> LATIN CAPITAL LETTER D
+ u'E' # 0x0045 -> LATIN CAPITAL LETTER E
+ u'F' # 0x0046 -> LATIN CAPITAL LETTER F
+ u'G' # 0x0047 -> LATIN CAPITAL LETTER G
+ u'H' # 0x0048 -> LATIN CAPITAL LETTER H
+ u'I' # 0x0049 -> LATIN CAPITAL LETTER I
+ u'J' # 0x004a -> LATIN CAPITAL LETTER J
+ u'K' # 0x004b -> LATIN CAPITAL LETTER K
+ u'L' # 0x004c -> LATIN CAPITAL LETTER L
+ u'M' # 0x004d -> LATIN CAPITAL LETTER M
+ u'N' # 0x004e -> LATIN CAPITAL LETTER N
+ u'O' # 0x004f -> LATIN CAPITAL LETTER O
+ u'P' # 0x0050 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x0052 -> LATIN CAPITAL LETTER R
+ u'S' # 0x0053 -> LATIN CAPITAL LETTER S
+ u'T' # 0x0054 -> LATIN CAPITAL LETTER T
+ u'U' # 0x0055 -> LATIN CAPITAL LETTER U
+ u'V' # 0x0056 -> LATIN CAPITAL LETTER V
+ u'W' # 0x0057 -> LATIN CAPITAL LETTER W
+ u'X' # 0x0058 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x005a -> LATIN CAPITAL LETTER Z
+ u'[' # 0x005b -> LEFT SQUARE BRACKET, left-right
+ u'\\' # 0x005c -> REVERSE SOLIDUS, left-right
+ u']' # 0x005d -> RIGHT SQUARE BRACKET, left-right
+ u'^' # 0x005e -> CIRCUMFLEX ACCENT, left-right
+ u'_' # 0x005f -> LOW LINE, left-right
+ u'`' # 0x0060 -> GRAVE ACCENT
+ u'a' # 0x0061 -> LATIN SMALL LETTER A
+ u'b' # 0x0062 -> LATIN SMALL LETTER B
+ u'c' # 0x0063 -> LATIN SMALL LETTER C
+ u'd' # 0x0064 -> LATIN SMALL LETTER D
+ u'e' # 0x0065 -> LATIN SMALL LETTER E
+ u'f' # 0x0066 -> LATIN SMALL LETTER F
+ u'g' # 0x0067 -> LATIN SMALL LETTER G
+ u'h' # 0x0068 -> LATIN SMALL LETTER H
+ u'i' # 0x0069 -> LATIN SMALL LETTER I
+ u'j' # 0x006a -> LATIN SMALL LETTER J
+ u'k' # 0x006b -> LATIN SMALL LETTER K
+ u'l' # 0x006c -> LATIN SMALL LETTER L
+ u'm' # 0x006d -> LATIN SMALL LETTER M
+ u'n' # 0x006e -> LATIN SMALL LETTER N
+ u'o' # 0x006f -> LATIN SMALL LETTER O
+ u'p' # 0x0070 -> LATIN SMALL LETTER P
+ u'q' # 0x0071 -> LATIN SMALL LETTER Q
+ u'r' # 0x0072 -> LATIN SMALL LETTER R
+ u's' # 0x0073 -> LATIN SMALL LETTER S
+ u't' # 0x0074 -> LATIN SMALL LETTER T
+ u'u' # 0x0075 -> LATIN SMALL LETTER U
+ u'v' # 0x0076 -> LATIN SMALL LETTER V
+ u'w' # 0x0077 -> LATIN SMALL LETTER W
+ u'x' # 0x0078 -> LATIN SMALL LETTER X
+ u'y' # 0x0079 -> LATIN SMALL LETTER Y
+ u'z' # 0x007a -> LATIN SMALL LETTER Z
+ u'{' # 0x007b -> LEFT CURLY BRACKET, left-right
+ u'|' # 0x007c -> VERTICAL LINE, left-right
+ u'}' # 0x007d -> RIGHT CURLY BRACKET, left-right
+ u'~' # 0x007e -> TILDE
+ u'\x7f' # 0x007f -> CONTROL CHARACTER
+ u'\xc4' # 0x0080 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xa0' # 0x0081 -> NO-BREAK SPACE, right-left
+ u'\xc7' # 0x0082 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xc9' # 0x0083 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xd1' # 0x0084 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xd6' # 0x0085 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xdc' # 0x0086 -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xe1' # 0x0087 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe0' # 0x0088 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe2' # 0x0089 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe4' # 0x008a -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\u06ba' # 0x008b -> ARABIC LETTER NOON GHUNNA
+ u'\xab' # 0x008c -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left
+ u'\xe7' # 0x008d -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xe9' # 0x008e -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xe8' # 0x008f -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xea' # 0x0090 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x0091 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xed' # 0x0092 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\u2026' # 0x0093 -> HORIZONTAL ELLIPSIS, right-left
+ u'\xee' # 0x0094 -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0x0095 -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xf1' # 0x0096 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xf3' # 0x0097 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xbb' # 0x0098 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left
+ u'\xf4' # 0x0099 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf6' # 0x009a -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf7' # 0x009b -> DIVISION SIGN, right-left
+ u'\xfa' # 0x009c -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xf9' # 0x009d -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfb' # 0x009e -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0x009f -> LATIN SMALL LETTER U WITH DIAERESIS
+ u' ' # 0x00a0 -> SPACE, right-left
+ u'!' # 0x00a1 -> EXCLAMATION MARK, right-left
+ u'"' # 0x00a2 -> QUOTATION MARK, right-left
+ u'#' # 0x00a3 -> NUMBER SIGN, right-left
+ u'$' # 0x00a4 -> DOLLAR SIGN, right-left
+ u'\u066a' # 0x00a5 -> ARABIC PERCENT SIGN
+ u'&' # 0x00a6 -> AMPERSAND, right-left
+ u"'" # 0x00a7 -> APOSTROPHE, right-left
+ u'(' # 0x00a8 -> LEFT PARENTHESIS, right-left
+ u')' # 0x00a9 -> RIGHT PARENTHESIS, right-left
+ u'*' # 0x00aa -> ASTERISK, right-left
+ u'+' # 0x00ab -> PLUS SIGN, right-left
+ u'\u060c' # 0x00ac -> ARABIC COMMA
+ u'-' # 0x00ad -> HYPHEN-MINUS, right-left
+ u'.' # 0x00ae -> FULL STOP, right-left
+ u'/' # 0x00af -> SOLIDUS, right-left
+ u'\u0660' # 0x00b0 -> ARABIC-INDIC DIGIT ZERO, right-left (need override)
+ u'\u0661' # 0x00b1 -> ARABIC-INDIC DIGIT ONE, right-left (need override)
+ u'\u0662' # 0x00b2 -> ARABIC-INDIC DIGIT TWO, right-left (need override)
+ u'\u0663' # 0x00b3 -> ARABIC-INDIC DIGIT THREE, right-left (need override)
+ u'\u0664' # 0x00b4 -> ARABIC-INDIC DIGIT FOUR, right-left (need override)
+ u'\u0665' # 0x00b5 -> ARABIC-INDIC DIGIT FIVE, right-left (need override)
+ u'\u0666' # 0x00b6 -> ARABIC-INDIC DIGIT SIX, right-left (need override)
+ u'\u0667' # 0x00b7 -> ARABIC-INDIC DIGIT SEVEN, right-left (need override)
+ u'\u0668' # 0x00b8 -> ARABIC-INDIC DIGIT EIGHT, right-left (need override)
+ u'\u0669' # 0x00b9 -> ARABIC-INDIC DIGIT NINE, right-left (need override)
+ u':' # 0x00ba -> COLON, right-left
+ u'\u061b' # 0x00bb -> ARABIC SEMICOLON
+ u'<' # 0x00bc -> LESS-THAN SIGN, right-left
+ u'=' # 0x00bd -> EQUALS SIGN, right-left
+ u'>' # 0x00be -> GREATER-THAN SIGN, right-left
+ u'\u061f' # 0x00bf -> ARABIC QUESTION MARK
+ u'\u274a' # 0x00c0 -> EIGHT TEARDROP-SPOKED PROPELLER ASTERISK, right-left
+ u'\u0621' # 0x00c1 -> ARABIC LETTER HAMZA
+ u'\u0622' # 0x00c2 -> ARABIC LETTER ALEF WITH MADDA ABOVE
+ u'\u0623' # 0x00c3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE
+ u'\u0624' # 0x00c4 -> ARABIC LETTER WAW WITH HAMZA ABOVE
+ u'\u0625' # 0x00c5 -> ARABIC LETTER ALEF WITH HAMZA BELOW
+ u'\u0626' # 0x00c6 -> ARABIC LETTER YEH WITH HAMZA ABOVE
+ u'\u0627' # 0x00c7 -> ARABIC LETTER ALEF
+ u'\u0628' # 0x00c8 -> ARABIC LETTER BEH
+ u'\u0629' # 0x00c9 -> ARABIC LETTER TEH MARBUTA
+ u'\u062a' # 0x00ca -> ARABIC LETTER TEH
+ u'\u062b' # 0x00cb -> ARABIC LETTER THEH
+ u'\u062c' # 0x00cc -> ARABIC LETTER JEEM
+ u'\u062d' # 0x00cd -> ARABIC LETTER HAH
+ u'\u062e' # 0x00ce -> ARABIC LETTER KHAH
+ u'\u062f' # 0x00cf -> ARABIC LETTER DAL
+ u'\u0630' # 0x00d0 -> ARABIC LETTER THAL
+ u'\u0631' # 0x00d1 -> ARABIC LETTER REH
+ u'\u0632' # 0x00d2 -> ARABIC LETTER ZAIN
+ u'\u0633' # 0x00d3 -> ARABIC LETTER SEEN
+ u'\u0634' # 0x00d4 -> ARABIC LETTER SHEEN
+ u'\u0635' # 0x00d5 -> ARABIC LETTER SAD
+ u'\u0636' # 0x00d6 -> ARABIC LETTER DAD
+ u'\u0637' # 0x00d7 -> ARABIC LETTER TAH
+ u'\u0638' # 0x00d8 -> ARABIC LETTER ZAH
+ u'\u0639' # 0x00d9 -> ARABIC LETTER AIN
+ u'\u063a' # 0x00da -> ARABIC LETTER GHAIN
+ u'[' # 0x00db -> LEFT SQUARE BRACKET, right-left
+ u'\\' # 0x00dc -> REVERSE SOLIDUS, right-left
+ u']' # 0x00dd -> RIGHT SQUARE BRACKET, right-left
+ u'^' # 0x00de -> CIRCUMFLEX ACCENT, right-left
+ u'_' # 0x00df -> LOW LINE, right-left
+ u'\u0640' # 0x00e0 -> ARABIC TATWEEL
+ u'\u0641' # 0x00e1 -> ARABIC LETTER FEH
+ u'\u0642' # 0x00e2 -> ARABIC LETTER QAF
+ u'\u0643' # 0x00e3 -> ARABIC LETTER KAF
+ u'\u0644' # 0x00e4 -> ARABIC LETTER LAM
+ u'\u0645' # 0x00e5 -> ARABIC LETTER MEEM
+ u'\u0646' # 0x00e6 -> ARABIC LETTER NOON
+ u'\u0647' # 0x00e7 -> ARABIC LETTER HEH
+ u'\u0648' # 0x00e8 -> ARABIC LETTER WAW
+ u'\u0649' # 0x00e9 -> ARABIC LETTER ALEF MAKSURA
+ u'\u064a' # 0x00ea -> ARABIC LETTER YEH
+ u'\u064b' # 0x00eb -> ARABIC FATHATAN
+ u'\u064c' # 0x00ec -> ARABIC DAMMATAN
+ u'\u064d' # 0x00ed -> ARABIC KASRATAN
+ u'\u064e' # 0x00ee -> ARABIC FATHA
+ u'\u064f' # 0x00ef -> ARABIC DAMMA
+ u'\u0650' # 0x00f0 -> ARABIC KASRA
+ u'\u0651' # 0x00f1 -> ARABIC SHADDA
+ u'\u0652' # 0x00f2 -> ARABIC SUKUN
+ u'\u067e' # 0x00f3 -> ARABIC LETTER PEH
+ u'\u0679' # 0x00f4 -> ARABIC LETTER TTEH
+ u'\u0686' # 0x00f5 -> ARABIC LETTER TCHEH
+ u'\u06d5' # 0x00f6 -> ARABIC LETTER AE
+ u'\u06a4' # 0x00f7 -> ARABIC LETTER VEH
+ u'\u06af' # 0x00f8 -> ARABIC LETTER GAF
+ u'\u0688' # 0x00f9 -> ARABIC LETTER DDAL
+ u'\u0691' # 0x00fa -> ARABIC LETTER RREH
+ u'{' # 0x00fb -> LEFT CURLY BRACKET, right-left
+ u'|' # 0x00fc -> VERTICAL LINE, right-left
+ u'}' # 0x00fd -> RIGHT CURLY BRACKET, right-left
+ u'\u0698' # 0x00fe -> ARABIC LETTER JEH
+ u'\u06d2' # 0x00ff -> ARABIC LETTER YEH BARREE
+)
+
+### Encoding Map
+
+encoding_map = {
+ 0x0000: 0x0000, # CONTROL CHARACTER
+ 0x0001: 0x0001, # CONTROL CHARACTER
+ 0x0002: 0x0002, # CONTROL CHARACTER
+ 0x0003: 0x0003, # CONTROL CHARACTER
+ 0x0004: 0x0004, # CONTROL CHARACTER
+ 0x0005: 0x0005, # CONTROL CHARACTER
+ 0x0006: 0x0006, # CONTROL CHARACTER
+ 0x0007: 0x0007, # CONTROL CHARACTER
+ 0x0008: 0x0008, # CONTROL CHARACTER
+ 0x0009: 0x0009, # CONTROL CHARACTER
+ 0x000a: 0x000a, # CONTROL CHARACTER
+ 0x000b: 0x000b, # CONTROL CHARACTER
+ 0x000c: 0x000c, # CONTROL CHARACTER
+ 0x000d: 0x000d, # CONTROL CHARACTER
+ 0x000e: 0x000e, # CONTROL CHARACTER
+ 0x000f: 0x000f, # CONTROL CHARACTER
+ 0x0010: 0x0010, # CONTROL CHARACTER
+ 0x0011: 0x0011, # CONTROL CHARACTER
+ 0x0012: 0x0012, # CONTROL CHARACTER
+ 0x0013: 0x0013, # CONTROL CHARACTER
+ 0x0014: 0x0014, # CONTROL CHARACTER
+ 0x0015: 0x0015, # CONTROL CHARACTER
+ 0x0016: 0x0016, # CONTROL CHARACTER
+ 0x0017: 0x0017, # CONTROL CHARACTER
+ 0x0018: 0x0018, # CONTROL CHARACTER
+ 0x0019: 0x0019, # CONTROL CHARACTER
+ 0x001a: 0x001a, # CONTROL CHARACTER
+ 0x001b: 0x001b, # CONTROL CHARACTER
+ 0x001c: 0x001c, # CONTROL CHARACTER
+ 0x001d: 0x001d, # CONTROL CHARACTER
+ 0x001e: 0x001e, # CONTROL CHARACTER
+ 0x001f: 0x001f, # CONTROL CHARACTER
+ 0x0020: 0x0020, # SPACE, left-right
+ 0x0020: 0x00a0, # SPACE, right-left
+ 0x0021: 0x0021, # EXCLAMATION MARK, left-right
+ 0x0021: 0x00a1, # EXCLAMATION MARK, right-left
+ 0x0022: 0x0022, # QUOTATION MARK, left-right
+ 0x0022: 0x00a2, # QUOTATION MARK, right-left
+ 0x0023: 0x0023, # NUMBER SIGN, left-right
+ 0x0023: 0x00a3, # NUMBER SIGN, right-left
+ 0x0024: 0x0024, # DOLLAR SIGN, left-right
+ 0x0024: 0x00a4, # DOLLAR SIGN, right-left
+ 0x0025: 0x0025, # PERCENT SIGN, left-right
+ 0x0026: 0x0026, # AMPERSAND, left-right
+ 0x0026: 0x00a6, # AMPERSAND, right-left
+ 0x0027: 0x0027, # APOSTROPHE, left-right
+ 0x0027: 0x00a7, # APOSTROPHE, right-left
+ 0x0028: 0x0028, # LEFT PARENTHESIS, left-right
+ 0x0028: 0x00a8, # LEFT PARENTHESIS, right-left
+ 0x0029: 0x0029, # RIGHT PARENTHESIS, left-right
+ 0x0029: 0x00a9, # RIGHT PARENTHESIS, right-left
+ 0x002a: 0x002a, # ASTERISK, left-right
+ 0x002a: 0x00aa, # ASTERISK, right-left
+ 0x002b: 0x002b, # PLUS SIGN, left-right
+ 0x002b: 0x00ab, # PLUS SIGN, right-left
+ 0x002c: 0x002c, # COMMA, left-right; in Arabic-script context, displayed as 0x066C ARABIC THOUSANDS SEPARATOR
+ 0x002d: 0x002d, # HYPHEN-MINUS, left-right
+ 0x002d: 0x00ad, # HYPHEN-MINUS, right-left
+ 0x002e: 0x002e, # FULL STOP, left-right; in Arabic-script context, displayed as 0x066B ARABIC DECIMAL SEPARATOR
+ 0x002e: 0x00ae, # FULL STOP, right-left
+ 0x002f: 0x002f, # SOLIDUS, left-right
+ 0x002f: 0x00af, # SOLIDUS, right-left
+ 0x0030: 0x0030, # DIGIT ZERO; in Arabic-script context, displayed as 0x0660 ARABIC-INDIC DIGIT ZERO
+ 0x0031: 0x0031, # DIGIT ONE; in Arabic-script context, displayed as 0x0661 ARABIC-INDIC DIGIT ONE
+ 0x0032: 0x0032, # DIGIT TWO; in Arabic-script context, displayed as 0x0662 ARABIC-INDIC DIGIT TWO
+ 0x0033: 0x0033, # DIGIT THREE; in Arabic-script context, displayed as 0x0663 ARABIC-INDIC DIGIT THREE
+ 0x0034: 0x0034, # DIGIT FOUR; in Arabic-script context, displayed as 0x0664 ARABIC-INDIC DIGIT FOUR
+ 0x0035: 0x0035, # DIGIT FIVE; in Arabic-script context, displayed as 0x0665 ARABIC-INDIC DIGIT FIVE
+ 0x0036: 0x0036, # DIGIT SIX; in Arabic-script context, displayed as 0x0666 ARABIC-INDIC DIGIT SIX
+ 0x0037: 0x0037, # DIGIT SEVEN; in Arabic-script context, displayed as 0x0667 ARABIC-INDIC DIGIT SEVEN
+ 0x0038: 0x0038, # DIGIT EIGHT; in Arabic-script context, displayed as 0x0668 ARABIC-INDIC DIGIT EIGHT
+ 0x0039: 0x0039, # DIGIT NINE; in Arabic-script context, displayed as 0x0669 ARABIC-INDIC DIGIT NINE
+ 0x003a: 0x003a, # COLON, left-right
+ 0x003a: 0x00ba, # COLON, right-left
+ 0x003b: 0x003b, # SEMICOLON, left-right
+ 0x003c: 0x003c, # LESS-THAN SIGN, left-right
+ 0x003c: 0x00bc, # LESS-THAN SIGN, right-left
+ 0x003d: 0x003d, # EQUALS SIGN, left-right
+ 0x003d: 0x00bd, # EQUALS SIGN, right-left
+ 0x003e: 0x003e, # GREATER-THAN SIGN, left-right
+ 0x003e: 0x00be, # GREATER-THAN SIGN, right-left
+ 0x003f: 0x003f, # QUESTION MARK, left-right
+ 0x0040: 0x0040, # COMMERCIAL AT
+ 0x0041: 0x0041, # LATIN CAPITAL LETTER A
+ 0x0042: 0x0042, # LATIN CAPITAL LETTER B
+ 0x0043: 0x0043, # LATIN CAPITAL LETTER C
+ 0x0044: 0x0044, # LATIN CAPITAL LETTER D
+ 0x0045: 0x0045, # LATIN CAPITAL LETTER E
+ 0x0046: 0x0046, # LATIN CAPITAL LETTER F
+ 0x0047: 0x0047, # LATIN CAPITAL LETTER G
+ 0x0048: 0x0048, # LATIN CAPITAL LETTER H
+ 0x0049: 0x0049, # LATIN CAPITAL LETTER I
+ 0x004a: 0x004a, # LATIN CAPITAL LETTER J
+ 0x004b: 0x004b, # LATIN CAPITAL LETTER K
+ 0x004c: 0x004c, # LATIN CAPITAL LETTER L
+ 0x004d: 0x004d, # LATIN CAPITAL LETTER M
+ 0x004e: 0x004e, # LATIN CAPITAL LETTER N
+ 0x004f: 0x004f, # LATIN CAPITAL LETTER O
+ 0x0050: 0x0050, # LATIN CAPITAL LETTER P
+ 0x0051: 0x0051, # LATIN CAPITAL LETTER Q
+ 0x0052: 0x0052, # LATIN CAPITAL LETTER R
+ 0x0053: 0x0053, # LATIN CAPITAL LETTER S
+ 0x0054: 0x0054, # LATIN CAPITAL LETTER T
+ 0x0055: 0x0055, # LATIN CAPITAL LETTER U
+ 0x0056: 0x0056, # LATIN CAPITAL LETTER V
+ 0x0057: 0x0057, # LATIN CAPITAL LETTER W
+ 0x0058: 0x0058, # LATIN CAPITAL LETTER X
+ 0x0059: 0x0059, # LATIN CAPITAL LETTER Y
+ 0x005a: 0x005a, # LATIN CAPITAL LETTER Z
+ 0x005b: 0x005b, # LEFT SQUARE BRACKET, left-right
+ 0x005b: 0x00db, # LEFT SQUARE BRACKET, right-left
+ 0x005c: 0x005c, # REVERSE SOLIDUS, left-right
+ 0x005c: 0x00dc, # REVERSE SOLIDUS, right-left
+ 0x005d: 0x005d, # RIGHT SQUARE BRACKET, left-right
+ 0x005d: 0x00dd, # RIGHT SQUARE BRACKET, right-left
+ 0x005e: 0x005e, # CIRCUMFLEX ACCENT, left-right
+ 0x005e: 0x00de, # CIRCUMFLEX ACCENT, right-left
+ 0x005f: 0x005f, # LOW LINE, left-right
+ 0x005f: 0x00df, # LOW LINE, right-left
+ 0x0060: 0x0060, # GRAVE ACCENT
+ 0x0061: 0x0061, # LATIN SMALL LETTER A
+ 0x0062: 0x0062, # LATIN SMALL LETTER B
+ 0x0063: 0x0063, # LATIN SMALL LETTER C
+ 0x0064: 0x0064, # LATIN SMALL LETTER D
+ 0x0065: 0x0065, # LATIN SMALL LETTER E
+ 0x0066: 0x0066, # LATIN SMALL LETTER F
+ 0x0067: 0x0067, # LATIN SMALL LETTER G
+ 0x0068: 0x0068, # LATIN SMALL LETTER H
+ 0x0069: 0x0069, # LATIN SMALL LETTER I
+ 0x006a: 0x006a, # LATIN SMALL LETTER J
+ 0x006b: 0x006b, # LATIN SMALL LETTER K
+ 0x006c: 0x006c, # LATIN SMALL LETTER L
+ 0x006d: 0x006d, # LATIN SMALL LETTER M
+ 0x006e: 0x006e, # LATIN SMALL LETTER N
+ 0x006f: 0x006f, # LATIN SMALL LETTER O
+ 0x0070: 0x0070, # LATIN SMALL LETTER P
+ 0x0071: 0x0071, # LATIN SMALL LETTER Q
+ 0x0072: 0x0072, # LATIN SMALL LETTER R
+ 0x0073: 0x0073, # LATIN SMALL LETTER S
+ 0x0074: 0x0074, # LATIN SMALL LETTER T
+ 0x0075: 0x0075, # LATIN SMALL LETTER U
+ 0x0076: 0x0076, # LATIN SMALL LETTER V
+ 0x0077: 0x0077, # LATIN SMALL LETTER W
+ 0x0078: 0x0078, # LATIN SMALL LETTER X
+ 0x0079: 0x0079, # LATIN SMALL LETTER Y
+ 0x007a: 0x007a, # LATIN SMALL LETTER Z
+ 0x007b: 0x007b, # LEFT CURLY BRACKET, left-right
+ 0x007b: 0x00fb, # LEFT CURLY BRACKET, right-left
+ 0x007c: 0x007c, # VERTICAL LINE, left-right
+ 0x007c: 0x00fc, # VERTICAL LINE, right-left
+ 0x007d: 0x007d, # RIGHT CURLY BRACKET, left-right
+ 0x007d: 0x00fd, # RIGHT CURLY BRACKET, right-left
+ 0x007e: 0x007e, # TILDE
+ 0x007f: 0x007f, # CONTROL CHARACTER
+ 0x00a0: 0x0081, # NO-BREAK SPACE, right-left
+ 0x00ab: 0x008c, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left
+ 0x00bb: 0x0098, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left
+ 0x00c4: 0x0080, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x00c7: 0x0082, # LATIN CAPITAL LETTER C WITH CEDILLA
+ 0x00c9: 0x0083, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x00d1: 0x0084, # LATIN CAPITAL LETTER N WITH TILDE
+ 0x00d6: 0x0085, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x00dc: 0x0086, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x00e0: 0x0088, # LATIN SMALL LETTER A WITH GRAVE
+ 0x00e1: 0x0087, # LATIN SMALL LETTER A WITH ACUTE
+ 0x00e2: 0x0089, # LATIN SMALL LETTER A WITH CIRCUMFLEX
+ 0x00e4: 0x008a, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x00e7: 0x008d, # LATIN SMALL LETTER C WITH CEDILLA
+ 0x00e8: 0x008f, # LATIN SMALL LETTER E WITH GRAVE
+ 0x00e9: 0x008e, # LATIN SMALL LETTER E WITH ACUTE
+ 0x00ea: 0x0090, # LATIN SMALL LETTER E WITH CIRCUMFLEX
+ 0x00eb: 0x0091, # LATIN SMALL LETTER E WITH DIAERESIS
+ 0x00ed: 0x0092, # LATIN SMALL LETTER I WITH ACUTE
+ 0x00ee: 0x0094, # LATIN SMALL LETTER I WITH CIRCUMFLEX
+ 0x00ef: 0x0095, # LATIN SMALL LETTER I WITH DIAERESIS
+ 0x00f1: 0x0096, # LATIN SMALL LETTER N WITH TILDE
+ 0x00f3: 0x0097, # LATIN SMALL LETTER O WITH ACUTE
+ 0x00f4: 0x0099, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x00f6: 0x009a, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x00f7: 0x009b, # DIVISION SIGN, right-left
+ 0x00f9: 0x009d, # LATIN SMALL LETTER U WITH GRAVE
+ 0x00fa: 0x009c, # LATIN SMALL LETTER U WITH ACUTE
+ 0x00fb: 0x009e, # LATIN SMALL LETTER U WITH CIRCUMFLEX
+ 0x00fc: 0x009f, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x060c: 0x00ac, # ARABIC COMMA
+ 0x061b: 0x00bb, # ARABIC SEMICOLON
+ 0x061f: 0x00bf, # ARABIC QUESTION MARK
+ 0x0621: 0x00c1, # ARABIC LETTER HAMZA
+ 0x0622: 0x00c2, # ARABIC LETTER ALEF WITH MADDA ABOVE
+ 0x0623: 0x00c3, # ARABIC LETTER ALEF WITH HAMZA ABOVE
+ 0x0624: 0x00c4, # ARABIC LETTER WAW WITH HAMZA ABOVE
+ 0x0625: 0x00c5, # ARABIC LETTER ALEF WITH HAMZA BELOW
+ 0x0626: 0x00c6, # ARABIC LETTER YEH WITH HAMZA ABOVE
+ 0x0627: 0x00c7, # ARABIC LETTER ALEF
+ 0x0628: 0x00c8, # ARABIC LETTER BEH
+ 0x0629: 0x00c9, # ARABIC LETTER TEH MARBUTA
+ 0x062a: 0x00ca, # ARABIC LETTER TEH
+ 0x062b: 0x00cb, # ARABIC LETTER THEH
+ 0x062c: 0x00cc, # ARABIC LETTER JEEM
+ 0x062d: 0x00cd, # ARABIC LETTER HAH
+ 0x062e: 0x00ce, # ARABIC LETTER KHAH
+ 0x062f: 0x00cf, # ARABIC LETTER DAL
+ 0x0630: 0x00d0, # ARABIC LETTER THAL
+ 0x0631: 0x00d1, # ARABIC LETTER REH
+ 0x0632: 0x00d2, # ARABIC LETTER ZAIN
+ 0x0633: 0x00d3, # ARABIC LETTER SEEN
+ 0x0634: 0x00d4, # ARABIC LETTER SHEEN
+ 0x0635: 0x00d5, # ARABIC LETTER SAD
+ 0x0636: 0x00d6, # ARABIC LETTER DAD
+ 0x0637: 0x00d7, # ARABIC LETTER TAH
+ 0x0638: 0x00d8, # ARABIC LETTER ZAH
+ 0x0639: 0x00d9, # ARABIC LETTER AIN
+ 0x063a: 0x00da, # ARABIC LETTER GHAIN
+ 0x0640: 0x00e0, # ARABIC TATWEEL
+ 0x0641: 0x00e1, # ARABIC LETTER FEH
+ 0x0642: 0x00e2, # ARABIC LETTER QAF
+ 0x0643: 0x00e3, # ARABIC LETTER KAF
+ 0x0644: 0x00e4, # ARABIC LETTER LAM
+ 0x0645: 0x00e5, # ARABIC LETTER MEEM
+ 0x0646: 0x00e6, # ARABIC LETTER NOON
+ 0x0647: 0x00e7, # ARABIC LETTER HEH
+ 0x0648: 0x00e8, # ARABIC LETTER WAW
+ 0x0649: 0x00e9, # ARABIC LETTER ALEF MAKSURA
+ 0x064a: 0x00ea, # ARABIC LETTER YEH
+ 0x064b: 0x00eb, # ARABIC FATHATAN
+ 0x064c: 0x00ec, # ARABIC DAMMATAN
+ 0x064d: 0x00ed, # ARABIC KASRATAN
+ 0x064e: 0x00ee, # ARABIC FATHA
+ 0x064f: 0x00ef, # ARABIC DAMMA
+ 0x0650: 0x00f0, # ARABIC KASRA
+ 0x0651: 0x00f1, # ARABIC SHADDA
+ 0x0652: 0x00f2, # ARABIC SUKUN
+ 0x0660: 0x00b0, # ARABIC-INDIC DIGIT ZERO, right-left (need override)
+ 0x0661: 0x00b1, # ARABIC-INDIC DIGIT ONE, right-left (need override)
+ 0x0662: 0x00b2, # ARABIC-INDIC DIGIT TWO, right-left (need override)
+ 0x0663: 0x00b3, # ARABIC-INDIC DIGIT THREE, right-left (need override)
+ 0x0664: 0x00b4, # ARABIC-INDIC DIGIT FOUR, right-left (need override)
+ 0x0665: 0x00b5, # ARABIC-INDIC DIGIT FIVE, right-left (need override)
+ 0x0666: 0x00b6, # ARABIC-INDIC DIGIT SIX, right-left (need override)
+ 0x0667: 0x00b7, # ARABIC-INDIC DIGIT SEVEN, right-left (need override)
+ 0x0668: 0x00b8, # ARABIC-INDIC DIGIT EIGHT, right-left (need override)
+ 0x0669: 0x00b9, # ARABIC-INDIC DIGIT NINE, right-left (need override)
+ 0x066a: 0x00a5, # ARABIC PERCENT SIGN
+ 0x0679: 0x00f4, # ARABIC LETTER TTEH
+ 0x067e: 0x00f3, # ARABIC LETTER PEH
+ 0x0686: 0x00f5, # ARABIC LETTER TCHEH
+ 0x0688: 0x00f9, # ARABIC LETTER DDAL
+ 0x0691: 0x00fa, # ARABIC LETTER RREH
+ 0x0698: 0x00fe, # ARABIC LETTER JEH
+ 0x06a4: 0x00f7, # ARABIC LETTER VEH
+ 0x06af: 0x00f8, # ARABIC LETTER GAF
+ 0x06ba: 0x008b, # ARABIC LETTER NOON GHUNNA
+ 0x06d2: 0x00ff, # ARABIC LETTER YEH BARREE
+ 0x06d5: 0x00f6, # ARABIC LETTER AE
+ 0x2026: 0x0093, # HORIZONTAL ELLIPSIS, right-left
+ 0x274a: 0x00c0, # EIGHT TEARDROP-SPOKED PROPELLER ASTERISK, right-left
+}
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
index 0000000000..3ef432c40e
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_centeuro.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec mac_centeuro generated from 'MAPPINGS/VENDORS/APPLE/CENTEURO.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='mac-centeuro',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> CONTROL CHARACTER
+ u'\x01' # 0x01 -> CONTROL CHARACTER
+ u'\x02' # 0x02 -> CONTROL CHARACTER
+ u'\x03' # 0x03 -> CONTROL CHARACTER
+ u'\x04' # 0x04 -> CONTROL CHARACTER
+ u'\x05' # 0x05 -> CONTROL CHARACTER
+ u'\x06' # 0x06 -> CONTROL CHARACTER
+ u'\x07' # 0x07 -> CONTROL CHARACTER
+ u'\x08' # 0x08 -> CONTROL CHARACTER
+ u'\t' # 0x09 -> CONTROL CHARACTER
+ u'\n' # 0x0A -> CONTROL CHARACTER
+ u'\x0b' # 0x0B -> CONTROL CHARACTER
+ u'\x0c' # 0x0C -> CONTROL CHARACTER
+ u'\r' # 0x0D -> CONTROL CHARACTER
+ u'\x0e' # 0x0E -> CONTROL CHARACTER
+ u'\x0f' # 0x0F -> CONTROL CHARACTER
+ u'\x10' # 0x10 -> CONTROL CHARACTER
+ u'\x11' # 0x11 -> CONTROL CHARACTER
+ u'\x12' # 0x12 -> CONTROL CHARACTER
+ u'\x13' # 0x13 -> CONTROL CHARACTER
+ u'\x14' # 0x14 -> CONTROL CHARACTER
+ u'\x15' # 0x15 -> CONTROL CHARACTER
+ u'\x16' # 0x16 -> CONTROL CHARACTER
+ u'\x17' # 0x17 -> CONTROL CHARACTER
+ u'\x18' # 0x18 -> CONTROL CHARACTER
+ u'\x19' # 0x19 -> CONTROL CHARACTER
+ u'\x1a' # 0x1A -> CONTROL CHARACTER
+ u'\x1b' # 0x1B -> CONTROL CHARACTER
+ u'\x1c' # 0x1C -> CONTROL CHARACTER
+ u'\x1d' # 0x1D -> CONTROL CHARACTER
+ u'\x1e' # 0x1E -> CONTROL CHARACTER
+ u'\x1f' # 0x1F -> CONTROL CHARACTER
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> CONTROL CHARACTER
+ u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\u0100' # 0x81 -> LATIN CAPITAL LETTER A WITH MACRON
+ u'\u0101' # 0x82 -> LATIN SMALL LETTER A WITH MACRON
+ u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\u0104' # 0x84 -> LATIN CAPITAL LETTER A WITH OGONEK
+ u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\u0105' # 0x88 -> LATIN SMALL LETTER A WITH OGONEK
+ u'\u010c' # 0x89 -> LATIN CAPITAL LETTER C WITH CARON
+ u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\u010d' # 0x8B -> LATIN SMALL LETTER C WITH CARON
+ u'\u0106' # 0x8C -> LATIN CAPITAL LETTER C WITH ACUTE
+ u'\u0107' # 0x8D -> LATIN SMALL LETTER C WITH ACUTE
+ u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE
+ u'\u0179' # 0x8F -> LATIN CAPITAL LETTER Z WITH ACUTE
+ u'\u017a' # 0x90 -> LATIN SMALL LETTER Z WITH ACUTE
+ u'\u010e' # 0x91 -> LATIN CAPITAL LETTER D WITH CARON
+ u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\u010f' # 0x93 -> LATIN SMALL LETTER D WITH CARON
+ u'\u0112' # 0x94 -> LATIN CAPITAL LETTER E WITH MACRON
+ u'\u0113' # 0x95 -> LATIN SMALL LETTER E WITH MACRON
+ u'\u0116' # 0x96 -> LATIN CAPITAL LETTER E WITH DOT ABOVE
+ u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\u0117' # 0x98 -> LATIN SMALL LETTER E WITH DOT ABOVE
+ u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE
+ u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE
+ u'\u011a' # 0x9D -> LATIN CAPITAL LETTER E WITH CARON
+ u'\u011b' # 0x9E -> LATIN SMALL LETTER E WITH CARON
+ u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\u2020' # 0xA0 -> DAGGER
+ u'\xb0' # 0xA1 -> DEGREE SIGN
+ u'\u0118' # 0xA2 -> LATIN CAPITAL LETTER E WITH OGONEK
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\xa7' # 0xA4 -> SECTION SIGN
+ u'\u2022' # 0xA5 -> BULLET
+ u'\xb6' # 0xA6 -> PILCROW SIGN
+ u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S
+ u'\xae' # 0xA8 -> REGISTERED SIGN
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\u2122' # 0xAA -> TRADE MARK SIGN
+ u'\u0119' # 0xAB -> LATIN SMALL LETTER E WITH OGONEK
+ u'\xa8' # 0xAC -> DIAERESIS
+ u'\u2260' # 0xAD -> NOT EQUAL TO
+ u'\u0123' # 0xAE -> LATIN SMALL LETTER G WITH CEDILLA
+ u'\u012e' # 0xAF -> LATIN CAPITAL LETTER I WITH OGONEK
+ u'\u012f' # 0xB0 -> LATIN SMALL LETTER I WITH OGONEK
+ u'\u012a' # 0xB1 -> LATIN CAPITAL LETTER I WITH MACRON
+ u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO
+ u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO
+ u'\u012b' # 0xB4 -> LATIN SMALL LETTER I WITH MACRON
+ u'\u0136' # 0xB5 -> LATIN CAPITAL LETTER K WITH CEDILLA
+ u'\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL
+ u'\u2211' # 0xB7 -> N-ARY SUMMATION
+ u'\u0142' # 0xB8 -> LATIN SMALL LETTER L WITH STROKE
+ u'\u013b' # 0xB9 -> LATIN CAPITAL LETTER L WITH CEDILLA
+ u'\u013c' # 0xBA -> LATIN SMALL LETTER L WITH CEDILLA
+ u'\u013d' # 0xBB -> LATIN CAPITAL LETTER L WITH CARON
+ u'\u013e' # 0xBC -> LATIN SMALL LETTER L WITH CARON
+ u'\u0139' # 0xBD -> LATIN CAPITAL LETTER L WITH ACUTE
+ u'\u013a' # 0xBE -> LATIN SMALL LETTER L WITH ACUTE
+ u'\u0145' # 0xBF -> LATIN CAPITAL LETTER N WITH CEDILLA
+ u'\u0146' # 0xC0 -> LATIN SMALL LETTER N WITH CEDILLA
+ u'\u0143' # 0xC1 -> LATIN CAPITAL LETTER N WITH ACUTE
+ u'\xac' # 0xC2 -> NOT SIGN
+ u'\u221a' # 0xC3 -> SQUARE ROOT
+ u'\u0144' # 0xC4 -> LATIN SMALL LETTER N WITH ACUTE
+ u'\u0147' # 0xC5 -> LATIN CAPITAL LETTER N WITH CARON
+ u'\u2206' # 0xC6 -> INCREMENT
+ u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS
+ u'\xa0' # 0xCA -> NO-BREAK SPACE
+ u'\u0148' # 0xCB -> LATIN SMALL LETTER N WITH CARON
+ u'\u0150' # 0xCC -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
+ u'\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\u0151' # 0xCE -> LATIN SMALL LETTER O WITH DOUBLE ACUTE
+ u'\u014c' # 0xCF -> LATIN CAPITAL LETTER O WITH MACRON
+ u'\u2013' # 0xD0 -> EN DASH
+ u'\u2014' # 0xD1 -> EM DASH
+ u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK
+ u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK
+ u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK
+ u'\xf7' # 0xD6 -> DIVISION SIGN
+ u'\u25ca' # 0xD7 -> LOZENGE
+ u'\u014d' # 0xD8 -> LATIN SMALL LETTER O WITH MACRON
+ u'\u0154' # 0xD9 -> LATIN CAPITAL LETTER R WITH ACUTE
+ u'\u0155' # 0xDA -> LATIN SMALL LETTER R WITH ACUTE
+ u'\u0158' # 0xDB -> LATIN CAPITAL LETTER R WITH CARON
+ u'\u2039' # 0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ u'\u203a' # 0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+ u'\u0159' # 0xDE -> LATIN SMALL LETTER R WITH CARON
+ u'\u0156' # 0xDF -> LATIN CAPITAL LETTER R WITH CEDILLA
+ u'\u0157' # 0xE0 -> LATIN SMALL LETTER R WITH CEDILLA
+ u'\u0160' # 0xE1 -> LATIN CAPITAL LETTER S WITH CARON
+ u'\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK
+ u'\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK
+ u'\u0161' # 0xE4 -> LATIN SMALL LETTER S WITH CARON
+ u'\u015a' # 0xE5 -> LATIN CAPITAL LETTER S WITH ACUTE
+ u'\u015b' # 0xE6 -> LATIN SMALL LETTER S WITH ACUTE
+ u'\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\u0164' # 0xE8 -> LATIN CAPITAL LETTER T WITH CARON
+ u'\u0165' # 0xE9 -> LATIN SMALL LETTER T WITH CARON
+ u'\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\u017d' # 0xEB -> LATIN CAPITAL LETTER Z WITH CARON
+ u'\u017e' # 0xEC -> LATIN SMALL LETTER Z WITH CARON
+ u'\u016a' # 0xED -> LATIN CAPITAL LETTER U WITH MACRON
+ u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\u016b' # 0xF0 -> LATIN SMALL LETTER U WITH MACRON
+ u'\u016e' # 0xF1 -> LATIN CAPITAL LETTER U WITH RING ABOVE
+ u'\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\u016f' # 0xF3 -> LATIN SMALL LETTER U WITH RING ABOVE
+ u'\u0170' # 0xF4 -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
+ u'\u0171' # 0xF5 -> LATIN SMALL LETTER U WITH DOUBLE ACUTE
+ u'\u0172' # 0xF6 -> LATIN CAPITAL LETTER U WITH OGONEK
+ u'\u0173' # 0xF7 -> LATIN SMALL LETTER U WITH OGONEK
+ u'\xdd' # 0xF8 -> LATIN CAPITAL LETTER Y WITH ACUTE
+ u'\xfd' # 0xF9 -> LATIN SMALL LETTER Y WITH ACUTE
+ u'\u0137' # 0xFA -> LATIN SMALL LETTER K WITH CEDILLA
+ u'\u017b' # 0xFB -> LATIN CAPITAL LETTER Z WITH DOT ABOVE
+ u'\u0141' # 0xFC -> LATIN CAPITAL LETTER L WITH STROKE
+ u'\u017c' # 0xFD -> LATIN SMALL LETTER Z WITH DOT ABOVE
+ u'\u0122' # 0xFE -> LATIN CAPITAL LETTER G WITH CEDILLA
+ u'\u02c7' # 0xFF -> CARON
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..ebcb1cc003
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_croatian.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec mac_croatian generated from 'MAPPINGS/VENDORS/APPLE/CROATIAN.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='mac-croatian',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> CONTROL CHARACTER
+ u'\x01' # 0x01 -> CONTROL CHARACTER
+ u'\x02' # 0x02 -> CONTROL CHARACTER
+ u'\x03' # 0x03 -> CONTROL CHARACTER
+ u'\x04' # 0x04 -> CONTROL CHARACTER
+ u'\x05' # 0x05 -> CONTROL CHARACTER
+ u'\x06' # 0x06 -> CONTROL CHARACTER
+ u'\x07' # 0x07 -> CONTROL CHARACTER
+ u'\x08' # 0x08 -> CONTROL CHARACTER
+ u'\t' # 0x09 -> CONTROL CHARACTER
+ u'\n' # 0x0A -> CONTROL CHARACTER
+ u'\x0b' # 0x0B -> CONTROL CHARACTER
+ u'\x0c' # 0x0C -> CONTROL CHARACTER
+ u'\r' # 0x0D -> CONTROL CHARACTER
+ u'\x0e' # 0x0E -> CONTROL CHARACTER
+ u'\x0f' # 0x0F -> CONTROL CHARACTER
+ u'\x10' # 0x10 -> CONTROL CHARACTER
+ u'\x11' # 0x11 -> CONTROL CHARACTER
+ u'\x12' # 0x12 -> CONTROL CHARACTER
+ u'\x13' # 0x13 -> CONTROL CHARACTER
+ u'\x14' # 0x14 -> CONTROL CHARACTER
+ u'\x15' # 0x15 -> CONTROL CHARACTER
+ u'\x16' # 0x16 -> CONTROL CHARACTER
+ u'\x17' # 0x17 -> CONTROL CHARACTER
+ u'\x18' # 0x18 -> CONTROL CHARACTER
+ u'\x19' # 0x19 -> CONTROL CHARACTER
+ u'\x1a' # 0x1A -> CONTROL CHARACTER
+ u'\x1b' # 0x1B -> CONTROL CHARACTER
+ u'\x1c' # 0x1C -> CONTROL CHARACTER
+ u'\x1d' # 0x1D -> CONTROL CHARACTER
+ u'\x1e' # 0x1E -> CONTROL CHARACTER
+ u'\x1f' # 0x1F -> CONTROL CHARACTER
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> CONTROL CHARACTER
+ u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE
+ u'\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE
+ u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\u2020' # 0xA0 -> DAGGER
+ u'\xb0' # 0xA1 -> DEGREE SIGN
+ u'\xa2' # 0xA2 -> CENT SIGN
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\xa7' # 0xA4 -> SECTION SIGN
+ u'\u2022' # 0xA5 -> BULLET
+ u'\xb6' # 0xA6 -> PILCROW SIGN
+ u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S
+ u'\xae' # 0xA8 -> REGISTERED SIGN
+ u'\u0160' # 0xA9 -> LATIN CAPITAL LETTER S WITH CARON
+ u'\u2122' # 0xAA -> TRADE MARK SIGN
+ u'\xb4' # 0xAB -> ACUTE ACCENT
+ u'\xa8' # 0xAC -> DIAERESIS
+ u'\u2260' # 0xAD -> NOT EQUAL TO
+ u'\u017d' # 0xAE -> LATIN CAPITAL LETTER Z WITH CARON
+ u'\xd8' # 0xAF -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\u221e' # 0xB0 -> INFINITY
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO
+ u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO
+ u'\u2206' # 0xB4 -> INCREMENT
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL
+ u'\u2211' # 0xB7 -> N-ARY SUMMATION
+ u'\u220f' # 0xB8 -> N-ARY PRODUCT
+ u'\u0161' # 0xB9 -> LATIN SMALL LETTER S WITH CARON
+ u'\u222b' # 0xBA -> INTEGRAL
+ u'\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR
+ u'\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR
+ u'\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA
+ u'\u017e' # 0xBE -> LATIN SMALL LETTER Z WITH CARON
+ u'\xf8' # 0xBF -> LATIN SMALL LETTER O WITH STROKE
+ u'\xbf' # 0xC0 -> INVERTED QUESTION MARK
+ u'\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK
+ u'\xac' # 0xC2 -> NOT SIGN
+ u'\u221a' # 0xC3 -> SQUARE ROOT
+ u'\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK
+ u'\u2248' # 0xC5 -> ALMOST EQUAL TO
+ u'\u0106' # 0xC6 -> LATIN CAPITAL LETTER C WITH ACUTE
+ u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON
+ u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS
+ u'\xa0' # 0xCA -> NO-BREAK SPACE
+ u'\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE
+ u'\u0153' # 0xCF -> LATIN SMALL LIGATURE OE
+ u'\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE
+ u'\u2014' # 0xD1 -> EM DASH
+ u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK
+ u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK
+ u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK
+ u'\xf7' # 0xD6 -> DIVISION SIGN
+ u'\u25ca' # 0xD7 -> LOZENGE
+ u'\uf8ff' # 0xD8 -> Apple logo
+ u'\xa9' # 0xD9 -> COPYRIGHT SIGN
+ u'\u2044' # 0xDA -> FRACTION SLASH
+ u'\u20ac' # 0xDB -> EURO SIGN
+ u'\u2039' # 0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ u'\u203a' # 0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+ u'\xc6' # 0xDE -> LATIN CAPITAL LETTER AE
+ u'\xbb' # 0xDF -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2013' # 0xE0 -> EN DASH
+ u'\xb7' # 0xE1 -> MIDDLE DOT
+ u'\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK
+ u'\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK
+ u'\u2030' # 0xE4 -> PER MILLE SIGN
+ u'\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\u0107' # 0xE6 -> LATIN SMALL LETTER C WITH ACUTE
+ u'\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON
+ u'\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE
+ u'\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\u0131' # 0xF5 -> LATIN SMALL LETTER DOTLESS I
+ u'\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT
+ u'\u02dc' # 0xF7 -> SMALL TILDE
+ u'\xaf' # 0xF8 -> MACRON
+ u'\u03c0' # 0xF9 -> GREEK SMALL LETTER PI
+ u'\xcb' # 0xFA -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\u02da' # 0xFB -> RING ABOVE
+ u'\xb8' # 0xFC -> CEDILLA
+ u'\xca' # 0xFD -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xe6' # 0xFE -> LATIN SMALL LETTER AE
+ u'\u02c7' # 0xFF -> CARON
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..bca866f704
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_cyrillic.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec mac_cyrillic generated from 'MAPPINGS/VENDORS/APPLE/CYRILLIC.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='mac-cyrillic',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> CONTROL CHARACTER
+ u'\x01' # 0x01 -> CONTROL CHARACTER
+ u'\x02' # 0x02 -> CONTROL CHARACTER
+ u'\x03' # 0x03 -> CONTROL CHARACTER
+ u'\x04' # 0x04 -> CONTROL CHARACTER
+ u'\x05' # 0x05 -> CONTROL CHARACTER
+ u'\x06' # 0x06 -> CONTROL CHARACTER
+ u'\x07' # 0x07 -> CONTROL CHARACTER
+ u'\x08' # 0x08 -> CONTROL CHARACTER
+ u'\t' # 0x09 -> CONTROL CHARACTER
+ u'\n' # 0x0A -> CONTROL CHARACTER
+ u'\x0b' # 0x0B -> CONTROL CHARACTER
+ u'\x0c' # 0x0C -> CONTROL CHARACTER
+ u'\r' # 0x0D -> CONTROL CHARACTER
+ u'\x0e' # 0x0E -> CONTROL CHARACTER
+ u'\x0f' # 0x0F -> CONTROL CHARACTER
+ u'\x10' # 0x10 -> CONTROL CHARACTER
+ u'\x11' # 0x11 -> CONTROL CHARACTER
+ u'\x12' # 0x12 -> CONTROL CHARACTER
+ u'\x13' # 0x13 -> CONTROL CHARACTER
+ u'\x14' # 0x14 -> CONTROL CHARACTER
+ u'\x15' # 0x15 -> CONTROL CHARACTER
+ u'\x16' # 0x16 -> CONTROL CHARACTER
+ u'\x17' # 0x17 -> CONTROL CHARACTER
+ u'\x18' # 0x18 -> CONTROL CHARACTER
+ u'\x19' # 0x19 -> CONTROL CHARACTER
+ u'\x1a' # 0x1A -> CONTROL CHARACTER
+ u'\x1b' # 0x1B -> CONTROL CHARACTER
+ u'\x1c' # 0x1C -> CONTROL CHARACTER
+ u'\x1d' # 0x1D -> CONTROL CHARACTER
+ u'\x1e' # 0x1E -> CONTROL CHARACTER
+ u'\x1f' # 0x1F -> CONTROL CHARACTER
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> CONTROL CHARACTER
+ u'\u0410' # 0x80 -> CYRILLIC CAPITAL LETTER A
+ u'\u0411' # 0x81 -> CYRILLIC CAPITAL LETTER BE
+ u'\u0412' # 0x82 -> CYRILLIC CAPITAL LETTER VE
+ u'\u0413' # 0x83 -> CYRILLIC CAPITAL LETTER GHE
+ u'\u0414' # 0x84 -> CYRILLIC CAPITAL LETTER DE
+ u'\u0415' # 0x85 -> CYRILLIC CAPITAL LETTER IE
+ u'\u0416' # 0x86 -> CYRILLIC CAPITAL LETTER ZHE
+ u'\u0417' # 0x87 -> CYRILLIC CAPITAL LETTER ZE
+ u'\u0418' # 0x88 -> CYRILLIC CAPITAL LETTER I
+ u'\u0419' # 0x89 -> CYRILLIC CAPITAL LETTER SHORT I
+ u'\u041a' # 0x8A -> CYRILLIC CAPITAL LETTER KA
+ u'\u041b' # 0x8B -> CYRILLIC CAPITAL LETTER EL
+ u'\u041c' # 0x8C -> CYRILLIC CAPITAL LETTER EM
+ u'\u041d' # 0x8D -> CYRILLIC CAPITAL LETTER EN
+ u'\u041e' # 0x8E -> CYRILLIC CAPITAL LETTER O
+ u'\u041f' # 0x8F -> CYRILLIC CAPITAL LETTER PE
+ u'\u0420' # 0x90 -> CYRILLIC CAPITAL LETTER ER
+ u'\u0421' # 0x91 -> CYRILLIC CAPITAL LETTER ES
+ u'\u0422' # 0x92 -> CYRILLIC CAPITAL LETTER TE
+ u'\u0423' # 0x93 -> CYRILLIC CAPITAL LETTER U
+ u'\u0424' # 0x94 -> CYRILLIC CAPITAL LETTER EF
+ u'\u0425' # 0x95 -> CYRILLIC CAPITAL LETTER HA
+ u'\u0426' # 0x96 -> CYRILLIC CAPITAL LETTER TSE
+ u'\u0427' # 0x97 -> CYRILLIC CAPITAL LETTER CHE
+ u'\u0428' # 0x98 -> CYRILLIC CAPITAL LETTER SHA
+ u'\u0429' # 0x99 -> CYRILLIC CAPITAL LETTER SHCHA
+ u'\u042a' # 0x9A -> CYRILLIC CAPITAL LETTER HARD SIGN
+ u'\u042b' # 0x9B -> CYRILLIC CAPITAL LETTER YERU
+ u'\u042c' # 0x9C -> CYRILLIC CAPITAL LETTER SOFT SIGN
+ u'\u042d' # 0x9D -> CYRILLIC CAPITAL LETTER E
+ u'\u042e' # 0x9E -> CYRILLIC CAPITAL LETTER YU
+ u'\u042f' # 0x9F -> CYRILLIC CAPITAL LETTER YA
+ u'\u2020' # 0xA0 -> DAGGER
+ u'\xb0' # 0xA1 -> DEGREE SIGN
+ u'\u0490' # 0xA2 -> CYRILLIC CAPITAL LETTER GHE WITH UPTURN
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\xa7' # 0xA4 -> SECTION SIGN
+ u'\u2022' # 0xA5 -> BULLET
+ u'\xb6' # 0xA6 -> PILCROW SIGN
+ u'\u0406' # 0xA7 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
+ u'\xae' # 0xA8 -> REGISTERED SIGN
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\u2122' # 0xAA -> TRADE MARK SIGN
+ u'\u0402' # 0xAB -> CYRILLIC CAPITAL LETTER DJE
+ u'\u0452' # 0xAC -> CYRILLIC SMALL LETTER DJE
+ u'\u2260' # 0xAD -> NOT EQUAL TO
+ u'\u0403' # 0xAE -> CYRILLIC CAPITAL LETTER GJE
+ u'\u0453' # 0xAF -> CYRILLIC SMALL LETTER GJE
+ u'\u221e' # 0xB0 -> INFINITY
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO
+ u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO
+ u'\u0456' # 0xB4 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\u0491' # 0xB6 -> CYRILLIC SMALL LETTER GHE WITH UPTURN
+ u'\u0408' # 0xB7 -> CYRILLIC CAPITAL LETTER JE
+ u'\u0404' # 0xB8 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE
+ u'\u0454' # 0xB9 -> CYRILLIC SMALL LETTER UKRAINIAN IE
+ u'\u0407' # 0xBA -> CYRILLIC CAPITAL LETTER YI
+ u'\u0457' # 0xBB -> CYRILLIC SMALL LETTER YI
+ u'\u0409' # 0xBC -> CYRILLIC CAPITAL LETTER LJE
+ u'\u0459' # 0xBD -> CYRILLIC SMALL LETTER LJE
+ u'\u040a' # 0xBE -> CYRILLIC CAPITAL LETTER NJE
+ u'\u045a' # 0xBF -> CYRILLIC SMALL LETTER NJE
+ u'\u0458' # 0xC0 -> CYRILLIC SMALL LETTER JE
+ u'\u0405' # 0xC1 -> CYRILLIC CAPITAL LETTER DZE
+ u'\xac' # 0xC2 -> NOT SIGN
+ u'\u221a' # 0xC3 -> SQUARE ROOT
+ u'\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK
+ u'\u2248' # 0xC5 -> ALMOST EQUAL TO
+ u'\u2206' # 0xC6 -> INCREMENT
+ u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS
+ u'\xa0' # 0xCA -> NO-BREAK SPACE
+ u'\u040b' # 0xCB -> CYRILLIC CAPITAL LETTER TSHE
+ u'\u045b' # 0xCC -> CYRILLIC SMALL LETTER TSHE
+ u'\u040c' # 0xCD -> CYRILLIC CAPITAL LETTER KJE
+ u'\u045c' # 0xCE -> CYRILLIC SMALL LETTER KJE
+ u'\u0455' # 0xCF -> CYRILLIC SMALL LETTER DZE
+ u'\u2013' # 0xD0 -> EN DASH
+ u'\u2014' # 0xD1 -> EM DASH
+ u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK
+ u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK
+ u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK
+ u'\xf7' # 0xD6 -> DIVISION SIGN
+ u'\u201e' # 0xD7 -> DOUBLE LOW-9 QUOTATION MARK
+ u'\u040e' # 0xD8 -> CYRILLIC CAPITAL LETTER SHORT U
+ u'\u045e' # 0xD9 -> CYRILLIC SMALL LETTER SHORT U
+ u'\u040f' # 0xDA -> CYRILLIC CAPITAL LETTER DZHE
+ u'\u045f' # 0xDB -> CYRILLIC SMALL LETTER DZHE
+ u'\u2116' # 0xDC -> NUMERO SIGN
+ u'\u0401' # 0xDD -> CYRILLIC CAPITAL LETTER IO
+ u'\u0451' # 0xDE -> CYRILLIC SMALL LETTER IO
+ u'\u044f' # 0xDF -> CYRILLIC SMALL LETTER YA
+ u'\u0430' # 0xE0 -> CYRILLIC SMALL LETTER A
+ u'\u0431' # 0xE1 -> CYRILLIC SMALL LETTER BE
+ u'\u0432' # 0xE2 -> CYRILLIC SMALL LETTER VE
+ u'\u0433' # 0xE3 -> CYRILLIC SMALL LETTER GHE
+ u'\u0434' # 0xE4 -> CYRILLIC SMALL LETTER DE
+ u'\u0435' # 0xE5 -> CYRILLIC SMALL LETTER IE
+ u'\u0436' # 0xE6 -> CYRILLIC SMALL LETTER ZHE
+ u'\u0437' # 0xE7 -> CYRILLIC SMALL LETTER ZE
+ u'\u0438' # 0xE8 -> CYRILLIC SMALL LETTER I
+ u'\u0439' # 0xE9 -> CYRILLIC SMALL LETTER SHORT I
+ u'\u043a' # 0xEA -> CYRILLIC SMALL LETTER KA
+ u'\u043b' # 0xEB -> CYRILLIC SMALL LETTER EL
+ u'\u043c' # 0xEC -> CYRILLIC SMALL LETTER EM
+ u'\u043d' # 0xED -> CYRILLIC SMALL LETTER EN
+ u'\u043e' # 0xEE -> CYRILLIC SMALL LETTER O
+ u'\u043f' # 0xEF -> CYRILLIC SMALL LETTER PE
+ u'\u0440' # 0xF0 -> CYRILLIC SMALL LETTER ER
+ u'\u0441' # 0xF1 -> CYRILLIC SMALL LETTER ES
+ u'\u0442' # 0xF2 -> CYRILLIC SMALL LETTER TE
+ u'\u0443' # 0xF3 -> CYRILLIC SMALL LETTER U
+ u'\u0444' # 0xF4 -> CYRILLIC SMALL LETTER EF
+ u'\u0445' # 0xF5 -> CYRILLIC SMALL LETTER HA
+ u'\u0446' # 0xF6 -> CYRILLIC SMALL LETTER TSE
+ u'\u0447' # 0xF7 -> CYRILLIC SMALL LETTER CHE
+ u'\u0448' # 0xF8 -> CYRILLIC SMALL LETTER SHA
+ u'\u0449' # 0xF9 -> CYRILLIC SMALL LETTER SHCHA
+ u'\u044a' # 0xFA -> CYRILLIC SMALL LETTER HARD SIGN
+ u'\u044b' # 0xFB -> CYRILLIC SMALL LETTER YERU
+ u'\u044c' # 0xFC -> CYRILLIC SMALL LETTER SOFT SIGN
+ u'\u044d' # 0xFD -> CYRILLIC SMALL LETTER E
+ u'\u044e' # 0xFE -> CYRILLIC SMALL LETTER YU
+ u'\u20ac' # 0xFF -> EURO SIGN
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..06d92853c9
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_farsi.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec mac_farsi generated from 'MAPPINGS/VENDORS/APPLE/FARSI.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='mac-farsi',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> CONTROL CHARACTER
+ u'\x01' # 0x01 -> CONTROL CHARACTER
+ u'\x02' # 0x02 -> CONTROL CHARACTER
+ u'\x03' # 0x03 -> CONTROL CHARACTER
+ u'\x04' # 0x04 -> CONTROL CHARACTER
+ u'\x05' # 0x05 -> CONTROL CHARACTER
+ u'\x06' # 0x06 -> CONTROL CHARACTER
+ u'\x07' # 0x07 -> CONTROL CHARACTER
+ u'\x08' # 0x08 -> CONTROL CHARACTER
+ u'\t' # 0x09 -> CONTROL CHARACTER
+ u'\n' # 0x0A -> CONTROL CHARACTER
+ u'\x0b' # 0x0B -> CONTROL CHARACTER
+ u'\x0c' # 0x0C -> CONTROL CHARACTER
+ u'\r' # 0x0D -> CONTROL CHARACTER
+ u'\x0e' # 0x0E -> CONTROL CHARACTER
+ u'\x0f' # 0x0F -> CONTROL CHARACTER
+ u'\x10' # 0x10 -> CONTROL CHARACTER
+ u'\x11' # 0x11 -> CONTROL CHARACTER
+ u'\x12' # 0x12 -> CONTROL CHARACTER
+ u'\x13' # 0x13 -> CONTROL CHARACTER
+ u'\x14' # 0x14 -> CONTROL CHARACTER
+ u'\x15' # 0x15 -> CONTROL CHARACTER
+ u'\x16' # 0x16 -> CONTROL CHARACTER
+ u'\x17' # 0x17 -> CONTROL CHARACTER
+ u'\x18' # 0x18 -> CONTROL CHARACTER
+ u'\x19' # 0x19 -> CONTROL CHARACTER
+ u'\x1a' # 0x1A -> CONTROL CHARACTER
+ u'\x1b' # 0x1B -> CONTROL CHARACTER
+ u'\x1c' # 0x1C -> CONTROL CHARACTER
+ u'\x1d' # 0x1D -> CONTROL CHARACTER
+ u'\x1e' # 0x1E -> CONTROL CHARACTER
+ u'\x1f' # 0x1F -> CONTROL CHARACTER
+ u' ' # 0x20 -> SPACE, left-right
+ u'!' # 0x21 -> EXCLAMATION MARK, left-right
+ u'"' # 0x22 -> QUOTATION MARK, left-right
+ u'#' # 0x23 -> NUMBER SIGN, left-right
+ u'$' # 0x24 -> DOLLAR SIGN, left-right
+ u'%' # 0x25 -> PERCENT SIGN, left-right
+ u'&' # 0x26 -> AMPERSAND, left-right
+ u"'" # 0x27 -> APOSTROPHE, left-right
+ u'(' # 0x28 -> LEFT PARENTHESIS, left-right
+ u')' # 0x29 -> RIGHT PARENTHESIS, left-right
+ u'*' # 0x2A -> ASTERISK, left-right
+ u'+' # 0x2B -> PLUS SIGN, left-right
+ u',' # 0x2C -> COMMA, left-right; in Arabic-script context, displayed as 0x066C ARABIC THOUSANDS SEPARATOR
+ u'-' # 0x2D -> HYPHEN-MINUS, left-right
+ u'.' # 0x2E -> FULL STOP, left-right; in Arabic-script context, displayed as 0x066B ARABIC DECIMAL SEPARATOR
+ u'/' # 0x2F -> SOLIDUS, left-right
+ u'0' # 0x30 -> DIGIT ZERO; in Arabic-script context, displayed as 0x06F0 EXTENDED ARABIC-INDIC DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE; in Arabic-script context, displayed as 0x06F1 EXTENDED ARABIC-INDIC DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO; in Arabic-script context, displayed as 0x06F2 EXTENDED ARABIC-INDIC DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE; in Arabic-script context, displayed as 0x06F3 EXTENDED ARABIC-INDIC DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR; in Arabic-script context, displayed as 0x06F4 EXTENDED ARABIC-INDIC DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE; in Arabic-script context, displayed as 0x06F5 EXTENDED ARABIC-INDIC DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX; in Arabic-script context, displayed as 0x06F6 EXTENDED ARABIC-INDIC DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN; in Arabic-script context, displayed as 0x06F7 EXTENDED ARABIC-INDIC DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT; in Arabic-script context, displayed as 0x06F8 EXTENDED ARABIC-INDIC DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE; in Arabic-script context, displayed as 0x06F9 EXTENDED ARABIC-INDIC DIGIT NINE
+ u':' # 0x3A -> COLON, left-right
+ u';' # 0x3B -> SEMICOLON, left-right
+ u'<' # 0x3C -> LESS-THAN SIGN, left-right
+ u'=' # 0x3D -> EQUALS SIGN, left-right
+ u'>' # 0x3E -> GREATER-THAN SIGN, left-right
+ u'?' # 0x3F -> QUESTION MARK, left-right
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET, left-right
+ u'\\' # 0x5C -> REVERSE SOLIDUS, left-right
+ u']' # 0x5D -> RIGHT SQUARE BRACKET, left-right
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT, left-right
+ u'_' # 0x5F -> LOW LINE, left-right
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET, left-right
+ u'|' # 0x7C -> VERTICAL LINE, left-right
+ u'}' # 0x7D -> RIGHT CURLY BRACKET, left-right
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> CONTROL CHARACTER
+ u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xa0' # 0x81 -> NO-BREAK SPACE, right-left
+ u'\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\u06ba' # 0x8B -> ARABIC LETTER NOON GHUNNA
+ u'\xab' # 0x8C -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left
+ u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\u2026' # 0x93 -> HORIZONTAL ELLIPSIS, right-left
+ u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xbb' # 0x98 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left
+ u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf7' # 0x9B -> DIVISION SIGN, right-left
+ u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS
+ u' ' # 0xA0 -> SPACE, right-left
+ u'!' # 0xA1 -> EXCLAMATION MARK, right-left
+ u'"' # 0xA2 -> QUOTATION MARK, right-left
+ u'#' # 0xA3 -> NUMBER SIGN, right-left
+ u'$' # 0xA4 -> DOLLAR SIGN, right-left
+ u'\u066a' # 0xA5 -> ARABIC PERCENT SIGN
+ u'&' # 0xA6 -> AMPERSAND, right-left
+ u"'" # 0xA7 -> APOSTROPHE, right-left
+ u'(' # 0xA8 -> LEFT PARENTHESIS, right-left
+ u')' # 0xA9 -> RIGHT PARENTHESIS, right-left
+ u'*' # 0xAA -> ASTERISK, right-left
+ u'+' # 0xAB -> PLUS SIGN, right-left
+ u'\u060c' # 0xAC -> ARABIC COMMA
+ u'-' # 0xAD -> HYPHEN-MINUS, right-left
+ u'.' # 0xAE -> FULL STOP, right-left
+ u'/' # 0xAF -> SOLIDUS, right-left
+ u'\u06f0' # 0xB0 -> EXTENDED ARABIC-INDIC DIGIT ZERO, right-left (need override)
+ u'\u06f1' # 0xB1 -> EXTENDED ARABIC-INDIC DIGIT ONE, right-left (need override)
+ u'\u06f2' # 0xB2 -> EXTENDED ARABIC-INDIC DIGIT TWO, right-left (need override)
+ u'\u06f3' # 0xB3 -> EXTENDED ARABIC-INDIC DIGIT THREE, right-left (need override)
+ u'\u06f4' # 0xB4 -> EXTENDED ARABIC-INDIC DIGIT FOUR, right-left (need override)
+ u'\u06f5' # 0xB5 -> EXTENDED ARABIC-INDIC DIGIT FIVE, right-left (need override)
+ u'\u06f6' # 0xB6 -> EXTENDED ARABIC-INDIC DIGIT SIX, right-left (need override)
+ u'\u06f7' # 0xB7 -> EXTENDED ARABIC-INDIC DIGIT SEVEN, right-left (need override)
+ u'\u06f8' # 0xB8 -> EXTENDED ARABIC-INDIC DIGIT EIGHT, right-left (need override)
+ u'\u06f9' # 0xB9 -> EXTENDED ARABIC-INDIC DIGIT NINE, right-left (need override)
+ u':' # 0xBA -> COLON, right-left
+ u'\u061b' # 0xBB -> ARABIC SEMICOLON
+ u'<' # 0xBC -> LESS-THAN SIGN, right-left
+ u'=' # 0xBD -> EQUALS SIGN, right-left
+ u'>' # 0xBE -> GREATER-THAN SIGN, right-left
+ u'\u061f' # 0xBF -> ARABIC QUESTION MARK
+ u'\u274a' # 0xC0 -> EIGHT TEARDROP-SPOKED PROPELLER ASTERISK, right-left
+ u'\u0621' # 0xC1 -> ARABIC LETTER HAMZA
+ u'\u0622' # 0xC2 -> ARABIC LETTER ALEF WITH MADDA ABOVE
+ u'\u0623' # 0xC3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE
+ u'\u0624' # 0xC4 -> ARABIC LETTER WAW WITH HAMZA ABOVE
+ u'\u0625' # 0xC5 -> ARABIC LETTER ALEF WITH HAMZA BELOW
+ u'\u0626' # 0xC6 -> ARABIC LETTER YEH WITH HAMZA ABOVE
+ u'\u0627' # 0xC7 -> ARABIC LETTER ALEF
+ u'\u0628' # 0xC8 -> ARABIC LETTER BEH
+ u'\u0629' # 0xC9 -> ARABIC LETTER TEH MARBUTA
+ u'\u062a' # 0xCA -> ARABIC LETTER TEH
+ u'\u062b' # 0xCB -> ARABIC LETTER THEH
+ u'\u062c' # 0xCC -> ARABIC LETTER JEEM
+ u'\u062d' # 0xCD -> ARABIC LETTER HAH
+ u'\u062e' # 0xCE -> ARABIC LETTER KHAH
+ u'\u062f' # 0xCF -> ARABIC LETTER DAL
+ u'\u0630' # 0xD0 -> ARABIC LETTER THAL
+ u'\u0631' # 0xD1 -> ARABIC LETTER REH
+ u'\u0632' # 0xD2 -> ARABIC LETTER ZAIN
+ u'\u0633' # 0xD3 -> ARABIC LETTER SEEN
+ u'\u0634' # 0xD4 -> ARABIC LETTER SHEEN
+ u'\u0635' # 0xD5 -> ARABIC LETTER SAD
+ u'\u0636' # 0xD6 -> ARABIC LETTER DAD
+ u'\u0637' # 0xD7 -> ARABIC LETTER TAH
+ u'\u0638' # 0xD8 -> ARABIC LETTER ZAH
+ u'\u0639' # 0xD9 -> ARABIC LETTER AIN
+ u'\u063a' # 0xDA -> ARABIC LETTER GHAIN
+ u'[' # 0xDB -> LEFT SQUARE BRACKET, right-left
+ u'\\' # 0xDC -> REVERSE SOLIDUS, right-left
+ u']' # 0xDD -> RIGHT SQUARE BRACKET, right-left
+ u'^' # 0xDE -> CIRCUMFLEX ACCENT, right-left
+ u'_' # 0xDF -> LOW LINE, right-left
+ u'\u0640' # 0xE0 -> ARABIC TATWEEL
+ u'\u0641' # 0xE1 -> ARABIC LETTER FEH
+ u'\u0642' # 0xE2 -> ARABIC LETTER QAF
+ u'\u0643' # 0xE3 -> ARABIC LETTER KAF
+ u'\u0644' # 0xE4 -> ARABIC LETTER LAM
+ u'\u0645' # 0xE5 -> ARABIC LETTER MEEM
+ u'\u0646' # 0xE6 -> ARABIC LETTER NOON
+ u'\u0647' # 0xE7 -> ARABIC LETTER HEH
+ u'\u0648' # 0xE8 -> ARABIC LETTER WAW
+ u'\u0649' # 0xE9 -> ARABIC LETTER ALEF MAKSURA
+ u'\u064a' # 0xEA -> ARABIC LETTER YEH
+ u'\u064b' # 0xEB -> ARABIC FATHATAN
+ u'\u064c' # 0xEC -> ARABIC DAMMATAN
+ u'\u064d' # 0xED -> ARABIC KASRATAN
+ u'\u064e' # 0xEE -> ARABIC FATHA
+ u'\u064f' # 0xEF -> ARABIC DAMMA
+ u'\u0650' # 0xF0 -> ARABIC KASRA
+ u'\u0651' # 0xF1 -> ARABIC SHADDA
+ u'\u0652' # 0xF2 -> ARABIC SUKUN
+ u'\u067e' # 0xF3 -> ARABIC LETTER PEH
+ u'\u0679' # 0xF4 -> ARABIC LETTER TTEH
+ u'\u0686' # 0xF5 -> ARABIC LETTER TCHEH
+ u'\u06d5' # 0xF6 -> ARABIC LETTER AE
+ u'\u06a4' # 0xF7 -> ARABIC LETTER VEH
+ u'\u06af' # 0xF8 -> ARABIC LETTER GAF
+ u'\u0688' # 0xF9 -> ARABIC LETTER DDAL
+ u'\u0691' # 0xFA -> ARABIC LETTER RREH
+ u'{' # 0xFB -> LEFT CURLY BRACKET, right-left
+ u'|' # 0xFC -> VERTICAL LINE, right-left
+ u'}' # 0xFD -> RIGHT CURLY BRACKET, right-left
+ u'\u0698' # 0xFE -> ARABIC LETTER JEH
+ u'\u06d2' # 0xFF -> ARABIC LETTER YEH BARREE
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..77a25f4789
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_greek.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec mac_greek generated from 'MAPPINGS/VENDORS/APPLE/GREEK.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='mac-greek',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> CONTROL CHARACTER
+ u'\x01' # 0x01 -> CONTROL CHARACTER
+ u'\x02' # 0x02 -> CONTROL CHARACTER
+ u'\x03' # 0x03 -> CONTROL CHARACTER
+ u'\x04' # 0x04 -> CONTROL CHARACTER
+ u'\x05' # 0x05 -> CONTROL CHARACTER
+ u'\x06' # 0x06 -> CONTROL CHARACTER
+ u'\x07' # 0x07 -> CONTROL CHARACTER
+ u'\x08' # 0x08 -> CONTROL CHARACTER
+ u'\t' # 0x09 -> CONTROL CHARACTER
+ u'\n' # 0x0A -> CONTROL CHARACTER
+ u'\x0b' # 0x0B -> CONTROL CHARACTER
+ u'\x0c' # 0x0C -> CONTROL CHARACTER
+ u'\r' # 0x0D -> CONTROL CHARACTER
+ u'\x0e' # 0x0E -> CONTROL CHARACTER
+ u'\x0f' # 0x0F -> CONTROL CHARACTER
+ u'\x10' # 0x10 -> CONTROL CHARACTER
+ u'\x11' # 0x11 -> CONTROL CHARACTER
+ u'\x12' # 0x12 -> CONTROL CHARACTER
+ u'\x13' # 0x13 -> CONTROL CHARACTER
+ u'\x14' # 0x14 -> CONTROL CHARACTER
+ u'\x15' # 0x15 -> CONTROL CHARACTER
+ u'\x16' # 0x16 -> CONTROL CHARACTER
+ u'\x17' # 0x17 -> CONTROL CHARACTER
+ u'\x18' # 0x18 -> CONTROL CHARACTER
+ u'\x19' # 0x19 -> CONTROL CHARACTER
+ u'\x1a' # 0x1A -> CONTROL CHARACTER
+ u'\x1b' # 0x1B -> CONTROL CHARACTER
+ u'\x1c' # 0x1C -> CONTROL CHARACTER
+ u'\x1d' # 0x1D -> CONTROL CHARACTER
+ u'\x1e' # 0x1E -> CONTROL CHARACTER
+ u'\x1f' # 0x1F -> CONTROL CHARACTER
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> CONTROL CHARACTER
+ u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xb9' # 0x81 -> SUPERSCRIPT ONE
+ u'\xb2' # 0x82 -> SUPERSCRIPT TWO
+ u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xb3' # 0x84 -> SUPERSCRIPT THREE
+ u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\u0385' # 0x87 -> GREEK DIALYTIKA TONOS
+ u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\u0384' # 0x8B -> GREEK TONOS
+ u'\xa8' # 0x8C -> DIAERESIS
+ u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xa3' # 0x92 -> POUND SIGN
+ u'\u2122' # 0x93 -> TRADE MARK SIGN
+ u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\u2022' # 0x96 -> BULLET
+ u'\xbd' # 0x97 -> VULGAR FRACTION ONE HALF
+ u'\u2030' # 0x98 -> PER MILLE SIGN
+ u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xa6' # 0x9B -> BROKEN BAR
+ u'\u20ac' # 0x9C -> EURO SIGN # before Mac OS 9.2.2, was SOFT HYPHEN
+ u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\u2020' # 0xA0 -> DAGGER
+ u'\u0393' # 0xA1 -> GREEK CAPITAL LETTER GAMMA
+ u'\u0394' # 0xA2 -> GREEK CAPITAL LETTER DELTA
+ u'\u0398' # 0xA3 -> GREEK CAPITAL LETTER THETA
+ u'\u039b' # 0xA4 -> GREEK CAPITAL LETTER LAMDA
+ u'\u039e' # 0xA5 -> GREEK CAPITAL LETTER XI
+ u'\u03a0' # 0xA6 -> GREEK CAPITAL LETTER PI
+ u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S
+ u'\xae' # 0xA8 -> REGISTERED SIGN
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\u03a3' # 0xAA -> GREEK CAPITAL LETTER SIGMA
+ u'\u03aa' # 0xAB -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA
+ u'\xa7' # 0xAC -> SECTION SIGN
+ u'\u2260' # 0xAD -> NOT EQUAL TO
+ u'\xb0' # 0xAE -> DEGREE SIGN
+ u'\xb7' # 0xAF -> MIDDLE DOT
+ u'\u0391' # 0xB0 -> GREEK CAPITAL LETTER ALPHA
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO
+ u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO
+ u'\xa5' # 0xB4 -> YEN SIGN
+ u'\u0392' # 0xB5 -> GREEK CAPITAL LETTER BETA
+ u'\u0395' # 0xB6 -> GREEK CAPITAL LETTER EPSILON
+ u'\u0396' # 0xB7 -> GREEK CAPITAL LETTER ZETA
+ u'\u0397' # 0xB8 -> GREEK CAPITAL LETTER ETA
+ u'\u0399' # 0xB9 -> GREEK CAPITAL LETTER IOTA
+ u'\u039a' # 0xBA -> GREEK CAPITAL LETTER KAPPA
+ u'\u039c' # 0xBB -> GREEK CAPITAL LETTER MU
+ u'\u03a6' # 0xBC -> GREEK CAPITAL LETTER PHI
+ u'\u03ab' # 0xBD -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
+ u'\u03a8' # 0xBE -> GREEK CAPITAL LETTER PSI
+ u'\u03a9' # 0xBF -> GREEK CAPITAL LETTER OMEGA
+ u'\u03ac' # 0xC0 -> GREEK SMALL LETTER ALPHA WITH TONOS
+ u'\u039d' # 0xC1 -> GREEK CAPITAL LETTER NU
+ u'\xac' # 0xC2 -> NOT SIGN
+ u'\u039f' # 0xC3 -> GREEK CAPITAL LETTER OMICRON
+ u'\u03a1' # 0xC4 -> GREEK CAPITAL LETTER RHO
+ u'\u2248' # 0xC5 -> ALMOST EQUAL TO
+ u'\u03a4' # 0xC6 -> GREEK CAPITAL LETTER TAU
+ u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS
+ u'\xa0' # 0xCA -> NO-BREAK SPACE
+ u'\u03a5' # 0xCB -> GREEK CAPITAL LETTER UPSILON
+ u'\u03a7' # 0xCC -> GREEK CAPITAL LETTER CHI
+ u'\u0386' # 0xCD -> GREEK CAPITAL LETTER ALPHA WITH TONOS
+ u'\u0388' # 0xCE -> GREEK CAPITAL LETTER EPSILON WITH TONOS
+ u'\u0153' # 0xCF -> LATIN SMALL LIGATURE OE
+ u'\u2013' # 0xD0 -> EN DASH
+ u'\u2015' # 0xD1 -> HORIZONTAL BAR
+ u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK
+ u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK
+ u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK
+ u'\xf7' # 0xD6 -> DIVISION SIGN
+ u'\u0389' # 0xD7 -> GREEK CAPITAL LETTER ETA WITH TONOS
+ u'\u038a' # 0xD8 -> GREEK CAPITAL LETTER IOTA WITH TONOS
+ u'\u038c' # 0xD9 -> GREEK CAPITAL LETTER OMICRON WITH TONOS
+ u'\u038e' # 0xDA -> GREEK CAPITAL LETTER UPSILON WITH TONOS
+ u'\u03ad' # 0xDB -> GREEK SMALL LETTER EPSILON WITH TONOS
+ u'\u03ae' # 0xDC -> GREEK SMALL LETTER ETA WITH TONOS
+ u'\u03af' # 0xDD -> GREEK SMALL LETTER IOTA WITH TONOS
+ u'\u03cc' # 0xDE -> GREEK SMALL LETTER OMICRON WITH TONOS
+ u'\u038f' # 0xDF -> GREEK CAPITAL LETTER OMEGA WITH TONOS
+ u'\u03cd' # 0xE0 -> GREEK SMALL LETTER UPSILON WITH TONOS
+ u'\u03b1' # 0xE1 -> GREEK SMALL LETTER ALPHA
+ u'\u03b2' # 0xE2 -> GREEK SMALL LETTER BETA
+ u'\u03c8' # 0xE3 -> GREEK SMALL LETTER PSI
+ u'\u03b4' # 0xE4 -> GREEK SMALL LETTER DELTA
+ u'\u03b5' # 0xE5 -> GREEK SMALL LETTER EPSILON
+ u'\u03c6' # 0xE6 -> GREEK SMALL LETTER PHI
+ u'\u03b3' # 0xE7 -> GREEK SMALL LETTER GAMMA
+ u'\u03b7' # 0xE8 -> GREEK SMALL LETTER ETA
+ u'\u03b9' # 0xE9 -> GREEK SMALL LETTER IOTA
+ u'\u03be' # 0xEA -> GREEK SMALL LETTER XI
+ u'\u03ba' # 0xEB -> GREEK SMALL LETTER KAPPA
+ u'\u03bb' # 0xEC -> GREEK SMALL LETTER LAMDA
+ u'\u03bc' # 0xED -> GREEK SMALL LETTER MU
+ u'\u03bd' # 0xEE -> GREEK SMALL LETTER NU
+ u'\u03bf' # 0xEF -> GREEK SMALL LETTER OMICRON
+ u'\u03c0' # 0xF0 -> GREEK SMALL LETTER PI
+ u'\u03ce' # 0xF1 -> GREEK SMALL LETTER OMEGA WITH TONOS
+ u'\u03c1' # 0xF2 -> GREEK SMALL LETTER RHO
+ u'\u03c3' # 0xF3 -> GREEK SMALL LETTER SIGMA
+ u'\u03c4' # 0xF4 -> GREEK SMALL LETTER TAU
+ u'\u03b8' # 0xF5 -> GREEK SMALL LETTER THETA
+ u'\u03c9' # 0xF6 -> GREEK SMALL LETTER OMEGA
+ u'\u03c2' # 0xF7 -> GREEK SMALL LETTER FINAL SIGMA
+ u'\u03c7' # 0xF8 -> GREEK SMALL LETTER CHI
+ u'\u03c5' # 0xF9 -> GREEK SMALL LETTER UPSILON
+ u'\u03b6' # 0xFA -> GREEK SMALL LETTER ZETA
+ u'\u03ca' # 0xFB -> GREEK SMALL LETTER IOTA WITH DIALYTIKA
+ u'\u03cb' # 0xFC -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA
+ u'\u0390' # 0xFD -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS
+ u'\u03b0' # 0xFE -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS
+ u'\xad' # 0xFF -> SOFT HYPHEN # before Mac OS 9.2.2, was undefined
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..7045dc1c3f
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_iceland.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec mac_iceland generated from 'MAPPINGS/VENDORS/APPLE/ICELAND.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='mac-iceland',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> CONTROL CHARACTER
+ u'\x01' # 0x01 -> CONTROL CHARACTER
+ u'\x02' # 0x02 -> CONTROL CHARACTER
+ u'\x03' # 0x03 -> CONTROL CHARACTER
+ u'\x04' # 0x04 -> CONTROL CHARACTER
+ u'\x05' # 0x05 -> CONTROL CHARACTER
+ u'\x06' # 0x06 -> CONTROL CHARACTER
+ u'\x07' # 0x07 -> CONTROL CHARACTER
+ u'\x08' # 0x08 -> CONTROL CHARACTER
+ u'\t' # 0x09 -> CONTROL CHARACTER
+ u'\n' # 0x0A -> CONTROL CHARACTER
+ u'\x0b' # 0x0B -> CONTROL CHARACTER
+ u'\x0c' # 0x0C -> CONTROL CHARACTER
+ u'\r' # 0x0D -> CONTROL CHARACTER
+ u'\x0e' # 0x0E -> CONTROL CHARACTER
+ u'\x0f' # 0x0F -> CONTROL CHARACTER
+ u'\x10' # 0x10 -> CONTROL CHARACTER
+ u'\x11' # 0x11 -> CONTROL CHARACTER
+ u'\x12' # 0x12 -> CONTROL CHARACTER
+ u'\x13' # 0x13 -> CONTROL CHARACTER
+ u'\x14' # 0x14 -> CONTROL CHARACTER
+ u'\x15' # 0x15 -> CONTROL CHARACTER
+ u'\x16' # 0x16 -> CONTROL CHARACTER
+ u'\x17' # 0x17 -> CONTROL CHARACTER
+ u'\x18' # 0x18 -> CONTROL CHARACTER
+ u'\x19' # 0x19 -> CONTROL CHARACTER
+ u'\x1a' # 0x1A -> CONTROL CHARACTER
+ u'\x1b' # 0x1B -> CONTROL CHARACTER
+ u'\x1c' # 0x1C -> CONTROL CHARACTER
+ u'\x1d' # 0x1D -> CONTROL CHARACTER
+ u'\x1e' # 0x1E -> CONTROL CHARACTER
+ u'\x1f' # 0x1F -> CONTROL CHARACTER
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> CONTROL CHARACTER
+ u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE
+ u'\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE
+ u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\xdd' # 0xA0 -> LATIN CAPITAL LETTER Y WITH ACUTE
+ u'\xb0' # 0xA1 -> DEGREE SIGN
+ u'\xa2' # 0xA2 -> CENT SIGN
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\xa7' # 0xA4 -> SECTION SIGN
+ u'\u2022' # 0xA5 -> BULLET
+ u'\xb6' # 0xA6 -> PILCROW SIGN
+ u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S
+ u'\xae' # 0xA8 -> REGISTERED SIGN
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\u2122' # 0xAA -> TRADE MARK SIGN
+ u'\xb4' # 0xAB -> ACUTE ACCENT
+ u'\xa8' # 0xAC -> DIAERESIS
+ u'\u2260' # 0xAD -> NOT EQUAL TO
+ u'\xc6' # 0xAE -> LATIN CAPITAL LETTER AE
+ u'\xd8' # 0xAF -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\u221e' # 0xB0 -> INFINITY
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO
+ u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO
+ u'\xa5' # 0xB4 -> YEN SIGN
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL
+ u'\u2211' # 0xB7 -> N-ARY SUMMATION
+ u'\u220f' # 0xB8 -> N-ARY PRODUCT
+ u'\u03c0' # 0xB9 -> GREEK SMALL LETTER PI
+ u'\u222b' # 0xBA -> INTEGRAL
+ u'\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR
+ u'\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR
+ u'\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA
+ u'\xe6' # 0xBE -> LATIN SMALL LETTER AE
+ u'\xf8' # 0xBF -> LATIN SMALL LETTER O WITH STROKE
+ u'\xbf' # 0xC0 -> INVERTED QUESTION MARK
+ u'\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK
+ u'\xac' # 0xC2 -> NOT SIGN
+ u'\u221a' # 0xC3 -> SQUARE ROOT
+ u'\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK
+ u'\u2248' # 0xC5 -> ALMOST EQUAL TO
+ u'\u2206' # 0xC6 -> INCREMENT
+ u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS
+ u'\xa0' # 0xCA -> NO-BREAK SPACE
+ u'\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE
+ u'\u0153' # 0xCF -> LATIN SMALL LIGATURE OE
+ u'\u2013' # 0xD0 -> EN DASH
+ u'\u2014' # 0xD1 -> EM DASH
+ u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK
+ u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK
+ u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK
+ u'\xf7' # 0xD6 -> DIVISION SIGN
+ u'\u25ca' # 0xD7 -> LOZENGE
+ u'\xff' # 0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS
+ u'\u0178' # 0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS
+ u'\u2044' # 0xDA -> FRACTION SLASH
+ u'\u20ac' # 0xDB -> EURO SIGN
+ u'\xd0' # 0xDC -> LATIN CAPITAL LETTER ETH
+ u'\xf0' # 0xDD -> LATIN SMALL LETTER ETH
+ u'\xde' # 0xDE -> LATIN CAPITAL LETTER THORN
+ u'\xfe' # 0xDF -> LATIN SMALL LETTER THORN
+ u'\xfd' # 0xE0 -> LATIN SMALL LETTER Y WITH ACUTE
+ u'\xb7' # 0xE1 -> MIDDLE DOT
+ u'\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK
+ u'\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK
+ u'\u2030' # 0xE4 -> PER MILLE SIGN
+ u'\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xca' # 0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xcb' # 0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\uf8ff' # 0xF0 -> Apple logo
+ u'\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\u0131' # 0xF5 -> LATIN SMALL LETTER DOTLESS I
+ u'\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT
+ u'\u02dc' # 0xF7 -> SMALL TILDE
+ u'\xaf' # 0xF8 -> MACRON
+ u'\u02d8' # 0xF9 -> BREVE
+ u'\u02d9' # 0xFA -> DOT ABOVE
+ u'\u02da' # 0xFB -> RING ABOVE
+ u'\xb8' # 0xFC -> CEDILLA
+ u'\u02dd' # 0xFD -> DOUBLE ACUTE ACCENT
+ u'\u02db' # 0xFE -> OGONEK
+ u'\u02c7' # 0xFF -> CARON
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..324b4aff4c
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_latin2.py
@@ -0,0 +1,183 @@
+""" Python Character Mapping Codec generated from 'LATIN2.TXT' with gencodec.py.
+
+Written by Marc-Andre Lemburg (mal@lemburg.com).
+
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
+(c) Copyright 2000 Guido van Rossum.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_map)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_map)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='mac-latin2',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0080: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS
+ 0x0081: 0x0100, # LATIN CAPITAL LETTER A WITH MACRON
+ 0x0082: 0x0101, # LATIN SMALL LETTER A WITH MACRON
+ 0x0083: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE
+ 0x0084: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK
+ 0x0085: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS
+ 0x0086: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS
+ 0x0087: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE
+ 0x0088: 0x0105, # LATIN SMALL LETTER A WITH OGONEK
+ 0x0089: 0x010c, # LATIN CAPITAL LETTER C WITH CARON
+ 0x008a: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS
+ 0x008b: 0x010d, # LATIN SMALL LETTER C WITH CARON
+ 0x008c: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE
+ 0x008d: 0x0107, # LATIN SMALL LETTER C WITH ACUTE
+ 0x008e: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE
+ 0x008f: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE
+ 0x0090: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE
+ 0x0091: 0x010e, # LATIN CAPITAL LETTER D WITH CARON
+ 0x0092: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE
+ 0x0093: 0x010f, # LATIN SMALL LETTER D WITH CARON
+ 0x0094: 0x0112, # LATIN CAPITAL LETTER E WITH MACRON
+ 0x0095: 0x0113, # LATIN SMALL LETTER E WITH MACRON
+ 0x0096: 0x0116, # LATIN CAPITAL LETTER E WITH DOT ABOVE
+ 0x0097: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE
+ 0x0098: 0x0117, # LATIN SMALL LETTER E WITH DOT ABOVE
+ 0x0099: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX
+ 0x009a: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS
+ 0x009b: 0x00f5, # LATIN SMALL LETTER O WITH TILDE
+ 0x009c: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE
+ 0x009d: 0x011a, # LATIN CAPITAL LETTER E WITH CARON
+ 0x009e: 0x011b, # LATIN SMALL LETTER E WITH CARON
+ 0x009f: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS
+ 0x00a0: 0x2020, # DAGGER
+ 0x00a1: 0x00b0, # DEGREE SIGN
+ 0x00a2: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK
+ 0x00a4: 0x00a7, # SECTION SIGN
+ 0x00a5: 0x2022, # BULLET
+ 0x00a6: 0x00b6, # PILCROW SIGN
+ 0x00a7: 0x00df, # LATIN SMALL LETTER SHARP S
+ 0x00a8: 0x00ae, # REGISTERED SIGN
+ 0x00aa: 0x2122, # TRADE MARK SIGN
+ 0x00ab: 0x0119, # LATIN SMALL LETTER E WITH OGONEK
+ 0x00ac: 0x00a8, # DIAERESIS
+ 0x00ad: 0x2260, # NOT EQUAL TO
+ 0x00ae: 0x0123, # LATIN SMALL LETTER G WITH CEDILLA
+ 0x00af: 0x012e, # LATIN CAPITAL LETTER I WITH OGONEK
+ 0x00b0: 0x012f, # LATIN SMALL LETTER I WITH OGONEK
+ 0x00b1: 0x012a, # LATIN CAPITAL LETTER I WITH MACRON
+ 0x00b2: 0x2264, # LESS-THAN OR EQUAL TO
+ 0x00b3: 0x2265, # GREATER-THAN OR EQUAL TO
+ 0x00b4: 0x012b, # LATIN SMALL LETTER I WITH MACRON
+ 0x00b5: 0x0136, # LATIN CAPITAL LETTER K WITH CEDILLA
+ 0x00b6: 0x2202, # PARTIAL DIFFERENTIAL
+ 0x00b7: 0x2211, # N-ARY SUMMATION
+ 0x00b8: 0x0142, # LATIN SMALL LETTER L WITH STROKE
+ 0x00b9: 0x013b, # LATIN CAPITAL LETTER L WITH CEDILLA
+ 0x00ba: 0x013c, # LATIN SMALL LETTER L WITH CEDILLA
+ 0x00bb: 0x013d, # LATIN CAPITAL LETTER L WITH CARON
+ 0x00bc: 0x013e, # LATIN SMALL LETTER L WITH CARON
+ 0x00bd: 0x0139, # LATIN CAPITAL LETTER L WITH ACUTE
+ 0x00be: 0x013a, # LATIN SMALL LETTER L WITH ACUTE
+ 0x00bf: 0x0145, # LATIN CAPITAL LETTER N WITH CEDILLA
+ 0x00c0: 0x0146, # LATIN SMALL LETTER N WITH CEDILLA
+ 0x00c1: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE
+ 0x00c2: 0x00ac, # NOT SIGN
+ 0x00c3: 0x221a, # SQUARE ROOT
+ 0x00c4: 0x0144, # LATIN SMALL LETTER N WITH ACUTE
+ 0x00c5: 0x0147, # LATIN CAPITAL LETTER N WITH CARON
+ 0x00c6: 0x2206, # INCREMENT
+ 0x00c7: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00c8: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ 0x00c9: 0x2026, # HORIZONTAL ELLIPSIS
+ 0x00ca: 0x00a0, # NO-BREAK SPACE
+ 0x00cb: 0x0148, # LATIN SMALL LETTER N WITH CARON
+ 0x00cc: 0x0150, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
+ 0x00cd: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE
+ 0x00ce: 0x0151, # LATIN SMALL LETTER O WITH DOUBLE ACUTE
+ 0x00cf: 0x014c, # LATIN CAPITAL LETTER O WITH MACRON
+ 0x00d0: 0x2013, # EN DASH
+ 0x00d1: 0x2014, # EM DASH
+ 0x00d2: 0x201c, # LEFT DOUBLE QUOTATION MARK
+ 0x00d3: 0x201d, # RIGHT DOUBLE QUOTATION MARK
+ 0x00d4: 0x2018, # LEFT SINGLE QUOTATION MARK
+ 0x00d5: 0x2019, # RIGHT SINGLE QUOTATION MARK
+ 0x00d6: 0x00f7, # DIVISION SIGN
+ 0x00d7: 0x25ca, # LOZENGE
+ 0x00d8: 0x014d, # LATIN SMALL LETTER O WITH MACRON
+ 0x00d9: 0x0154, # LATIN CAPITAL LETTER R WITH ACUTE
+ 0x00da: 0x0155, # LATIN SMALL LETTER R WITH ACUTE
+ 0x00db: 0x0158, # LATIN CAPITAL LETTER R WITH CARON
+ 0x00dc: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ 0x00dd: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+ 0x00de: 0x0159, # LATIN SMALL LETTER R WITH CARON
+ 0x00df: 0x0156, # LATIN CAPITAL LETTER R WITH CEDILLA
+ 0x00e0: 0x0157, # LATIN SMALL LETTER R WITH CEDILLA
+ 0x00e1: 0x0160, # LATIN CAPITAL LETTER S WITH CARON
+ 0x00e2: 0x201a, # SINGLE LOW-9 QUOTATION MARK
+ 0x00e3: 0x201e, # DOUBLE LOW-9 QUOTATION MARK
+ 0x00e4: 0x0161, # LATIN SMALL LETTER S WITH CARON
+ 0x00e5: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE
+ 0x00e6: 0x015b, # LATIN SMALL LETTER S WITH ACUTE
+ 0x00e7: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE
+ 0x00e8: 0x0164, # LATIN CAPITAL LETTER T WITH CARON
+ 0x00e9: 0x0165, # LATIN SMALL LETTER T WITH CARON
+ 0x00ea: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE
+ 0x00eb: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON
+ 0x00ec: 0x017e, # LATIN SMALL LETTER Z WITH CARON
+ 0x00ed: 0x016a, # LATIN CAPITAL LETTER U WITH MACRON
+ 0x00ee: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE
+ 0x00ef: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ 0x00f0: 0x016b, # LATIN SMALL LETTER U WITH MACRON
+ 0x00f1: 0x016e, # LATIN CAPITAL LETTER U WITH RING ABOVE
+ 0x00f2: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE
+ 0x00f3: 0x016f, # LATIN SMALL LETTER U WITH RING ABOVE
+ 0x00f4: 0x0170, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
+ 0x00f5: 0x0171, # LATIN SMALL LETTER U WITH DOUBLE ACUTE
+ 0x00f6: 0x0172, # LATIN CAPITAL LETTER U WITH OGONEK
+ 0x00f7: 0x0173, # LATIN SMALL LETTER U WITH OGONEK
+ 0x00f8: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE
+ 0x00f9: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE
+ 0x00fa: 0x0137, # LATIN SMALL LETTER K WITH CEDILLA
+ 0x00fb: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE
+ 0x00fc: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE
+ 0x00fd: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE
+ 0x00fe: 0x0122, # LATIN CAPITAL LETTER G WITH CEDILLA
+ 0x00ff: 0x02c7, # CARON
+})
+
+### Encoding Map
+
+encoding_map = codecs.make_encoding_map(decoding_map)
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
index 0000000000..1098501470
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_roman.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec mac_roman generated from 'MAPPINGS/VENDORS/APPLE/ROMAN.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='mac-roman',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> CONTROL CHARACTER
+ u'\x01' # 0x01 -> CONTROL CHARACTER
+ u'\x02' # 0x02 -> CONTROL CHARACTER
+ u'\x03' # 0x03 -> CONTROL CHARACTER
+ u'\x04' # 0x04 -> CONTROL CHARACTER
+ u'\x05' # 0x05 -> CONTROL CHARACTER
+ u'\x06' # 0x06 -> CONTROL CHARACTER
+ u'\x07' # 0x07 -> CONTROL CHARACTER
+ u'\x08' # 0x08 -> CONTROL CHARACTER
+ u'\t' # 0x09 -> CONTROL CHARACTER
+ u'\n' # 0x0A -> CONTROL CHARACTER
+ u'\x0b' # 0x0B -> CONTROL CHARACTER
+ u'\x0c' # 0x0C -> CONTROL CHARACTER
+ u'\r' # 0x0D -> CONTROL CHARACTER
+ u'\x0e' # 0x0E -> CONTROL CHARACTER
+ u'\x0f' # 0x0F -> CONTROL CHARACTER
+ u'\x10' # 0x10 -> CONTROL CHARACTER
+ u'\x11' # 0x11 -> CONTROL CHARACTER
+ u'\x12' # 0x12 -> CONTROL CHARACTER
+ u'\x13' # 0x13 -> CONTROL CHARACTER
+ u'\x14' # 0x14 -> CONTROL CHARACTER
+ u'\x15' # 0x15 -> CONTROL CHARACTER
+ u'\x16' # 0x16 -> CONTROL CHARACTER
+ u'\x17' # 0x17 -> CONTROL CHARACTER
+ u'\x18' # 0x18 -> CONTROL CHARACTER
+ u'\x19' # 0x19 -> CONTROL CHARACTER
+ u'\x1a' # 0x1A -> CONTROL CHARACTER
+ u'\x1b' # 0x1B -> CONTROL CHARACTER
+ u'\x1c' # 0x1C -> CONTROL CHARACTER
+ u'\x1d' # 0x1D -> CONTROL CHARACTER
+ u'\x1e' # 0x1E -> CONTROL CHARACTER
+ u'\x1f' # 0x1F -> CONTROL CHARACTER
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> CONTROL CHARACTER
+ u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE
+ u'\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE
+ u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\u2020' # 0xA0 -> DAGGER
+ u'\xb0' # 0xA1 -> DEGREE SIGN
+ u'\xa2' # 0xA2 -> CENT SIGN
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\xa7' # 0xA4 -> SECTION SIGN
+ u'\u2022' # 0xA5 -> BULLET
+ u'\xb6' # 0xA6 -> PILCROW SIGN
+ u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S
+ u'\xae' # 0xA8 -> REGISTERED SIGN
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\u2122' # 0xAA -> TRADE MARK SIGN
+ u'\xb4' # 0xAB -> ACUTE ACCENT
+ u'\xa8' # 0xAC -> DIAERESIS
+ u'\u2260' # 0xAD -> NOT EQUAL TO
+ u'\xc6' # 0xAE -> LATIN CAPITAL LETTER AE
+ u'\xd8' # 0xAF -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\u221e' # 0xB0 -> INFINITY
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO
+ u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO
+ u'\xa5' # 0xB4 -> YEN SIGN
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL
+ u'\u2211' # 0xB7 -> N-ARY SUMMATION
+ u'\u220f' # 0xB8 -> N-ARY PRODUCT
+ u'\u03c0' # 0xB9 -> GREEK SMALL LETTER PI
+ u'\u222b' # 0xBA -> INTEGRAL
+ u'\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR
+ u'\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR
+ u'\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA
+ u'\xe6' # 0xBE -> LATIN SMALL LETTER AE
+ u'\xf8' # 0xBF -> LATIN SMALL LETTER O WITH STROKE
+ u'\xbf' # 0xC0 -> INVERTED QUESTION MARK
+ u'\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK
+ u'\xac' # 0xC2 -> NOT SIGN
+ u'\u221a' # 0xC3 -> SQUARE ROOT
+ u'\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK
+ u'\u2248' # 0xC5 -> ALMOST EQUAL TO
+ u'\u2206' # 0xC6 -> INCREMENT
+ u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS
+ u'\xa0' # 0xCA -> NO-BREAK SPACE
+ u'\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE
+ u'\u0153' # 0xCF -> LATIN SMALL LIGATURE OE
+ u'\u2013' # 0xD0 -> EN DASH
+ u'\u2014' # 0xD1 -> EM DASH
+ u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK
+ u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK
+ u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK
+ u'\xf7' # 0xD6 -> DIVISION SIGN
+ u'\u25ca' # 0xD7 -> LOZENGE
+ u'\xff' # 0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS
+ u'\u0178' # 0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS
+ u'\u2044' # 0xDA -> FRACTION SLASH
+ u'\u20ac' # 0xDB -> EURO SIGN
+ u'\u2039' # 0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ u'\u203a' # 0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+ u'\ufb01' # 0xDE -> LATIN SMALL LIGATURE FI
+ u'\ufb02' # 0xDF -> LATIN SMALL LIGATURE FL
+ u'\u2021' # 0xE0 -> DOUBLE DAGGER
+ u'\xb7' # 0xE1 -> MIDDLE DOT
+ u'\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK
+ u'\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK
+ u'\u2030' # 0xE4 -> PER MILLE SIGN
+ u'\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xca' # 0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xcb' # 0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\uf8ff' # 0xF0 -> Apple logo
+ u'\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\u0131' # 0xF5 -> LATIN SMALL LETTER DOTLESS I
+ u'\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT
+ u'\u02dc' # 0xF7 -> SMALL TILDE
+ u'\xaf' # 0xF8 -> MACRON
+ u'\u02d8' # 0xF9 -> BREVE
+ u'\u02d9' # 0xFA -> DOT ABOVE
+ u'\u02da' # 0xFB -> RING ABOVE
+ u'\xb8' # 0xFC -> CEDILLA
+ u'\u02dd' # 0xFD -> DOUBLE ACUTE ACCENT
+ u'\u02db' # 0xFE -> OGONEK
+ u'\u02c7' # 0xFF -> CARON
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..26a5e53da5
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_romanian.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec mac_romanian generated from 'MAPPINGS/VENDORS/APPLE/ROMANIAN.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='mac-romanian',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> CONTROL CHARACTER
+ u'\x01' # 0x01 -> CONTROL CHARACTER
+ u'\x02' # 0x02 -> CONTROL CHARACTER
+ u'\x03' # 0x03 -> CONTROL CHARACTER
+ u'\x04' # 0x04 -> CONTROL CHARACTER
+ u'\x05' # 0x05 -> CONTROL CHARACTER
+ u'\x06' # 0x06 -> CONTROL CHARACTER
+ u'\x07' # 0x07 -> CONTROL CHARACTER
+ u'\x08' # 0x08 -> CONTROL CHARACTER
+ u'\t' # 0x09 -> CONTROL CHARACTER
+ u'\n' # 0x0A -> CONTROL CHARACTER
+ u'\x0b' # 0x0B -> CONTROL CHARACTER
+ u'\x0c' # 0x0C -> CONTROL CHARACTER
+ u'\r' # 0x0D -> CONTROL CHARACTER
+ u'\x0e' # 0x0E -> CONTROL CHARACTER
+ u'\x0f' # 0x0F -> CONTROL CHARACTER
+ u'\x10' # 0x10 -> CONTROL CHARACTER
+ u'\x11' # 0x11 -> CONTROL CHARACTER
+ u'\x12' # 0x12 -> CONTROL CHARACTER
+ u'\x13' # 0x13 -> CONTROL CHARACTER
+ u'\x14' # 0x14 -> CONTROL CHARACTER
+ u'\x15' # 0x15 -> CONTROL CHARACTER
+ u'\x16' # 0x16 -> CONTROL CHARACTER
+ u'\x17' # 0x17 -> CONTROL CHARACTER
+ u'\x18' # 0x18 -> CONTROL CHARACTER
+ u'\x19' # 0x19 -> CONTROL CHARACTER
+ u'\x1a' # 0x1A -> CONTROL CHARACTER
+ u'\x1b' # 0x1B -> CONTROL CHARACTER
+ u'\x1c' # 0x1C -> CONTROL CHARACTER
+ u'\x1d' # 0x1D -> CONTROL CHARACTER
+ u'\x1e' # 0x1E -> CONTROL CHARACTER
+ u'\x1f' # 0x1F -> CONTROL CHARACTER
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> CONTROL CHARACTER
+ u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE
+ u'\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE
+ u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\u2020' # 0xA0 -> DAGGER
+ u'\xb0' # 0xA1 -> DEGREE SIGN
+ u'\xa2' # 0xA2 -> CENT SIGN
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\xa7' # 0xA4 -> SECTION SIGN
+ u'\u2022' # 0xA5 -> BULLET
+ u'\xb6' # 0xA6 -> PILCROW SIGN
+ u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S
+ u'\xae' # 0xA8 -> REGISTERED SIGN
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\u2122' # 0xAA -> TRADE MARK SIGN
+ u'\xb4' # 0xAB -> ACUTE ACCENT
+ u'\xa8' # 0xAC -> DIAERESIS
+ u'\u2260' # 0xAD -> NOT EQUAL TO
+ u'\u0102' # 0xAE -> LATIN CAPITAL LETTER A WITH BREVE
+ u'\u0218' # 0xAF -> LATIN CAPITAL LETTER S WITH COMMA BELOW # for Unicode 3.0 and later
+ u'\u221e' # 0xB0 -> INFINITY
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO
+ u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO
+ u'\xa5' # 0xB4 -> YEN SIGN
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL
+ u'\u2211' # 0xB7 -> N-ARY SUMMATION
+ u'\u220f' # 0xB8 -> N-ARY PRODUCT
+ u'\u03c0' # 0xB9 -> GREEK SMALL LETTER PI
+ u'\u222b' # 0xBA -> INTEGRAL
+ u'\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR
+ u'\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR
+ u'\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA
+ u'\u0103' # 0xBE -> LATIN SMALL LETTER A WITH BREVE
+ u'\u0219' # 0xBF -> LATIN SMALL LETTER S WITH COMMA BELOW # for Unicode 3.0 and later
+ u'\xbf' # 0xC0 -> INVERTED QUESTION MARK
+ u'\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK
+ u'\xac' # 0xC2 -> NOT SIGN
+ u'\u221a' # 0xC3 -> SQUARE ROOT
+ u'\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK
+ u'\u2248' # 0xC5 -> ALMOST EQUAL TO
+ u'\u2206' # 0xC6 -> INCREMENT
+ u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS
+ u'\xa0' # 0xCA -> NO-BREAK SPACE
+ u'\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE
+ u'\u0153' # 0xCF -> LATIN SMALL LIGATURE OE
+ u'\u2013' # 0xD0 -> EN DASH
+ u'\u2014' # 0xD1 -> EM DASH
+ u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK
+ u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK
+ u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK
+ u'\xf7' # 0xD6 -> DIVISION SIGN
+ u'\u25ca' # 0xD7 -> LOZENGE
+ u'\xff' # 0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS
+ u'\u0178' # 0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS
+ u'\u2044' # 0xDA -> FRACTION SLASH
+ u'\u20ac' # 0xDB -> EURO SIGN
+ u'\u2039' # 0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ u'\u203a' # 0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+ u'\u021a' # 0xDE -> LATIN CAPITAL LETTER T WITH COMMA BELOW # for Unicode 3.0 and later
+ u'\u021b' # 0xDF -> LATIN SMALL LETTER T WITH COMMA BELOW # for Unicode 3.0 and later
+ u'\u2021' # 0xE0 -> DOUBLE DAGGER
+ u'\xb7' # 0xE1 -> MIDDLE DOT
+ u'\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK
+ u'\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK
+ u'\u2030' # 0xE4 -> PER MILLE SIGN
+ u'\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xca' # 0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xcb' # 0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\uf8ff' # 0xF0 -> Apple logo
+ u'\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\u0131' # 0xF5 -> LATIN SMALL LETTER DOTLESS I
+ u'\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT
+ u'\u02dc' # 0xF7 -> SMALL TILDE
+ u'\xaf' # 0xF8 -> MACRON
+ u'\u02d8' # 0xF9 -> BREVE
+ u'\u02d9' # 0xFA -> DOT ABOVE
+ u'\u02da' # 0xFB -> RING ABOVE
+ u'\xb8' # 0xFC -> CEDILLA
+ u'\u02dd' # 0xFD -> DOUBLE ACUTE ACCENT
+ u'\u02db' # 0xFE -> OGONEK
+ u'\u02c7' # 0xFF -> CARON
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..fafcc64462
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_turkish.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec mac_turkish generated from 'MAPPINGS/VENDORS/APPLE/TURKISH.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='mac-turkish',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> CONTROL CHARACTER
+ u'\x01' # 0x01 -> CONTROL CHARACTER
+ u'\x02' # 0x02 -> CONTROL CHARACTER
+ u'\x03' # 0x03 -> CONTROL CHARACTER
+ u'\x04' # 0x04 -> CONTROL CHARACTER
+ u'\x05' # 0x05 -> CONTROL CHARACTER
+ u'\x06' # 0x06 -> CONTROL CHARACTER
+ u'\x07' # 0x07 -> CONTROL CHARACTER
+ u'\x08' # 0x08 -> CONTROL CHARACTER
+ u'\t' # 0x09 -> CONTROL CHARACTER
+ u'\n' # 0x0A -> CONTROL CHARACTER
+ u'\x0b' # 0x0B -> CONTROL CHARACTER
+ u'\x0c' # 0x0C -> CONTROL CHARACTER
+ u'\r' # 0x0D -> CONTROL CHARACTER
+ u'\x0e' # 0x0E -> CONTROL CHARACTER
+ u'\x0f' # 0x0F -> CONTROL CHARACTER
+ u'\x10' # 0x10 -> CONTROL CHARACTER
+ u'\x11' # 0x11 -> CONTROL CHARACTER
+ u'\x12' # 0x12 -> CONTROL CHARACTER
+ u'\x13' # 0x13 -> CONTROL CHARACTER
+ u'\x14' # 0x14 -> CONTROL CHARACTER
+ u'\x15' # 0x15 -> CONTROL CHARACTER
+ u'\x16' # 0x16 -> CONTROL CHARACTER
+ u'\x17' # 0x17 -> CONTROL CHARACTER
+ u'\x18' # 0x18 -> CONTROL CHARACTER
+ u'\x19' # 0x19 -> CONTROL CHARACTER
+ u'\x1a' # 0x1A -> CONTROL CHARACTER
+ u'\x1b' # 0x1B -> CONTROL CHARACTER
+ u'\x1c' # 0x1C -> CONTROL CHARACTER
+ u'\x1d' # 0x1D -> CONTROL CHARACTER
+ u'\x1e' # 0x1E -> CONTROL CHARACTER
+ u'\x1f' # 0x1F -> CONTROL CHARACTER
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> CONTROL CHARACTER
+ u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS
+ u'\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE
+ u'\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA
+ u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE
+ u'\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE
+ u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS
+ u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS
+ u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE
+ u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE
+ u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX
+ u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS
+ u'\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE
+ u'\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE
+ u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA
+ u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE
+ u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE
+ u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX
+ u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS
+ u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE
+ u'\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE
+ u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX
+ u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS
+ u'\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE
+ u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE
+ u'\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE
+ u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX
+ u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS
+ u'\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE
+ u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE
+ u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE
+ u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX
+ u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS
+ u'\u2020' # 0xA0 -> DAGGER
+ u'\xb0' # 0xA1 -> DEGREE SIGN
+ u'\xa2' # 0xA2 -> CENT SIGN
+ u'\xa3' # 0xA3 -> POUND SIGN
+ u'\xa7' # 0xA4 -> SECTION SIGN
+ u'\u2022' # 0xA5 -> BULLET
+ u'\xb6' # 0xA6 -> PILCROW SIGN
+ u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S
+ u'\xae' # 0xA8 -> REGISTERED SIGN
+ u'\xa9' # 0xA9 -> COPYRIGHT SIGN
+ u'\u2122' # 0xAA -> TRADE MARK SIGN
+ u'\xb4' # 0xAB -> ACUTE ACCENT
+ u'\xa8' # 0xAC -> DIAERESIS
+ u'\u2260' # 0xAD -> NOT EQUAL TO
+ u'\xc6' # 0xAE -> LATIN CAPITAL LETTER AE
+ u'\xd8' # 0xAF -> LATIN CAPITAL LETTER O WITH STROKE
+ u'\u221e' # 0xB0 -> INFINITY
+ u'\xb1' # 0xB1 -> PLUS-MINUS SIGN
+ u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO
+ u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO
+ u'\xa5' # 0xB4 -> YEN SIGN
+ u'\xb5' # 0xB5 -> MICRO SIGN
+ u'\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL
+ u'\u2211' # 0xB7 -> N-ARY SUMMATION
+ u'\u220f' # 0xB8 -> N-ARY PRODUCT
+ u'\u03c0' # 0xB9 -> GREEK SMALL LETTER PI
+ u'\u222b' # 0xBA -> INTEGRAL
+ u'\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR
+ u'\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR
+ u'\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA
+ u'\xe6' # 0xBE -> LATIN SMALL LETTER AE
+ u'\xf8' # 0xBF -> LATIN SMALL LETTER O WITH STROKE
+ u'\xbf' # 0xC0 -> INVERTED QUESTION MARK
+ u'\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK
+ u'\xac' # 0xC2 -> NOT SIGN
+ u'\u221a' # 0xC3 -> SQUARE ROOT
+ u'\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK
+ u'\u2248' # 0xC5 -> ALMOST EQUAL TO
+ u'\u2206' # 0xC6 -> INCREMENT
+ u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+ u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS
+ u'\xa0' # 0xCA -> NO-BREAK SPACE
+ u'\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE
+ u'\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE
+ u'\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE
+ u'\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE
+ u'\u0153' # 0xCF -> LATIN SMALL LIGATURE OE
+ u'\u2013' # 0xD0 -> EN DASH
+ u'\u2014' # 0xD1 -> EM DASH
+ u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK
+ u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK
+ u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK
+ u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK
+ u'\xf7' # 0xD6 -> DIVISION SIGN
+ u'\u25ca' # 0xD7 -> LOZENGE
+ u'\xff' # 0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS
+ u'\u0178' # 0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS
+ u'\u011e' # 0xDA -> LATIN CAPITAL LETTER G WITH BREVE
+ u'\u011f' # 0xDB -> LATIN SMALL LETTER G WITH BREVE
+ u'\u0130' # 0xDC -> LATIN CAPITAL LETTER I WITH DOT ABOVE
+ u'\u0131' # 0xDD -> LATIN SMALL LETTER DOTLESS I
+ u'\u015e' # 0xDE -> LATIN CAPITAL LETTER S WITH CEDILLA
+ u'\u015f' # 0xDF -> LATIN SMALL LETTER S WITH CEDILLA
+ u'\u2021' # 0xE0 -> DOUBLE DAGGER
+ u'\xb7' # 0xE1 -> MIDDLE DOT
+ u'\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK
+ u'\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK
+ u'\u2030' # 0xE4 -> PER MILLE SIGN
+ u'\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ u'\xca' # 0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ u'\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE
+ u'\xcb' # 0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS
+ u'\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE
+ u'\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE
+ u'\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+ u'\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS
+ u'\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE
+ u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE
+ u'\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ u'\uf8ff' # 0xF0 -> Apple logo
+ u'\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE
+ u'\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE
+ u'\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+ u'\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE
+ u'\uf8a0' # 0xF5 -> undefined1
+ u'\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT
+ u'\u02dc' # 0xF7 -> SMALL TILDE
+ u'\xaf' # 0xF8 -> MACRON
+ u'\u02d8' # 0xF9 -> BREVE
+ u'\u02d9' # 0xFA -> DOT ABOVE
+ u'\u02da' # 0xFB -> RING ABOVE
+ u'\xb8' # 0xFC -> CEDILLA
+ u'\u02dd' # 0xFD -> DOUBLE ACUTE ACCENT
+ u'\u02db' # 0xFE -> OGONEK
+ u'\u02c7' # 0xFF -> CARON
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..d6b17b5e9c
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mbcs.py
@@ -0,0 +1,47 @@
+""" Python 'mbcs' Codec for Windows
+
+
+Cloned by Mark Hammond (mhammond@skippinet.com.au) from ascii.py,
+which was written by Marc-Andre Lemburg (mal@lemburg.com).
+
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
+
+"""
+# Import them explicitly to cause an ImportError
+# on non-Windows systems
+from codecs import mbcs_encode, mbcs_decode
+# for IncrementalDecoder, IncrementalEncoder, ...
+import codecs
+
+### Codec APIs
+
+encode = mbcs_encode
+
+def decode(input, errors='strict'):
+ return mbcs_decode(input, errors, True)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return mbcs_encode(input, self.errors)[0]
+
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
+ _buffer_decode = mbcs_decode
+
+class StreamWriter(codecs.StreamWriter):
+ encode = mbcs_encode
+
+class StreamReader(codecs.StreamReader):
+ decode = mbcs_decode
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='mbcs',
+ encode=encode,
+ decode=decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..4fc4b72a53
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/palmos.py
@@ -0,0 +1,83 @@
+""" Python Character Mapping Codec for PalmOS 3.5.
+
+Written by Sjoerd Mullender (sjoerd@acm.org); based on iso8859_15.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_map)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_map)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='palmos',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+
+# The PalmOS character set is mostly iso-8859-1 with some differences.
+decoding_map.update({
+ 0x0080: 0x20ac, # EURO SIGN
+ 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK
+ 0x0083: 0x0192, # LATIN SMALL LETTER F WITH HOOK
+ 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK
+ 0x0085: 0x2026, # HORIZONTAL ELLIPSIS
+ 0x0086: 0x2020, # DAGGER
+ 0x0087: 0x2021, # DOUBLE DAGGER
+ 0x0088: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT
+ 0x0089: 0x2030, # PER MILLE SIGN
+ 0x008a: 0x0160, # LATIN CAPITAL LETTER S WITH CARON
+ 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+ 0x008c: 0x0152, # LATIN CAPITAL LIGATURE OE
+ 0x008d: 0x2666, # BLACK DIAMOND SUIT
+ 0x008e: 0x2663, # BLACK CLUB SUIT
+ 0x008f: 0x2665, # BLACK HEART SUIT
+ 0x0090: 0x2660, # BLACK SPADE SUIT
+ 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK
+ 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK
+ 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK
+ 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK
+ 0x0095: 0x2022, # BULLET
+ 0x0096: 0x2013, # EN DASH
+ 0x0097: 0x2014, # EM DASH
+ 0x0098: 0x02dc, # SMALL TILDE
+ 0x0099: 0x2122, # TRADE MARK SIGN
+ 0x009a: 0x0161, # LATIN SMALL LETTER S WITH CARON
+ 0x009c: 0x0153, # LATIN SMALL LIGATURE OE
+ 0x009f: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS
+})
+
+### Encoding Map
+
+encoding_map = codecs.make_encoding_map(decoding_map)
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
index 0000000000..f197da59c1
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/ptcp154.py
@@ -0,0 +1,175 @@
+""" Python Character Mapping Codec generated from 'PTCP154.txt' with gencodec.py.
+
+Written by Marc-Andre Lemburg (mal@lemburg.com).
+
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
+(c) Copyright 2000 Guido van Rossum.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_map)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_map)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='ptcp154',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0080: 0x0496, # CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER
+ 0x0081: 0x0492, # CYRILLIC CAPITAL LETTER GHE WITH STROKE
+ 0x0082: 0x04ee, # CYRILLIC CAPITAL LETTER U WITH MACRON
+ 0x0083: 0x0493, # CYRILLIC SMALL LETTER GHE WITH STROKE
+ 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK
+ 0x0085: 0x2026, # HORIZONTAL ELLIPSIS
+ 0x0086: 0x04b6, # CYRILLIC CAPITAL LETTER CHE WITH DESCENDER
+ 0x0087: 0x04ae, # CYRILLIC CAPITAL LETTER STRAIGHT U
+ 0x0088: 0x04b2, # CYRILLIC CAPITAL LETTER HA WITH DESCENDER
+ 0x0089: 0x04af, # CYRILLIC SMALL LETTER STRAIGHT U
+ 0x008a: 0x04a0, # CYRILLIC CAPITAL LETTER BASHKIR KA
+ 0x008b: 0x04e2, # CYRILLIC CAPITAL LETTER I WITH MACRON
+ 0x008c: 0x04a2, # CYRILLIC CAPITAL LETTER EN WITH DESCENDER
+ 0x008d: 0x049a, # CYRILLIC CAPITAL LETTER KA WITH DESCENDER
+ 0x008e: 0x04ba, # CYRILLIC CAPITAL LETTER SHHA
+ 0x008f: 0x04b8, # CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE
+ 0x0090: 0x0497, # CYRILLIC SMALL LETTER ZHE WITH DESCENDER
+ 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK
+ 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK
+ 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK
+ 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK
+ 0x0095: 0x2022, # BULLET
+ 0x0096: 0x2013, # EN DASH
+ 0x0097: 0x2014, # EM DASH
+ 0x0098: 0x04b3, # CYRILLIC SMALL LETTER HA WITH DESCENDER
+ 0x0099: 0x04b7, # CYRILLIC SMALL LETTER CHE WITH DESCENDER
+ 0x009a: 0x04a1, # CYRILLIC SMALL LETTER BASHKIR KA
+ 0x009b: 0x04e3, # CYRILLIC SMALL LETTER I WITH MACRON
+ 0x009c: 0x04a3, # CYRILLIC SMALL LETTER EN WITH DESCENDER
+ 0x009d: 0x049b, # CYRILLIC SMALL LETTER KA WITH DESCENDER
+ 0x009e: 0x04bb, # CYRILLIC SMALL LETTER SHHA
+ 0x009f: 0x04b9, # CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE
+ 0x00a1: 0x040e, # CYRILLIC CAPITAL LETTER SHORT U (Byelorussian)
+ 0x00a2: 0x045e, # CYRILLIC SMALL LETTER SHORT U (Byelorussian)
+ 0x00a3: 0x0408, # CYRILLIC CAPITAL LETTER JE
+ 0x00a4: 0x04e8, # CYRILLIC CAPITAL LETTER BARRED O
+ 0x00a5: 0x0498, # CYRILLIC CAPITAL LETTER ZE WITH DESCENDER
+ 0x00a6: 0x04b0, # CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE
+ 0x00a8: 0x0401, # CYRILLIC CAPITAL LETTER IO
+ 0x00aa: 0x04d8, # CYRILLIC CAPITAL LETTER SCHWA
+ 0x00ad: 0x04ef, # CYRILLIC SMALL LETTER U WITH MACRON
+ 0x00af: 0x049c, # CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE
+ 0x00b1: 0x04b1, # CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE
+ 0x00b2: 0x0406, # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
+ 0x00b3: 0x0456, # CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
+ 0x00b4: 0x0499, # CYRILLIC SMALL LETTER ZE WITH DESCENDER
+ 0x00b5: 0x04e9, # CYRILLIC SMALL LETTER BARRED O
+ 0x00b8: 0x0451, # CYRILLIC SMALL LETTER IO
+ 0x00b9: 0x2116, # NUMERO SIGN
+ 0x00ba: 0x04d9, # CYRILLIC SMALL LETTER SCHWA
+ 0x00bc: 0x0458, # CYRILLIC SMALL LETTER JE
+ 0x00bd: 0x04aa, # CYRILLIC CAPITAL LETTER ES WITH DESCENDER
+ 0x00be: 0x04ab, # CYRILLIC SMALL LETTER ES WITH DESCENDER
+ 0x00bf: 0x049d, # CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE
+ 0x00c0: 0x0410, # CYRILLIC CAPITAL LETTER A
+ 0x00c1: 0x0411, # CYRILLIC CAPITAL LETTER BE
+ 0x00c2: 0x0412, # CYRILLIC CAPITAL LETTER VE
+ 0x00c3: 0x0413, # CYRILLIC CAPITAL LETTER GHE
+ 0x00c4: 0x0414, # CYRILLIC CAPITAL LETTER DE
+ 0x00c5: 0x0415, # CYRILLIC CAPITAL LETTER IE
+ 0x00c6: 0x0416, # CYRILLIC CAPITAL LETTER ZHE
+ 0x00c7: 0x0417, # CYRILLIC CAPITAL LETTER ZE
+ 0x00c8: 0x0418, # CYRILLIC CAPITAL LETTER I
+ 0x00c9: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I
+ 0x00ca: 0x041a, # CYRILLIC CAPITAL LETTER KA
+ 0x00cb: 0x041b, # CYRILLIC CAPITAL LETTER EL
+ 0x00cc: 0x041c, # CYRILLIC CAPITAL LETTER EM
+ 0x00cd: 0x041d, # CYRILLIC CAPITAL LETTER EN
+ 0x00ce: 0x041e, # CYRILLIC CAPITAL LETTER O
+ 0x00cf: 0x041f, # CYRILLIC CAPITAL LETTER PE
+ 0x00d0: 0x0420, # CYRILLIC CAPITAL LETTER ER
+ 0x00d1: 0x0421, # CYRILLIC CAPITAL LETTER ES
+ 0x00d2: 0x0422, # CYRILLIC CAPITAL LETTER TE
+ 0x00d3: 0x0423, # CYRILLIC CAPITAL LETTER U
+ 0x00d4: 0x0424, # CYRILLIC CAPITAL LETTER EF
+ 0x00d5: 0x0425, # CYRILLIC CAPITAL LETTER HA
+ 0x00d6: 0x0426, # CYRILLIC CAPITAL LETTER TSE
+ 0x00d7: 0x0427, # CYRILLIC CAPITAL LETTER CHE
+ 0x00d8: 0x0428, # CYRILLIC CAPITAL LETTER SHA
+ 0x00d9: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA
+ 0x00da: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN
+ 0x00db: 0x042b, # CYRILLIC CAPITAL LETTER YERU
+ 0x00dc: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN
+ 0x00dd: 0x042d, # CYRILLIC CAPITAL LETTER E
+ 0x00de: 0x042e, # CYRILLIC CAPITAL LETTER YU
+ 0x00df: 0x042f, # CYRILLIC CAPITAL LETTER YA
+ 0x00e0: 0x0430, # CYRILLIC SMALL LETTER A
+ 0x00e1: 0x0431, # CYRILLIC SMALL LETTER BE
+ 0x00e2: 0x0432, # CYRILLIC SMALL LETTER VE
+ 0x00e3: 0x0433, # CYRILLIC SMALL LETTER GHE
+ 0x00e4: 0x0434, # CYRILLIC SMALL LETTER DE
+ 0x00e5: 0x0435, # CYRILLIC SMALL LETTER IE
+ 0x00e6: 0x0436, # CYRILLIC SMALL LETTER ZHE
+ 0x00e7: 0x0437, # CYRILLIC SMALL LETTER ZE
+ 0x00e8: 0x0438, # CYRILLIC SMALL LETTER I
+ 0x00e9: 0x0439, # CYRILLIC SMALL LETTER SHORT I
+ 0x00ea: 0x043a, # CYRILLIC SMALL LETTER KA
+ 0x00eb: 0x043b, # CYRILLIC SMALL LETTER EL
+ 0x00ec: 0x043c, # CYRILLIC SMALL LETTER EM
+ 0x00ed: 0x043d, # CYRILLIC SMALL LETTER EN
+ 0x00ee: 0x043e, # CYRILLIC SMALL LETTER O
+ 0x00ef: 0x043f, # CYRILLIC SMALL LETTER PE
+ 0x00f0: 0x0440, # CYRILLIC SMALL LETTER ER
+ 0x00f1: 0x0441, # CYRILLIC SMALL LETTER ES
+ 0x00f2: 0x0442, # CYRILLIC SMALL LETTER TE
+ 0x00f3: 0x0443, # CYRILLIC SMALL LETTER U
+ 0x00f4: 0x0444, # CYRILLIC SMALL LETTER EF
+ 0x00f5: 0x0445, # CYRILLIC SMALL LETTER HA
+ 0x00f6: 0x0446, # CYRILLIC SMALL LETTER TSE
+ 0x00f7: 0x0447, # CYRILLIC SMALL LETTER CHE
+ 0x00f8: 0x0448, # CYRILLIC SMALL LETTER SHA
+ 0x00f9: 0x0449, # CYRILLIC SMALL LETTER SHCHA
+ 0x00fa: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN
+ 0x00fb: 0x044b, # CYRILLIC SMALL LETTER YERU
+ 0x00fc: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN
+ 0x00fd: 0x044d, # CYRILLIC SMALL LETTER E
+ 0x00fe: 0x044e, # CYRILLIC SMALL LETTER YU
+ 0x00ff: 0x044f, # CYRILLIC SMALL LETTER YA
+})
+
+### Encoding Map
+
+encoding_map = codecs.make_encoding_map(decoding_map)
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
index 0000000000..ad3cc554be
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/punycode.py
@@ -0,0 +1,238 @@
+# -*- coding: iso-8859-1 -*-
+""" Codec for the Punicode encoding, as specified in RFC 3492
+
+Written by Martin v. Löwis.
+"""
+
+import codecs
+
+##################### Encoding #####################################
+
+def segregate(str):
+ """3.1 Basic code point segregation"""
+ base = []
+ extended = {}
+ for c in str:
+ if ord(c) < 128:
+ base.append(c)
+ else:
+ extended[c] = 1
+ extended = extended.keys()
+ extended.sort()
+ return "".join(base).encode("ascii"),extended
+
+def selective_len(str, max):
+ """Return the length of str, considering only characters below max."""
+ res = 0
+ for c in str:
+ if ord(c) < max:
+ res += 1
+ return res
+
+def selective_find(str, char, index, pos):
+ """Return a pair (index, pos), indicating the next occurrence of
+ char in str. index is the position of the character considering
+ only ordinals up to and including char, and pos is the position in
+ the full string. index/pos is the starting position in the full
+ string."""
+
+ l = len(str)
+ while 1:
+ pos += 1
+ if pos == l:
+ return (-1, -1)
+ c = str[pos]
+ if c == char:
+ return index+1, pos
+ elif c < char:
+ index += 1
+
+def insertion_unsort(str, extended):
+ """3.2 Insertion unsort coding"""
+ oldchar = 0x80
+ result = []
+ oldindex = -1
+ for c in extended:
+ index = pos = -1
+ char = ord(c)
+ curlen = selective_len(str, char)
+ delta = (curlen+1) * (char - oldchar)
+ while 1:
+ index,pos = selective_find(str,c,index,pos)
+ if index == -1:
+ break
+ delta += index - oldindex
+ result.append(delta-1)
+ oldindex = index
+ delta = 0
+ oldchar = char
+
+ return result
+
+def T(j, bias):
+ # Punycode parameters: tmin = 1, tmax = 26, base = 36
+ res = 36 * (j + 1) - bias
+ if res < 1: return 1
+ if res > 26: return 26
+ return res
+
+digits = "abcdefghijklmnopqrstuvwxyz0123456789"
+def generate_generalized_integer(N, bias):
+ """3.3 Generalized variable-length integers"""
+ result = []
+ j = 0
+ while 1:
+ t = T(j, bias)
+ if N < t:
+ result.append(digits[N])
+ return result
+ result.append(digits[t + ((N - t) % (36 - t))])
+ N = (N - t) // (36 - t)
+ j += 1
+
+def adapt(delta, first, numchars):
+ if first:
+ delta //= 700
+ else:
+ delta //= 2
+ delta += delta // numchars
+ # ((base - tmin) * tmax) // 2 == 455
+ divisions = 0
+ while delta > 455:
+ delta = delta // 35 # base - tmin
+ divisions += 36
+ bias = divisions + (36 * delta // (delta + 38))
+ return bias
+
+
+def generate_integers(baselen, deltas):
+ """3.4 Bias adaptation"""
+ # Punycode parameters: initial bias = 72, damp = 700, skew = 38
+ result = []
+ bias = 72
+ for points, delta in enumerate(deltas):
+ s = generate_generalized_integer(delta, bias)
+ result.extend(s)
+ bias = adapt(delta, points==0, baselen+points+1)
+ return "".join(result)
+
+def punycode_encode(text):
+ base, extended = segregate(text)
+ base = base.encode("ascii")
+ deltas = insertion_unsort(text, extended)
+ extended = generate_integers(len(base), deltas)
+ if base:
+ return base + "-" + extended
+ return extended
+
+##################### Decoding #####################################
+
+def decode_generalized_number(extended, extpos, bias, errors):
+ """3.3 Generalized variable-length integers"""
+ result = 0
+ w = 1
+ j = 0
+ while 1:
+ try:
+ char = ord(extended[extpos])
+ except IndexError:
+ if errors == "strict":
+ raise UnicodeError, "incomplete punicode string"
+ return extpos + 1, None
+ extpos += 1
+ if 0x41 <= char <= 0x5A: # A-Z
+ digit = char - 0x41
+ elif 0x30 <= char <= 0x39:
+ digit = char - 22 # 0x30-26
+ elif errors == "strict":
+ raise UnicodeError("Invalid extended code point '%s'"
+ % extended[extpos])
+ else:
+ return extpos, None
+ t = T(j, bias)
+ result += digit * w
+ if digit < t:
+ return extpos, result
+ w = w * (36 - t)
+ j += 1
+
+
+def insertion_sort(base, extended, errors):
+ """3.2 Insertion unsort coding"""
+ char = 0x80
+ pos = -1
+ bias = 72
+ extpos = 0
+ while extpos < len(extended):
+ newpos, delta = decode_generalized_number(extended, extpos,
+ bias, errors)
+ if delta is None:
+ # There was an error in decoding. We can't continue because
+ # synchronization is lost.
+ return base
+ pos += delta+1
+ char += pos // (len(base) + 1)
+ if char > 0x10FFFF:
+ if errors == "strict":
+ raise UnicodeError, ("Invalid character U+%x" % char)
+ char = ord('?')
+ pos = pos % (len(base) + 1)
+ base = base[:pos] + unichr(char) + base[pos:]
+ bias = adapt(delta, (extpos == 0), len(base))
+ extpos = newpos
+ return base
+
+def punycode_decode(text, errors):
+ pos = text.rfind("-")
+ if pos == -1:
+ base = ""
+ extended = text
+ else:
+ base = text[:pos]
+ extended = text[pos+1:]
+ base = unicode(base, "ascii", errors)
+ extended = extended.upper()
+ return insertion_sort(base, extended, errors)
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ res = punycode_encode(input)
+ return res, len(input)
+
+ def decode(self,input,errors='strict'):
+ if errors not in ('strict', 'replace', 'ignore'):
+ raise UnicodeError, "Unsupported error handling "+errors
+ res = punycode_decode(input, errors)
+ return res, len(input)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return punycode_encode(input)
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ if self.errors not in ('strict', 'replace', 'ignore'):
+ raise UnicodeError, "Unsupported error handling "+self.errors
+ return punycode_decode(input, self.errors)
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='punycode',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamwriter=StreamWriter,
+ streamreader=StreamReader,
+ )
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
index 0000000000..663d6a682d
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/quopri_codec.py
@@ -0,0 +1,75 @@
+"""Codec for quoted-printable encoding.
+
+Like base64 and rot13, this returns Python strings, not Unicode.
+"""
+
+import codecs, quopri
+try:
+ from cStringIO import StringIO
+except ImportError:
+ from StringIO import StringIO
+
+def quopri_encode(input, errors='strict'):
+ """Encode the input, returning a tuple (output object, length consumed).
+
+ errors defines the error handling to apply. It defaults to
+ 'strict' handling which is the only currently supported
+ error handling for this codec.
+
+ """
+ assert errors == 'strict'
+ # using str() because of cStringIO's Unicode undesired Unicode behavior.
+ f = StringIO(str(input))
+ g = StringIO()
+ quopri.encode(f, g, 1)
+ output = g.getvalue()
+ return (output, len(input))
+
+def quopri_decode(input, errors='strict'):
+ """Decode the input, returning a tuple (output object, length consumed).
+
+ errors defines the error handling to apply. It defaults to
+ 'strict' handling which is the only currently supported
+ error handling for this codec.
+
+ """
+ assert errors == 'strict'
+ f = StringIO(str(input))
+ g = StringIO()
+ quopri.decode(f, g)
+ output = g.getvalue()
+ return (output, len(input))
+
+class Codec(codecs.Codec):
+
+ def encode(self, input,errors='strict'):
+ return quopri_encode(input,errors)
+ def decode(self, input,errors='strict'):
+ return quopri_decode(input,errors)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return quopri_encode(input, self.errors)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return quopri_decode(input, self.errors)[0]
+
+class StreamWriter(Codec, codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+# encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='quopri',
+ encode=quopri_encode,
+ decode=quopri_decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamwriter=StreamWriter,
+ streamreader=StreamReader,
+ )
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
index 0000000000..cb0abfbb58
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/raw_unicode_escape.py
@@ -0,0 +1,45 @@
+""" Python 'raw-unicode-escape' Codec
+
+
+Written by Marc-Andre Lemburg (mal@lemburg.com).
+
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
+
+"""
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ # Note: Binding these as C functions will result in the class not
+ # converting them to methods. This is intended.
+ encode = codecs.raw_unicode_escape_encode
+ decode = codecs.raw_unicode_escape_decode
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.raw_unicode_escape_encode(input, self.errors)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.raw_unicode_escape_decode(input, self.errors)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='raw-unicode-escape',
+ encode=Codec.encode,
+ decode=Codec.decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamwriter=StreamWriter,
+ streamreader=StreamReader,
+ )
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
index 0000000000..cb25ecb662
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/rot_13.py
@@ -0,0 +1,118 @@
+#!/usr/bin/env python
+""" Python Character Mapping Codec for ROT13.
+
+ See http://ucsub.colorado.edu/~kominek/rot13/ for details.
+
+ Written by Marc-Andre Lemburg (mal@lemburg.com).
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_map)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_map)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_map)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_map)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='rot-13',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamwriter=StreamWriter,
+ streamreader=StreamReader,
+ )
+
+### Decoding Map
+
+decoding_map = codecs.make_identity_dict(range(256))
+decoding_map.update({
+ 0x0041: 0x004e,
+ 0x0042: 0x004f,
+ 0x0043: 0x0050,
+ 0x0044: 0x0051,
+ 0x0045: 0x0052,
+ 0x0046: 0x0053,
+ 0x0047: 0x0054,
+ 0x0048: 0x0055,
+ 0x0049: 0x0056,
+ 0x004a: 0x0057,
+ 0x004b: 0x0058,
+ 0x004c: 0x0059,
+ 0x004d: 0x005a,
+ 0x004e: 0x0041,
+ 0x004f: 0x0042,
+ 0x0050: 0x0043,
+ 0x0051: 0x0044,
+ 0x0052: 0x0045,
+ 0x0053: 0x0046,
+ 0x0054: 0x0047,
+ 0x0055: 0x0048,
+ 0x0056: 0x0049,
+ 0x0057: 0x004a,
+ 0x0058: 0x004b,
+ 0x0059: 0x004c,
+ 0x005a: 0x004d,
+ 0x0061: 0x006e,
+ 0x0062: 0x006f,
+ 0x0063: 0x0070,
+ 0x0064: 0x0071,
+ 0x0065: 0x0072,
+ 0x0066: 0x0073,
+ 0x0067: 0x0074,
+ 0x0068: 0x0075,
+ 0x0069: 0x0076,
+ 0x006a: 0x0077,
+ 0x006b: 0x0078,
+ 0x006c: 0x0079,
+ 0x006d: 0x007a,
+ 0x006e: 0x0061,
+ 0x006f: 0x0062,
+ 0x0070: 0x0063,
+ 0x0071: 0x0064,
+ 0x0072: 0x0065,
+ 0x0073: 0x0066,
+ 0x0074: 0x0067,
+ 0x0075: 0x0068,
+ 0x0076: 0x0069,
+ 0x0077: 0x006a,
+ 0x0078: 0x006b,
+ 0x0079: 0x006c,
+ 0x007a: 0x006d,
+})
+
+### Encoding Map
+
+encoding_map = codecs.make_encoding_map(decoding_map)
+
+### Filter API
+
+def rot13(infile, outfile):
+ outfile.write(infile.read().encode('rot-13'))
+
+if __name__ == '__main__':
+ import sys
+ rot13(sys.stdin, sys.stdout)
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
index 0000000000..3db9364139
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jis.py
@@ -0,0 +1,39 @@
+#
+# shift_jis.py: Python Unicode Codec for SHIFT_JIS
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_jp, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_jp.getcodec('shift_jis')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='shift_jis',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..3e48bb7f94
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jis_2004.py
@@ -0,0 +1,39 @@
+#
+# shift_jis_2004.py: Python Unicode Codec for SHIFT_JIS_2004
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_jp, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_jp.getcodec('shift_jis_2004')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='shift_jis_2004',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..4092e41dcf
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jisx0213.py
@@ -0,0 +1,39 @@
+#
+# shift_jisx0213.py: Python Unicode Codec for SHIFT_JISX0213
+#
+# Written by Hye-Shik Chang <perky@FreeBSD.org>
+#
+
+import _codecs_jp, codecs
+import _multibytecodec as mbc
+
+codec = _codecs_jp.getcodec('shift_jisx0213')
+
+class Codec(codecs.Codec):
+ encode = codec.encode
+ decode = codec.decode
+
+class IncrementalEncoder(mbc.MultibyteIncrementalEncoder,
+ codecs.IncrementalEncoder):
+ codec = codec
+
+class IncrementalDecoder(mbc.MultibyteIncrementalDecoder,
+ codecs.IncrementalDecoder):
+ codec = codec
+
+class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader):
+ codec = codec
+
+class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter):
+ codec = codec
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='shift_jisx0213',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..cb11794222
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/string_escape.py
@@ -0,0 +1,38 @@
+# -*- coding: iso-8859-1 -*-
+""" Python 'escape' Codec
+
+
+Written by Martin v. Löwis (martin@v.loewis.de).
+
+"""
+import codecs
+
+class Codec(codecs.Codec):
+
+ encode = codecs.escape_encode
+ decode = codecs.escape_decode
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.escape_encode(input, self.errors)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.escape_decode(input, self.errors)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='string-escape',
+ encode=Codec.encode,
+ decode=Codec.decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamwriter=StreamWriter,
+ streamreader=StreamReader,
+ )
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
index 0000000000..776525e5b2
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/tis_620.py
@@ -0,0 +1,307 @@
+""" Python Character Mapping Codec tis_620 generated from 'python-mappings/TIS-620.TXT' with gencodec.py.
+
+"""#"
+
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return codecs.charmap_encode(input,errors,encoding_table)
+
+ def decode(self,input,errors='strict'):
+ return codecs.charmap_decode(input,errors,decoding_table)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.charmap_decode(input,self.errors,decoding_table)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='tis-620',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
+
+
+### Decoding Table
+
+decoding_table = (
+ u'\x00' # 0x00 -> NULL
+ u'\x01' # 0x01 -> START OF HEADING
+ u'\x02' # 0x02 -> START OF TEXT
+ u'\x03' # 0x03 -> END OF TEXT
+ u'\x04' # 0x04 -> END OF TRANSMISSION
+ u'\x05' # 0x05 -> ENQUIRY
+ u'\x06' # 0x06 -> ACKNOWLEDGE
+ u'\x07' # 0x07 -> BELL
+ u'\x08' # 0x08 -> BACKSPACE
+ u'\t' # 0x09 -> HORIZONTAL TABULATION
+ u'\n' # 0x0A -> LINE FEED
+ u'\x0b' # 0x0B -> VERTICAL TABULATION
+ u'\x0c' # 0x0C -> FORM FEED
+ u'\r' # 0x0D -> CARRIAGE RETURN
+ u'\x0e' # 0x0E -> SHIFT OUT
+ u'\x0f' # 0x0F -> SHIFT IN
+ u'\x10' # 0x10 -> DATA LINK ESCAPE
+ u'\x11' # 0x11 -> DEVICE CONTROL ONE
+ u'\x12' # 0x12 -> DEVICE CONTROL TWO
+ u'\x13' # 0x13 -> DEVICE CONTROL THREE
+ u'\x14' # 0x14 -> DEVICE CONTROL FOUR
+ u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE
+ u'\x16' # 0x16 -> SYNCHRONOUS IDLE
+ u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK
+ u'\x18' # 0x18 -> CANCEL
+ u'\x19' # 0x19 -> END OF MEDIUM
+ u'\x1a' # 0x1A -> SUBSTITUTE
+ u'\x1b' # 0x1B -> ESCAPE
+ u'\x1c' # 0x1C -> FILE SEPARATOR
+ u'\x1d' # 0x1D -> GROUP SEPARATOR
+ u'\x1e' # 0x1E -> RECORD SEPARATOR
+ u'\x1f' # 0x1F -> UNIT SEPARATOR
+ u' ' # 0x20 -> SPACE
+ u'!' # 0x21 -> EXCLAMATION MARK
+ u'"' # 0x22 -> QUOTATION MARK
+ u'#' # 0x23 -> NUMBER SIGN
+ u'$' # 0x24 -> DOLLAR SIGN
+ u'%' # 0x25 -> PERCENT SIGN
+ u'&' # 0x26 -> AMPERSAND
+ u"'" # 0x27 -> APOSTROPHE
+ u'(' # 0x28 -> LEFT PARENTHESIS
+ u')' # 0x29 -> RIGHT PARENTHESIS
+ u'*' # 0x2A -> ASTERISK
+ u'+' # 0x2B -> PLUS SIGN
+ u',' # 0x2C -> COMMA
+ u'-' # 0x2D -> HYPHEN-MINUS
+ u'.' # 0x2E -> FULL STOP
+ u'/' # 0x2F -> SOLIDUS
+ u'0' # 0x30 -> DIGIT ZERO
+ u'1' # 0x31 -> DIGIT ONE
+ u'2' # 0x32 -> DIGIT TWO
+ u'3' # 0x33 -> DIGIT THREE
+ u'4' # 0x34 -> DIGIT FOUR
+ u'5' # 0x35 -> DIGIT FIVE
+ u'6' # 0x36 -> DIGIT SIX
+ u'7' # 0x37 -> DIGIT SEVEN
+ u'8' # 0x38 -> DIGIT EIGHT
+ u'9' # 0x39 -> DIGIT NINE
+ u':' # 0x3A -> COLON
+ u';' # 0x3B -> SEMICOLON
+ u'<' # 0x3C -> LESS-THAN SIGN
+ u'=' # 0x3D -> EQUALS SIGN
+ u'>' # 0x3E -> GREATER-THAN SIGN
+ u'?' # 0x3F -> QUESTION MARK
+ u'@' # 0x40 -> COMMERCIAL AT
+ u'A' # 0x41 -> LATIN CAPITAL LETTER A
+ u'B' # 0x42 -> LATIN CAPITAL LETTER B
+ u'C' # 0x43 -> LATIN CAPITAL LETTER C
+ u'D' # 0x44 -> LATIN CAPITAL LETTER D
+ u'E' # 0x45 -> LATIN CAPITAL LETTER E
+ u'F' # 0x46 -> LATIN CAPITAL LETTER F
+ u'G' # 0x47 -> LATIN CAPITAL LETTER G
+ u'H' # 0x48 -> LATIN CAPITAL LETTER H
+ u'I' # 0x49 -> LATIN CAPITAL LETTER I
+ u'J' # 0x4A -> LATIN CAPITAL LETTER J
+ u'K' # 0x4B -> LATIN CAPITAL LETTER K
+ u'L' # 0x4C -> LATIN CAPITAL LETTER L
+ u'M' # 0x4D -> LATIN CAPITAL LETTER M
+ u'N' # 0x4E -> LATIN CAPITAL LETTER N
+ u'O' # 0x4F -> LATIN CAPITAL LETTER O
+ u'P' # 0x50 -> LATIN CAPITAL LETTER P
+ u'Q' # 0x51 -> LATIN CAPITAL LETTER Q
+ u'R' # 0x52 -> LATIN CAPITAL LETTER R
+ u'S' # 0x53 -> LATIN CAPITAL LETTER S
+ u'T' # 0x54 -> LATIN CAPITAL LETTER T
+ u'U' # 0x55 -> LATIN CAPITAL LETTER U
+ u'V' # 0x56 -> LATIN CAPITAL LETTER V
+ u'W' # 0x57 -> LATIN CAPITAL LETTER W
+ u'X' # 0x58 -> LATIN CAPITAL LETTER X
+ u'Y' # 0x59 -> LATIN CAPITAL LETTER Y
+ u'Z' # 0x5A -> LATIN CAPITAL LETTER Z
+ u'[' # 0x5B -> LEFT SQUARE BRACKET
+ u'\\' # 0x5C -> REVERSE SOLIDUS
+ u']' # 0x5D -> RIGHT SQUARE BRACKET
+ u'^' # 0x5E -> CIRCUMFLEX ACCENT
+ u'_' # 0x5F -> LOW LINE
+ u'`' # 0x60 -> GRAVE ACCENT
+ u'a' # 0x61 -> LATIN SMALL LETTER A
+ u'b' # 0x62 -> LATIN SMALL LETTER B
+ u'c' # 0x63 -> LATIN SMALL LETTER C
+ u'd' # 0x64 -> LATIN SMALL LETTER D
+ u'e' # 0x65 -> LATIN SMALL LETTER E
+ u'f' # 0x66 -> LATIN SMALL LETTER F
+ u'g' # 0x67 -> LATIN SMALL LETTER G
+ u'h' # 0x68 -> LATIN SMALL LETTER H
+ u'i' # 0x69 -> LATIN SMALL LETTER I
+ u'j' # 0x6A -> LATIN SMALL LETTER J
+ u'k' # 0x6B -> LATIN SMALL LETTER K
+ u'l' # 0x6C -> LATIN SMALL LETTER L
+ u'm' # 0x6D -> LATIN SMALL LETTER M
+ u'n' # 0x6E -> LATIN SMALL LETTER N
+ u'o' # 0x6F -> LATIN SMALL LETTER O
+ u'p' # 0x70 -> LATIN SMALL LETTER P
+ u'q' # 0x71 -> LATIN SMALL LETTER Q
+ u'r' # 0x72 -> LATIN SMALL LETTER R
+ u's' # 0x73 -> LATIN SMALL LETTER S
+ u't' # 0x74 -> LATIN SMALL LETTER T
+ u'u' # 0x75 -> LATIN SMALL LETTER U
+ u'v' # 0x76 -> LATIN SMALL LETTER V
+ u'w' # 0x77 -> LATIN SMALL LETTER W
+ u'x' # 0x78 -> LATIN SMALL LETTER X
+ u'y' # 0x79 -> LATIN SMALL LETTER Y
+ u'z' # 0x7A -> LATIN SMALL LETTER Z
+ u'{' # 0x7B -> LEFT CURLY BRACKET
+ u'|' # 0x7C -> VERTICAL LINE
+ u'}' # 0x7D -> RIGHT CURLY BRACKET
+ u'~' # 0x7E -> TILDE
+ u'\x7f' # 0x7F -> DELETE
+ u'\x80' # 0x80 -> <control>
+ u'\x81' # 0x81 -> <control>
+ u'\x82' # 0x82 -> <control>
+ u'\x83' # 0x83 -> <control>
+ u'\x84' # 0x84 -> <control>
+ u'\x85' # 0x85 -> <control>
+ u'\x86' # 0x86 -> <control>
+ u'\x87' # 0x87 -> <control>
+ u'\x88' # 0x88 -> <control>
+ u'\x89' # 0x89 -> <control>
+ u'\x8a' # 0x8A -> <control>
+ u'\x8b' # 0x8B -> <control>
+ u'\x8c' # 0x8C -> <control>
+ u'\x8d' # 0x8D -> <control>
+ u'\x8e' # 0x8E -> <control>
+ u'\x8f' # 0x8F -> <control>
+ u'\x90' # 0x90 -> <control>
+ u'\x91' # 0x91 -> <control>
+ u'\x92' # 0x92 -> <control>
+ u'\x93' # 0x93 -> <control>
+ u'\x94' # 0x94 -> <control>
+ u'\x95' # 0x95 -> <control>
+ u'\x96' # 0x96 -> <control>
+ u'\x97' # 0x97 -> <control>
+ u'\x98' # 0x98 -> <control>
+ u'\x99' # 0x99 -> <control>
+ u'\x9a' # 0x9A -> <control>
+ u'\x9b' # 0x9B -> <control>
+ u'\x9c' # 0x9C -> <control>
+ u'\x9d' # 0x9D -> <control>
+ u'\x9e' # 0x9E -> <control>
+ u'\x9f' # 0x9F -> <control>
+ u'\ufffe'
+ u'\u0e01' # 0xA1 -> THAI CHARACTER KO KAI
+ u'\u0e02' # 0xA2 -> THAI CHARACTER KHO KHAI
+ u'\u0e03' # 0xA3 -> THAI CHARACTER KHO KHUAT
+ u'\u0e04' # 0xA4 -> THAI CHARACTER KHO KHWAI
+ u'\u0e05' # 0xA5 -> THAI CHARACTER KHO KHON
+ u'\u0e06' # 0xA6 -> THAI CHARACTER KHO RAKHANG
+ u'\u0e07' # 0xA7 -> THAI CHARACTER NGO NGU
+ u'\u0e08' # 0xA8 -> THAI CHARACTER CHO CHAN
+ u'\u0e09' # 0xA9 -> THAI CHARACTER CHO CHING
+ u'\u0e0a' # 0xAA -> THAI CHARACTER CHO CHANG
+ u'\u0e0b' # 0xAB -> THAI CHARACTER SO SO
+ u'\u0e0c' # 0xAC -> THAI CHARACTER CHO CHOE
+ u'\u0e0d' # 0xAD -> THAI CHARACTER YO YING
+ u'\u0e0e' # 0xAE -> THAI CHARACTER DO CHADA
+ u'\u0e0f' # 0xAF -> THAI CHARACTER TO PATAK
+ u'\u0e10' # 0xB0 -> THAI CHARACTER THO THAN
+ u'\u0e11' # 0xB1 -> THAI CHARACTER THO NANGMONTHO
+ u'\u0e12' # 0xB2 -> THAI CHARACTER THO PHUTHAO
+ u'\u0e13' # 0xB3 -> THAI CHARACTER NO NEN
+ u'\u0e14' # 0xB4 -> THAI CHARACTER DO DEK
+ u'\u0e15' # 0xB5 -> THAI CHARACTER TO TAO
+ u'\u0e16' # 0xB6 -> THAI CHARACTER THO THUNG
+ u'\u0e17' # 0xB7 -> THAI CHARACTER THO THAHAN
+ u'\u0e18' # 0xB8 -> THAI CHARACTER THO THONG
+ u'\u0e19' # 0xB9 -> THAI CHARACTER NO NU
+ u'\u0e1a' # 0xBA -> THAI CHARACTER BO BAIMAI
+ u'\u0e1b' # 0xBB -> THAI CHARACTER PO PLA
+ u'\u0e1c' # 0xBC -> THAI CHARACTER PHO PHUNG
+ u'\u0e1d' # 0xBD -> THAI CHARACTER FO FA
+ u'\u0e1e' # 0xBE -> THAI CHARACTER PHO PHAN
+ u'\u0e1f' # 0xBF -> THAI CHARACTER FO FAN
+ u'\u0e20' # 0xC0 -> THAI CHARACTER PHO SAMPHAO
+ u'\u0e21' # 0xC1 -> THAI CHARACTER MO MA
+ u'\u0e22' # 0xC2 -> THAI CHARACTER YO YAK
+ u'\u0e23' # 0xC3 -> THAI CHARACTER RO RUA
+ u'\u0e24' # 0xC4 -> THAI CHARACTER RU
+ u'\u0e25' # 0xC5 -> THAI CHARACTER LO LING
+ u'\u0e26' # 0xC6 -> THAI CHARACTER LU
+ u'\u0e27' # 0xC7 -> THAI CHARACTER WO WAEN
+ u'\u0e28' # 0xC8 -> THAI CHARACTER SO SALA
+ u'\u0e29' # 0xC9 -> THAI CHARACTER SO RUSI
+ u'\u0e2a' # 0xCA -> THAI CHARACTER SO SUA
+ u'\u0e2b' # 0xCB -> THAI CHARACTER HO HIP
+ u'\u0e2c' # 0xCC -> THAI CHARACTER LO CHULA
+ u'\u0e2d' # 0xCD -> THAI CHARACTER O ANG
+ u'\u0e2e' # 0xCE -> THAI CHARACTER HO NOKHUK
+ u'\u0e2f' # 0xCF -> THAI CHARACTER PAIYANNOI
+ u'\u0e30' # 0xD0 -> THAI CHARACTER SARA A
+ u'\u0e31' # 0xD1 -> THAI CHARACTER MAI HAN-AKAT
+ u'\u0e32' # 0xD2 -> THAI CHARACTER SARA AA
+ u'\u0e33' # 0xD3 -> THAI CHARACTER SARA AM
+ u'\u0e34' # 0xD4 -> THAI CHARACTER SARA I
+ u'\u0e35' # 0xD5 -> THAI CHARACTER SARA II
+ u'\u0e36' # 0xD6 -> THAI CHARACTER SARA UE
+ u'\u0e37' # 0xD7 -> THAI CHARACTER SARA UEE
+ u'\u0e38' # 0xD8 -> THAI CHARACTER SARA U
+ u'\u0e39' # 0xD9 -> THAI CHARACTER SARA UU
+ u'\u0e3a' # 0xDA -> THAI CHARACTER PHINTHU
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\u0e3f' # 0xDF -> THAI CURRENCY SYMBOL BAHT
+ u'\u0e40' # 0xE0 -> THAI CHARACTER SARA E
+ u'\u0e41' # 0xE1 -> THAI CHARACTER SARA AE
+ u'\u0e42' # 0xE2 -> THAI CHARACTER SARA O
+ u'\u0e43' # 0xE3 -> THAI CHARACTER SARA AI MAIMUAN
+ u'\u0e44' # 0xE4 -> THAI CHARACTER SARA AI MAIMALAI
+ u'\u0e45' # 0xE5 -> THAI CHARACTER LAKKHANGYAO
+ u'\u0e46' # 0xE6 -> THAI CHARACTER MAIYAMOK
+ u'\u0e47' # 0xE7 -> THAI CHARACTER MAITAIKHU
+ u'\u0e48' # 0xE8 -> THAI CHARACTER MAI EK
+ u'\u0e49' # 0xE9 -> THAI CHARACTER MAI THO
+ u'\u0e4a' # 0xEA -> THAI CHARACTER MAI TRI
+ u'\u0e4b' # 0xEB -> THAI CHARACTER MAI CHATTAWA
+ u'\u0e4c' # 0xEC -> THAI CHARACTER THANTHAKHAT
+ u'\u0e4d' # 0xED -> THAI CHARACTER NIKHAHIT
+ u'\u0e4e' # 0xEE -> THAI CHARACTER YAMAKKAN
+ u'\u0e4f' # 0xEF -> THAI CHARACTER FONGMAN
+ u'\u0e50' # 0xF0 -> THAI DIGIT ZERO
+ u'\u0e51' # 0xF1 -> THAI DIGIT ONE
+ u'\u0e52' # 0xF2 -> THAI DIGIT TWO
+ u'\u0e53' # 0xF3 -> THAI DIGIT THREE
+ u'\u0e54' # 0xF4 -> THAI DIGIT FOUR
+ u'\u0e55' # 0xF5 -> THAI DIGIT FIVE
+ u'\u0e56' # 0xF6 -> THAI DIGIT SIX
+ u'\u0e57' # 0xF7 -> THAI DIGIT SEVEN
+ u'\u0e58' # 0xF8 -> THAI DIGIT EIGHT
+ u'\u0e59' # 0xF9 -> THAI DIGIT NINE
+ u'\u0e5a' # 0xFA -> THAI CHARACTER ANGKHANKHU
+ u'\u0e5b' # 0xFB -> THAI CHARACTER KHOMUT
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+ u'\ufffe'
+)
+
+### Encoding table
+encoding_table=codecs.charmap_build(decoding_table)
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
index 0000000000..a077fd6584
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/undefined.py
@@ -0,0 +1,49 @@
+""" Python 'undefined' Codec
+
+ This codec will always raise a ValueError exception when being
+ used. It is intended for use by the site.py file to switch off
+ automatic string to Unicode coercion.
+
+Written by Marc-Andre Lemburg (mal@lemburg.com).
+
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
+
+"""
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ raise UnicodeError("undefined encoding")
+
+ def decode(self,input,errors='strict'):
+ raise UnicodeError("undefined encoding")
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ raise UnicodeError("undefined encoding")
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ raise UnicodeError("undefined encoding")
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='undefined',
+ encode=Codec().encode,
+ decode=Codec().decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamwriter=StreamWriter,
+ streamreader=StreamReader,
+ )
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
index 0000000000..3b77cda476
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/unicode_escape.py
@@ -0,0 +1,45 @@
+""" Python 'unicode-escape' Codec
+
+
+Written by Marc-Andre Lemburg (mal@lemburg.com).
+
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
+
+"""
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ # Note: Binding these as C functions will result in the class not
+ # converting them to methods. This is intended.
+ encode = codecs.unicode_escape_encode
+ decode = codecs.unicode_escape_decode
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.unicode_escape_encode(input, self.errors)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.unicode_escape_decode(input, self.errors)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='unicode-escape',
+ encode=Codec.encode,
+ decode=Codec.decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamwriter=StreamWriter,
+ streamreader=StreamReader,
+ )
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
index 0000000000..0803e7b5a3
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/unicode_internal.py
@@ -0,0 +1,45 @@
+""" Python 'unicode-internal' Codec
+
+
+Written by Marc-Andre Lemburg (mal@lemburg.com).
+
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
+
+"""
+import codecs
+
+### Codec APIs
+
+class Codec(codecs.Codec):
+
+ # Note: Binding these as C functions will result in the class not
+ # converting them to methods. This is intended.
+ encode = codecs.unicode_internal_encode
+ decode = codecs.unicode_internal_decode
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.unicode_internal_encode(input, self.errors)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return codecs.unicode_internal_decode(input, self.errors)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='unicode-internal',
+ encode=Codec.encode,
+ decode=Codec.decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamwriter=StreamWriter,
+ streamreader=StreamReader,
+ )
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
index 0000000000..566bcc7cbb
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16.py
@@ -0,0 +1,126 @@
+""" Python 'utf-16' Codec
+
+
+Written by Marc-Andre Lemburg (mal@lemburg.com).
+
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
+
+"""
+import codecs, sys
+
+### Codec APIs
+
+encode = codecs.utf_16_encode
+
+def decode(input, errors='strict'):
+ return codecs.utf_16_decode(input, errors, True)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def __init__(self, errors='strict'):
+ codecs.IncrementalEncoder.__init__(self, errors)
+ self.encoder = None
+
+ def encode(self, input, final=False):
+ if self.encoder is None:
+ result = codecs.utf_16_encode(input, self.errors)[0]
+ if sys.byteorder == 'little':
+ self.encoder = codecs.utf_16_le_encode
+ else:
+ self.encoder = codecs.utf_16_be_encode
+ return result
+ return self.encoder(input, self.errors)[0]
+
+ def reset(self):
+ codecs.IncrementalEncoder.reset(self)
+ self.encoder = None
+
+ def getstate(self):
+ # state info we return to the caller:
+ # 0: stream is in natural order for this platform
+ # 2: endianness hasn't been determined yet
+ # (we're never writing in unnatural order)
+ return (2 if self.encoder is None else 0)
+
+ def setstate(self, state):
+ if state:
+ self.encoder = None
+ else:
+ if sys.byteorder == 'little':
+ self.encoder = codecs.utf_16_le_encode
+ else:
+ self.encoder = codecs.utf_16_be_encode
+
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
+ def __init__(self, errors='strict'):
+ codecs.BufferedIncrementalDecoder.__init__(self, errors)
+ self.decoder = None
+
+ def _buffer_decode(self, input, errors, final):
+ if self.decoder is None:
+ (output, consumed, byteorder) = \
+ codecs.utf_16_ex_decode(input, errors, 0, final)
+ if byteorder == -1:
+ self.decoder = codecs.utf_16_le_decode
+ elif byteorder == 1:
+ self.decoder = codecs.utf_16_be_decode
+ elif consumed >= 2:
+ raise UnicodeError("UTF-16 stream does not start with BOM")
+ return (output, consumed)
+ return self.decoder(input, self.errors, final)
+
+ def reset(self):
+ codecs.BufferedIncrementalDecoder.reset(self)
+ self.decoder = None
+
+class StreamWriter(codecs.StreamWriter):
+ def __init__(self, stream, errors='strict'):
+ codecs.StreamWriter.__init__(self, stream, errors)
+ self.encoder = None
+
+ def reset(self):
+ codecs.StreamWriter.reset(self)
+ self.encoder = None
+
+ def encode(self, input, errors='strict'):
+ if self.encoder is None:
+ result = codecs.utf_16_encode(input, errors)
+ if sys.byteorder == 'little':
+ self.encoder = codecs.utf_16_le_encode
+ else:
+ self.encoder = codecs.utf_16_be_encode
+ return result
+ else:
+ return self.encoder(input, errors)
+
+class StreamReader(codecs.StreamReader):
+
+ def reset(self):
+ codecs.StreamReader.reset(self)
+ try:
+ del self.decode
+ except AttributeError:
+ pass
+
+ def decode(self, input, errors='strict'):
+ (object, consumed, byteorder) = \
+ codecs.utf_16_ex_decode(input, errors, 0, False)
+ if byteorder == -1:
+ self.decode = codecs.utf_16_le_decode
+ elif byteorder == 1:
+ self.decode = codecs.utf_16_be_decode
+ elif consumed>=2:
+ raise UnicodeError,"UTF-16 stream does not start with BOM"
+ return (object, consumed)
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='utf-16',
+ encode=encode,
+ decode=decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..780c499bc2
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16_be.py
@@ -0,0 +1,42 @@
+""" Python 'utf-16-be' Codec
+
+
+Written by Marc-Andre Lemburg (mal@lemburg.com).
+
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
+
+"""
+import codecs
+
+### Codec APIs
+
+encode = codecs.utf_16_be_encode
+
+def decode(input, errors='strict'):
+ return codecs.utf_16_be_decode(input, errors, True)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.utf_16_be_encode(input, self.errors)[0]
+
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
+ _buffer_decode = codecs.utf_16_be_decode
+
+class StreamWriter(codecs.StreamWriter):
+ encode = codecs.utf_16_be_encode
+
+class StreamReader(codecs.StreamReader):
+ decode = codecs.utf_16_be_decode
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='utf-16-be',
+ encode=encode,
+ decode=decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..3964124895
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16_le.py
@@ -0,0 +1,42 @@
+""" Python 'utf-16-le' Codec
+
+
+Written by Marc-Andre Lemburg (mal@lemburg.com).
+
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
+
+"""
+import codecs
+
+### Codec APIs
+
+encode = codecs.utf_16_le_encode
+
+def decode(input, errors='strict'):
+ return codecs.utf_16_le_decode(input, errors, True)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.utf_16_le_encode(input, self.errors)[0]
+
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
+ _buffer_decode = codecs.utf_16_le_decode
+
+class StreamWriter(codecs.StreamWriter):
+ encode = codecs.utf_16_le_encode
+
+class StreamReader(codecs.StreamReader):
+ decode = codecs.utf_16_le_decode
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='utf-16-le',
+ encode=encode,
+ decode=decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..9d836ea1c6
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32.py
@@ -0,0 +1,150 @@
+"""
+Python 'utf-32' Codec
+"""
+import codecs, sys
+
+### Codec APIs
+
+encode = codecs.utf_32_encode
+
+def decode(input, errors='strict'):
+ return codecs.utf_32_decode(input, errors, True)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def __init__(self, errors='strict'):
+ codecs.IncrementalEncoder.__init__(self, errors)
+ self.encoder = None
+
+ def encode(self, input, final=False):
+ if self.encoder is None:
+ result = codecs.utf_32_encode(input, self.errors)[0]
+ if sys.byteorder == 'little':
+ self.encoder = codecs.utf_32_le_encode
+ else:
+ self.encoder = codecs.utf_32_be_encode
+ return result
+ return self.encoder(input, self.errors)[0]
+
+ def reset(self):
+ codecs.IncrementalEncoder.reset(self)
+ self.encoder = None
+
+ def getstate(self):
+ # state info we return to the caller:
+ # 0: stream is in natural order for this platform
+ # 2: endianness hasn't been determined yet
+ # (we're never writing in unnatural order)
+ return (2 if self.encoder is None else 0)
+
+ def setstate(self, state):
+ if state:
+ self.encoder = None
+ else:
+ if sys.byteorder == 'little':
+ self.encoder = codecs.utf_32_le_encode
+ else:
+ self.encoder = codecs.utf_32_be_encode
+
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
+ def __init__(self, errors='strict'):
+ codecs.BufferedIncrementalDecoder.__init__(self, errors)
+ self.decoder = None
+
+ def _buffer_decode(self, input, errors, final):
+ if self.decoder is None:
+ (output, consumed, byteorder) = \
+ codecs.utf_32_ex_decode(input, errors, 0, final)
+ if byteorder == -1:
+ self.decoder = codecs.utf_32_le_decode
+ elif byteorder == 1:
+ self.decoder = codecs.utf_32_be_decode
+ elif consumed >= 4:
+ raise UnicodeError("UTF-32 stream does not start with BOM")
+ return (output, consumed)
+ return self.decoder(input, self.errors, final)
+
+ def reset(self):
+ codecs.BufferedIncrementalDecoder.reset(self)
+ self.decoder = None
+
+ def getstate(self):
+ # additonal state info from the base class must be None here,
+ # as it isn't passed along to the caller
+ state = codecs.BufferedIncrementalDecoder.getstate(self)[0]
+ # additional state info we pass to the caller:
+ # 0: stream is in natural order for this platform
+ # 1: stream is in unnatural order
+ # 2: endianness hasn't been determined yet
+ if self.decoder is None:
+ return (state, 2)
+ addstate = int((sys.byteorder == "big") !=
+ (self.decoder is codecs.utf_32_be_decode))
+ return (state, addstate)
+
+ def setstate(self, state):
+ # state[1] will be ignored by BufferedIncrementalDecoder.setstate()
+ codecs.BufferedIncrementalDecoder.setstate(self, state)
+ state = state[1]
+ if state == 0:
+ self.decoder = (codecs.utf_32_be_decode
+ if sys.byteorder == "big"
+ else codecs.utf_32_le_decode)
+ elif state == 1:
+ self.decoder = (codecs.utf_32_le_decode
+ if sys.byteorder == "big"
+ else codecs.utf_32_be_decode)
+ else:
+ self.decoder = None
+
+class StreamWriter(codecs.StreamWriter):
+ def __init__(self, stream, errors='strict'):
+ self.encoder = None
+ codecs.StreamWriter.__init__(self, stream, errors)
+
+ def reset(self):
+ codecs.StreamWriter.reset(self)
+ self.encoder = None
+
+ def encode(self, input, errors='strict'):
+ if self.encoder is None:
+ result = codecs.utf_32_encode(input, errors)
+ if sys.byteorder == 'little':
+ self.encoder = codecs.utf_32_le_encode
+ else:
+ self.encoder = codecs.utf_32_be_encode
+ return result
+ else:
+ return self.encoder(input, errors)
+
+class StreamReader(codecs.StreamReader):
+
+ def reset(self):
+ codecs.StreamReader.reset(self)
+ try:
+ del self.decode
+ except AttributeError:
+ pass
+
+ def decode(self, input, errors='strict'):
+ (object, consumed, byteorder) = \
+ codecs.utf_32_ex_decode(input, errors, 0, False)
+ if byteorder == -1:
+ self.decode = codecs.utf_32_le_decode
+ elif byteorder == 1:
+ self.decode = codecs.utf_32_be_decode
+ elif consumed>=4:
+ raise UnicodeError,"UTF-32 stream does not start with BOM"
+ return (object, consumed)
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='utf-32',
+ encode=encode,
+ decode=decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..f7c4b87e7f
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32_be.py
@@ -0,0 +1,37 @@
+"""
+Python 'utf-32-be' Codec
+"""
+import codecs
+
+### Codec APIs
+
+encode = codecs.utf_32_be_encode
+
+def decode(input, errors='strict'):
+ return codecs.utf_32_be_decode(input, errors, True)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.utf_32_be_encode(input, self.errors)[0]
+
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
+ _buffer_decode = codecs.utf_32_be_decode
+
+class StreamWriter(codecs.StreamWriter):
+ encode = codecs.utf_32_be_encode
+
+class StreamReader(codecs.StreamReader):
+ decode = codecs.utf_32_be_decode
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='utf-32-be',
+ encode=encode,
+ decode=decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..4346a1201a
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32_le.py
@@ -0,0 +1,37 @@
+"""
+Python 'utf-32-le' Codec
+"""
+import codecs
+
+### Codec APIs
+
+encode = codecs.utf_32_le_encode
+
+def decode(input, errors='strict'):
+ return codecs.utf_32_le_decode(input, errors, True)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.utf_32_le_encode(input, self.errors)[0]
+
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
+ _buffer_decode = codecs.utf_32_le_decode
+
+class StreamWriter(codecs.StreamWriter):
+ encode = codecs.utf_32_le_encode
+
+class StreamReader(codecs.StreamReader):
+ decode = codecs.utf_32_le_decode
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='utf-32-le',
+ encode=encode,
+ decode=decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..6c305386d5
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_7.py
@@ -0,0 +1,38 @@
+""" Python 'utf-7' Codec
+
+Written by Brian Quinlan (brian@sweetapp.com).
+"""
+import codecs
+
+### Codec APIs
+
+encode = codecs.utf_7_encode
+
+def decode(input, errors='strict'):
+ return codecs.utf_7_decode(input, errors, True)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.utf_7_encode(input, self.errors)[0]
+
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
+ _buffer_decode = codecs.utf_7_decode
+
+class StreamWriter(codecs.StreamWriter):
+ encode = codecs.utf_7_encode
+
+class StreamReader(codecs.StreamReader):
+ decode = codecs.utf_7_decode
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='utf-7',
+ encode=encode,
+ decode=decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..cc118ac2c4
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_8.py
@@ -0,0 +1,42 @@
+""" Python 'utf-8' Codec
+
+
+Written by Marc-Andre Lemburg (mal@lemburg.com).
+
+(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
+
+"""
+import codecs
+
+### Codec APIs
+
+encode = codecs.utf_8_encode
+
+def decode(input, errors='strict'):
+ return codecs.utf_8_decode(input, errors, True)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.utf_8_encode(input, self.errors)[0]
+
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
+ _buffer_decode = codecs.utf_8_decode
+
+class StreamWriter(codecs.StreamWriter):
+ encode = codecs.utf_8_encode
+
+class StreamReader(codecs.StreamReader):
+ decode = codecs.utf_8_decode
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='utf-8',
+ encode=encode,
+ decode=decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..8cafef7df3
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_8_sig.py
@@ -0,0 +1,117 @@
+""" Python 'utf-8-sig' Codec
+This work similar to UTF-8 with the following changes:
+
+* On encoding/writing a UTF-8 encoded BOM will be prepended/written as the
+ first three bytes.
+
+* On decoding/reading if the first three bytes are a UTF-8 encoded BOM, these
+ bytes will be skipped.
+"""
+import codecs
+
+### Codec APIs
+
+def encode(input, errors='strict'):
+ return (codecs.BOM_UTF8 + codecs.utf_8_encode(input, errors)[0], len(input))
+
+def decode(input, errors='strict'):
+ prefix = 0
+ if input[:3] == codecs.BOM_UTF8:
+ input = input[3:]
+ prefix = 3
+ (output, consumed) = codecs.utf_8_decode(input, errors, True)
+ return (output, consumed+prefix)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def __init__(self, errors='strict'):
+ codecs.IncrementalEncoder.__init__(self, errors)
+ self.first = 1
+
+ def encode(self, input, final=False):
+ if self.first:
+ self.first = 0
+ return codecs.BOM_UTF8 + codecs.utf_8_encode(input, self.errors)[0]
+ else:
+ return codecs.utf_8_encode(input, self.errors)[0]
+
+ def reset(self):
+ codecs.IncrementalEncoder.reset(self)
+ self.first = 1
+
+ def getstate(self):
+ return self.first
+
+ def setstate(self, state):
+ self.first = state
+
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
+ def __init__(self, errors='strict'):
+ codecs.BufferedIncrementalDecoder.__init__(self, errors)
+ self.first = True
+
+ def _buffer_decode(self, input, errors, final):
+ if self.first:
+ if len(input) < 3:
+ if codecs.BOM_UTF8.startswith(input):
+ # not enough data to decide if this really is a BOM
+ # => try again on the next call
+ return (u"", 0)
+ else:
+ self.first = None
+ else:
+ self.first = None
+ if input[:3] == codecs.BOM_UTF8:
+ (output, consumed) = codecs.utf_8_decode(input[3:], errors, final)
+ return (output, consumed+3)
+ return codecs.utf_8_decode(input, errors, final)
+
+ def reset(self):
+ codecs.BufferedIncrementalDecoder.reset(self)
+ self.first = True
+
+class StreamWriter(codecs.StreamWriter):
+ def reset(self):
+ codecs.StreamWriter.reset(self)
+ try:
+ del self.encode
+ except AttributeError:
+ pass
+
+ def encode(self, input, errors='strict'):
+ self.encode = codecs.utf_8_encode
+ return encode(input, errors)
+
+class StreamReader(codecs.StreamReader):
+ def reset(self):
+ codecs.StreamReader.reset(self)
+ try:
+ del self.decode
+ except AttributeError:
+ pass
+
+ def decode(self, input, errors='strict'):
+ if len(input) < 3:
+ if codecs.BOM_UTF8.startswith(input):
+ # not enough data to decide if this is a BOM
+ # => try again on the next call
+ return (u"", 0)
+ elif input[:3] == codecs.BOM_UTF8:
+ self.decode = codecs.utf_8_decode
+ (output, consumed) = codecs.utf_8_decode(input[3:],errors)
+ return (output, consumed+3)
+ # (else) no BOM present
+ self.decode = codecs.utf_8_decode
+ return codecs.utf_8_decode(input, errors)
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='utf-8-sig',
+ encode=encode,
+ decode=decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..71ac65bca2
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/uu_codec.py
@@ -0,0 +1,129 @@
+""" Python 'uu_codec' Codec - UU content transfer encoding
+
+ Unlike most of the other codecs which target Unicode, this codec
+ will return Python string objects for both encode and decode.
+
+ Written by Marc-Andre Lemburg (mal@lemburg.com). Some details were
+ adapted from uu.py which was written by Lance Ellinghouse and
+ modified by Jack Jansen and Fredrik Lundh.
+
+"""
+import codecs, binascii
+
+### Codec APIs
+
+def uu_encode(input,errors='strict',filename='<data>',mode=0666):
+
+ """ Encodes the object input and returns a tuple (output
+ object, length consumed).
+
+ errors defines the error handling to apply. It defaults to
+ 'strict' handling which is the only currently supported
+ error handling for this codec.
+
+ """
+ assert errors == 'strict'
+ from cStringIO import StringIO
+ from binascii import b2a_uu
+ # using str() because of cStringIO's Unicode undesired Unicode behavior.
+ infile = StringIO(str(input))
+ outfile = StringIO()
+ read = infile.read
+ write = outfile.write
+
+ # Encode
+ write('begin %o %s\n' % (mode & 0777, filename))
+ chunk = read(45)
+ while chunk:
+ write(b2a_uu(chunk))
+ chunk = read(45)
+ write(' \nend\n')
+
+ return (outfile.getvalue(), len(input))
+
+def uu_decode(input,errors='strict'):
+
+ """ Decodes the object input and returns a tuple (output
+ object, length consumed).
+
+ input must be an object which provides the bf_getreadbuf
+ buffer slot. Python strings, buffer objects and memory
+ mapped files are examples of objects providing this slot.
+
+ errors defines the error handling to apply. It defaults to
+ 'strict' handling which is the only currently supported
+ error handling for this codec.
+
+ Note: filename and file mode information in the input data is
+ ignored.
+
+ """
+ assert errors == 'strict'
+ from cStringIO import StringIO
+ from binascii import a2b_uu
+ infile = StringIO(str(input))
+ outfile = StringIO()
+ readline = infile.readline
+ write = outfile.write
+
+ # Find start of encoded data
+ while 1:
+ s = readline()
+ if not s:
+ raise ValueError, 'Missing "begin" line in input data'
+ if s[:5] == 'begin':
+ break
+
+ # Decode
+ while 1:
+ s = readline()
+ if not s or \
+ s == 'end\n':
+ break
+ try:
+ data = a2b_uu(s)
+ except binascii.Error, v:
+ # Workaround for broken uuencoders by /Fredrik Lundh
+ nbytes = (((ord(s[0])-32) & 63) * 4 + 5) // 3
+ data = a2b_uu(s[:nbytes])
+ #sys.stderr.write("Warning: %s\n" % str(v))
+ write(data)
+ if not s:
+ raise ValueError, 'Truncated input data'
+
+ return (outfile.getvalue(), len(input))
+
+class Codec(codecs.Codec):
+
+ def encode(self,input,errors='strict'):
+ return uu_encode(input,errors)
+
+ def decode(self,input,errors='strict'):
+ return uu_decode(input,errors)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return uu_encode(input, self.errors)[0]
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def decode(self, input, final=False):
+ return uu_decode(input, self.errors)[0]
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='uu',
+ encode=uu_encode,
+ decode=uu_decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..82557d047a
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/zlib_codec.py
@@ -0,0 +1,102 @@
+""" Python 'zlib_codec' Codec - zlib compression encoding
+
+ Unlike most of the other codecs which target Unicode, this codec
+ will return Python string objects for both encode and decode.
+
+ Written by Marc-Andre Lemburg (mal@lemburg.com).
+
+"""
+import codecs
+import zlib # this codec needs the optional zlib module !
+
+### Codec APIs
+
+def zlib_encode(input,errors='strict'):
+
+ """ Encodes the object input and returns a tuple (output
+ object, length consumed).
+
+ errors defines the error handling to apply. It defaults to
+ 'strict' handling which is the only currently supported
+ error handling for this codec.
+
+ """
+ assert errors == 'strict'
+ output = zlib.compress(input)
+ return (output, len(input))
+
+def zlib_decode(input,errors='strict'):
+
+ """ Decodes the object input and returns a tuple (output
+ object, length consumed).
+
+ input must be an object which provides the bf_getreadbuf
+ buffer slot. Python strings, buffer objects and memory
+ mapped files are examples of objects providing this slot.
+
+ errors defines the error handling to apply. It defaults to
+ 'strict' handling which is the only currently supported
+ error handling for this codec.
+
+ """
+ assert errors == 'strict'
+ output = zlib.decompress(input)
+ return (output, len(input))
+
+class Codec(codecs.Codec):
+
+ def encode(self, input, errors='strict'):
+ return zlib_encode(input, errors)
+ def decode(self, input, errors='strict'):
+ return zlib_decode(input, errors)
+
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def __init__(self, errors='strict'):
+ assert errors == 'strict'
+ self.errors = errors
+ self.compressobj = zlib.compressobj()
+
+ def encode(self, input, final=False):
+ if final:
+ c = self.compressobj.compress(input)
+ return c + self.compressobj.flush()
+ else:
+ return self.compressobj.compress(input)
+
+ def reset(self):
+ self.compressobj = zlib.compressobj()
+
+class IncrementalDecoder(codecs.IncrementalDecoder):
+ def __init__(self, errors='strict'):
+ assert errors == 'strict'
+ self.errors = errors
+ self.decompressobj = zlib.decompressobj()
+
+ def decode(self, input, final=False):
+ if final:
+ c = self.decompressobj.decompress(input)
+ return c + self.decompressobj.flush()
+ else:
+ return self.decompressobj.decompress(input)
+
+ def reset(self):
+ self.decompressobj = zlib.decompressobj()
+
+class StreamWriter(Codec,codecs.StreamWriter):
+ pass
+
+class StreamReader(Codec,codecs.StreamReader):
+ pass
+
+### encodings module API
+
+def getregentry():
+ return codecs.CodecInfo(
+ name='zlib',
+ encode=zlib_encode,
+ decode=zlib_decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )
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
index 0000000000..221c507dcf
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/fileinput.py
@@ -0,0 +1,417 @@
+"""Helper class to quickly write a loop over all standard input files.
+
+Typical use is:
+
+ import fileinput
+ for line in fileinput.input():
+ process(line)
+
+This iterates over the lines of all files listed in sys.argv[1:],
+defaulting to sys.stdin if the list is empty. If a filename is '-' it
+is also replaced by sys.stdin. To specify an alternative list of
+filenames, pass it as the argument to input(). A single file name is
+also allowed.
+
+Functions filename(), lineno() return the filename and cumulative line
+number of the line that has just been read; filelineno() returns its
+line number in the current file; isfirstline() returns true iff the
+line just read is the first line of its file; isstdin() returns true
+iff the line was read from sys.stdin. Function nextfile() closes the
+current file so that the next iteration will read the first line from
+the next file (if any); lines not read from the file will not count
+towards the cumulative line count; the filename is not changed until
+after the first line of the next file has been read. Function close()
+closes the sequence.
+
+Before any lines have been read, filename() returns None and both line
+numbers are zero; nextfile() has no effect. After all lines have been
+read, filename() and the line number functions return the values
+pertaining to the last line read; nextfile() has no effect.
+
+All files are opened in text mode by default, you can override this by
+setting the mode parameter to input() or FileInput.__init__().
+If an I/O error occurs during opening or reading a file, the IOError
+exception is raised.
+
+If sys.stdin is used more than once, the second and further use will
+return no lines, except perhaps for interactive use, or if it has been
+explicitly reset (e.g. using sys.stdin.seek(0)).
+
+Empty files are opened and immediately closed; the only time their
+presence in the list of filenames is noticeable at all is when the
+last file opened is empty.
+
+It is possible that the last line of a file doesn't end in a newline
+character; otherwise lines are returned including the trailing
+newline.
+
+Class FileInput is the implementation; its methods filename(),
+lineno(), fileline(), isfirstline(), isstdin(), nextfile() and close()
+correspond to the functions in the module. In addition it has a
+readline() method which returns the next input line, and a
+__getitem__() method which implements the sequence behavior. The
+sequence must be accessed in strictly sequential order; sequence
+access and readline() cannot be mixed.
+
+Optional in-place filtering: if the keyword argument inplace=1 is
+passed to input() or to the FileInput constructor, the file is moved
+to a backup file and standard output is directed to the input file.
+This makes it possible to write a filter that rewrites its input file
+in place. If the keyword argument backup=".<some extension>" is also
+given, it specifies the extension for the backup file, and the backup
+file remains around; by default, the extension is ".bak" and it is
+deleted when the output file is closed. In-place filtering is
+disabled when standard input is read. XXX The current implementation
+does not work for MS-DOS 8+3 filesystems.
+
+Performance: this module is unfortunately one of the slower ways of
+processing large numbers of input lines. Nevertheless, a significant
+speed-up has been obtained by using readlines(bufsize) instead of
+readline(). A new keyword argument, bufsize=N, is present on the
+input() function and the FileInput() class to override the default
+buffer size.
+
+XXX Possible additions:
+
+- optional getopt argument processing
+- isatty()
+- read(), read(size), even readlines()
+
+"""
+
+import sys, os
+
+__all__ = ["input","close","nextfile","filename","lineno","filelineno",
+ "isfirstline","isstdin","FileInput"]
+
+_state = None
+
+DEFAULT_BUFSIZE = 8*1024
+
+def input(files=None, inplace=0, backup="", bufsize=0,
+ mode="r", openhook=None):
+ """Return an instance of the FileInput class, which can be iterated.
+
+ The parameters are passed to the constructor of the FileInput class.
+ The returned instance, in addition to being an iterator,
+ keeps global state for the functions of this module,.
+ """
+ global _state
+ if _state and _state._file:
+ raise RuntimeError, "input() already active"
+ _state = FileInput(files, inplace, backup, bufsize, mode, openhook)
+ return _state
+
+def close():
+ """Close the sequence."""
+ global _state
+ state = _state
+ _state = None
+ if state:
+ state.close()
+
+def nextfile():
+ """
+ Close the current file so that the next iteration will read the first
+ line from the next file (if any); lines not read from the file will
+ not count towards the cumulative line count. The filename is not
+ changed until after the first line of the next file has been read.
+ Before the first line has been read, this function has no effect;
+ it cannot be used to skip the first file. After the last line of the
+ last file has been read, this function has no effect.
+ """
+ if not _state:
+ raise RuntimeError, "no active input()"
+ return _state.nextfile()
+
+def filename():
+ """
+ Return the name of the file currently being read.
+ Before the first line has been read, returns None.
+ """
+ if not _state:
+ raise RuntimeError, "no active input()"
+ return _state.filename()
+
+def lineno():
+ """
+ Return the cumulative line number of the line that has just been read.
+ Before the first line has been read, returns 0. After the last line
+ of the last file has been read, returns the line number of that line.
+ """
+ if not _state:
+ raise RuntimeError, "no active input()"
+ return _state.lineno()
+
+def filelineno():
+ """
+ Return the line number in the current file. Before the first line
+ has been read, returns 0. After the last line of the last file has
+ been read, returns the line number of that line within the file.
+ """
+ if not _state:
+ raise RuntimeError, "no active input()"
+ return _state.filelineno()
+
+def fileno():
+ """
+ Return the file number of the current file. When no file is currently
+ opened, returns -1.
+ """
+ if not _state:
+ raise RuntimeError, "no active input()"
+ return _state.fileno()
+
+def isfirstline():
+ """
+ Returns true the line just read is the first line of its file,
+ otherwise returns false.
+ """
+ if not _state:
+ raise RuntimeError, "no active input()"
+ return _state.isfirstline()
+
+def isstdin():
+ """
+ Returns true if the last line was read from sys.stdin,
+ otherwise returns false.
+ """
+ if not _state:
+ raise RuntimeError, "no active input()"
+ return _state.isstdin()
+
+class FileInput:
+ """FileInput([files[, inplace[, backup[, bufsize[, mode[, openhook]]]]]])
+
+ Class FileInput is the implementation of the module; its methods
+ filename(), lineno(), fileline(), isfirstline(), isstdin(), fileno(),
+ nextfile() and close() correspond to the functions of the same name
+ in the module.
+ In addition it has a readline() method which returns the next
+ input line, and a __getitem__() method which implements the
+ sequence behavior. The sequence must be accessed in strictly
+ sequential order; random access and readline() cannot be mixed.
+ """
+
+ def __init__(self, files=None, inplace=0, backup="", bufsize=0,
+ mode="r", openhook=None):
+ if isinstance(files, basestring):
+ files = (files,)
+ else:
+ if files is None:
+ files = sys.argv[1:]
+ if not files:
+ files = ('-',)
+ else:
+ files = tuple(files)
+ self._files = files
+ self._inplace = inplace
+ self._backup = backup
+ self._bufsize = bufsize or DEFAULT_BUFSIZE
+ self._savestdout = None
+ self._output = None
+ self._filename = None
+ self._lineno = 0
+ self._filelineno = 0
+ self._file = None
+ self._isstdin = False
+ self._backupfilename = None
+ self._buffer = []
+ self._bufindex = 0
+ # restrict mode argument to reading modes
+ if mode not in ('r', 'rU', 'U', 'rb'):
+ raise ValueError("FileInput opening mode must be one of "
+ "'r', 'rU', 'U' and 'rb'")
+ self._mode = mode
+ if inplace and openhook:
+ raise ValueError("FileInput cannot use an opening hook in inplace mode")
+ elif openhook and not hasattr(openhook, '__call__'):
+ raise ValueError("FileInput openhook must be callable")
+ self._openhook = openhook
+
+ def __del__(self):
+ self.close()
+
+ def close(self):
+ try:
+ self.nextfile()
+ finally:
+ self._files = ()
+
+ def __iter__(self):
+ return self
+
+ def next(self):
+ try:
+ line = self._buffer[self._bufindex]
+ except IndexError:
+ pass
+ else:
+ self._bufindex += 1
+ self._lineno += 1
+ self._filelineno += 1
+ return line
+ line = self.readline()
+ if not line:
+ raise StopIteration
+ return line
+
+ def __getitem__(self, i):
+ if i != self._lineno:
+ raise RuntimeError, "accessing lines out of order"
+ try:
+ return self.next()
+ except StopIteration:
+ raise IndexError, "end of input reached"
+
+ def nextfile(self):
+ savestdout = self._savestdout
+ self._savestdout = 0
+ if savestdout:
+ sys.stdout = savestdout
+
+ output = self._output
+ self._output = 0
+ try:
+ if output:
+ output.close()
+ finally:
+ file = self._file
+ self._file = 0
+ try:
+ if file and not self._isstdin:
+ file.close()
+ finally:
+ backupfilename = self._backupfilename
+ self._backupfilename = 0
+ if backupfilename and not self._backup:
+ try: os.unlink(backupfilename)
+ except OSError: pass
+
+ self._isstdin = False
+ self._buffer = []
+ self._bufindex = 0
+
+ def readline(self):
+ try:
+ line = self._buffer[self._bufindex]
+ except IndexError:
+ pass
+ else:
+ self._bufindex += 1
+ self._lineno += 1
+ self._filelineno += 1
+ return line
+ if not self._file:
+ if not self._files:
+ return ""
+ self._filename = self._files[0]
+ self._files = self._files[1:]
+ self._filelineno = 0
+ self._file = None
+ self._isstdin = False
+ self._backupfilename = 0
+ if self._filename == '-':
+ self._filename = '<stdin>'
+ self._file = sys.stdin
+ self._isstdin = True
+ else:
+ if self._inplace:
+ self._backupfilename = (
+ self._filename + (self._backup or os.extsep+"bak"))
+ try: os.unlink(self._backupfilename)
+ except os.error: pass
+ # The next few lines may raise IOError
+ os.rename(self._filename, self._backupfilename)
+ self._file = open(self._backupfilename, self._mode)
+ try:
+ perm = os.fstat(self._file.fileno()).st_mode
+ except OSError:
+ self._output = open(self._filename, "w")
+ else:
+ fd = os.open(self._filename,
+ os.O_CREAT | os.O_WRONLY | os.O_TRUNC,
+ perm)
+ self._output = os.fdopen(fd, "w")
+ try:
+ if hasattr(os, 'chmod'):
+ os.chmod(self._filename, perm)
+ except OSError:
+ pass
+ self._savestdout = sys.stdout
+ sys.stdout = self._output
+ else:
+ # This may raise IOError
+ if self._openhook:
+ self._file = self._openhook(self._filename, self._mode)
+ else:
+ self._file = open(self._filename, self._mode)
+ self._buffer = self._file.readlines(self._bufsize)
+ self._bufindex = 0
+ if not self._buffer:
+ self.nextfile()
+ # Recursive call
+ return self.readline()
+
+ def filename(self):
+ return self._filename
+
+ def lineno(self):
+ return self._lineno
+
+ def filelineno(self):
+ return self._filelineno
+
+ def fileno(self):
+ if self._file:
+ try:
+ return self._file.fileno()
+ except ValueError:
+ return -1
+ else:
+ return -1
+
+ def isfirstline(self):
+ return self._filelineno == 1
+
+ def isstdin(self):
+ return self._isstdin
+
+
+def hook_compressed(filename, mode):
+ ext = os.path.splitext(filename)[1]
+ if ext == '.gz':
+ import gzip
+ return gzip.open(filename, mode)
+ elif ext == '.bz2':
+ import bz2
+ return bz2.BZ2File(filename, mode)
+ else:
+ return open(filename, mode)
+
+
+def hook_encoded(encoding):
+ import io
+ def openhook(filename, mode):
+ mode = mode.replace('U', '').replace('b', '') or 'r'
+ return io.open(filename, mode, encoding=encoding, newline='')
+ return openhook
+
+
+def _test():
+ import getopt
+ inplace = 0
+ backup = 0
+ opts, args = getopt.getopt(sys.argv[1:], "ib:")
+ for o, a in opts:
+ if o == '-i': inplace = 1
+ if o == '-b': backup = a
+ for line in input(args, inplace=inplace, backup=backup):
+ if line[-1:] == '\n': line = line[:-1]
+ if line[-1:] == '\r': line = line[:-1]
+ print "%d: %s[%d]%s %s" % (lineno(), filename(), filelineno(),
+ isfirstline() and "*" or "", line)
+ print "%d: %s[%d]" % (lineno(), filename(), filelineno())
+
+if __name__ == '__main__':
+ _test()
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
index 0000000000..2a03be93a7
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/fnmatch.py
@@ -0,0 +1,120 @@
+"""Filename matching with shell patterns.
+
+fnmatch(FILENAME, PATTERN) matches according to the local convention.
+fnmatchcase(FILENAME, PATTERN) always takes case in account.
+
+The functions operate by translating the pattern into a regular
+expression. They cache the compiled regular expressions for speed.
+
+The function translate(PATTERN) returns a regular expression
+corresponding to PATTERN. (It does not compile it.)
+"""
+
+import re
+
+__all__ = ["filter", "fnmatch", "fnmatchcase", "translate"]
+
+_cache = {}
+_MAXCACHE = 100
+
+def _purge():
+ """Clear the pattern cache"""
+ _cache.clear()
+
+def fnmatch(name, pat):
+ """Test whether FILENAME matches PATTERN.
+
+ Patterns are Unix shell style:
+
+ * matches everything
+ ? matches any single character
+ [seq] matches any character in seq
+ [!seq] matches any char not in seq
+
+ An initial period in FILENAME is not special.
+ Both FILENAME and PATTERN are first case-normalized
+ if the operating system requires it.
+ If you don't want this, use fnmatchcase(FILENAME, PATTERN).
+ """
+
+ import os
+ name = os.path.normcase(name)
+ pat = os.path.normcase(pat)
+ return fnmatchcase(name, pat)
+
+def filter(names, pat):
+ """Return the subset of the list NAMES that match PAT"""
+ import os,posixpath
+ result=[]
+ pat=os.path.normcase(pat)
+ try:
+ re_pat = _cache[pat]
+ except KeyError:
+ res = translate(pat)
+ if len(_cache) >= _MAXCACHE:
+ _cache.clear()
+ _cache[pat] = re_pat = re.compile(res)
+ match = re_pat.match
+ if os.path is posixpath:
+ # normcase on posix is NOP. Optimize it away from the loop.
+ for name in names:
+ if match(name):
+ result.append(name)
+ else:
+ for name in names:
+ if match(os.path.normcase(name)):
+ result.append(name)
+ return result
+
+def fnmatchcase(name, pat):
+ """Test whether FILENAME matches PATTERN, including case.
+
+ This is a version of fnmatch() which doesn't case-normalize
+ its arguments.
+ """
+
+ try:
+ re_pat = _cache[pat]
+ except KeyError:
+ res = translate(pat)
+ if len(_cache) >= _MAXCACHE:
+ _cache.clear()
+ _cache[pat] = re_pat = re.compile(res)
+ return re_pat.match(name) is not None
+
+def translate(pat):
+ """Translate a shell PATTERN to a regular expression.
+
+ There is no way to quote meta-characters.
+ """
+
+ i, n = 0, len(pat)
+ res = ''
+ while i < n:
+ c = pat[i]
+ i = i+1
+ if c == '*':
+ res = res + '.*'
+ elif c == '?':
+ res = res + '.'
+ elif c == '[':
+ j = i
+ if j < n and pat[j] == '!':
+ j = j+1
+ if j < n and pat[j] == ']':
+ j = j+1
+ while j < n and pat[j] != ']':
+ j = j+1
+ if j >= n:
+ res = res + '\\['
+ else:
+ stuff = pat[i:j].replace('\\','\\\\')
+ i = j+1
+ if stuff[0] == '!':
+ stuff = '^' + stuff[1:]
+ elif stuff[0] == '^':
+ stuff = '\\' + stuff
+ res = '%s[%s]' % (res, stuff)
+ else:
+ res = res + re.escape(c)
+ return res + '\Z(?ms)'
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
index 0000000000..8413f8c331
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/formatter.py
@@ -0,0 +1,445 @@
+"""Generic output formatting.
+
+Formatter objects transform an abstract flow of formatting events into
+specific output events on writer objects. Formatters manage several stack
+structures to allow various properties of a writer object to be changed and
+restored; writers need not be able to handle relative changes nor any sort
+of ``change back'' operation. Specific writer properties which may be
+controlled via formatter objects are horizontal alignment, font, and left
+margin indentations. A mechanism is provided which supports providing
+arbitrary, non-exclusive style settings to a writer as well. Additional
+interfaces facilitate formatting events which are not reversible, such as
+paragraph separation.
+
+Writer objects encapsulate device interfaces. Abstract devices, such as
+file formats, are supported as well as physical devices. The provided
+implementations all work with abstract devices. The interface makes
+available mechanisms for setting the properties which formatter objects
+manage and inserting data into the output.
+"""
+
+import sys
+
+
+AS_IS = None
+
+
+class NullFormatter:
+ """A formatter which does nothing.
+
+ If the writer parameter is omitted, a NullWriter instance is created.
+ No methods of the writer are called by NullFormatter instances.
+
+ Implementations should inherit from this class if implementing a writer
+ interface but don't need to inherit any implementation.
+
+ """
+
+ def __init__(self, writer=None):
+ if writer is None:
+ writer = NullWriter()
+ self.writer = writer
+ def end_paragraph(self, blankline): pass
+ def add_line_break(self): pass
+ def add_hor_rule(self, *args, **kw): pass
+ def add_label_data(self, format, counter, blankline=None): pass
+ def add_flowing_data(self, data): pass
+ def add_literal_data(self, data): pass
+ def flush_softspace(self): pass
+ def push_alignment(self, align): pass
+ def pop_alignment(self): pass
+ def push_font(self, x): pass
+ def pop_font(self): pass
+ def push_margin(self, margin): pass
+ def pop_margin(self): pass
+ def set_spacing(self, spacing): pass
+ def push_style(self, *styles): pass
+ def pop_style(self, n=1): pass
+ def assert_line_data(self, flag=1): pass
+
+
+class AbstractFormatter:
+ """The standard formatter.
+
+ This implementation has demonstrated wide applicability to many writers,
+ and may be used directly in most circumstances. It has been used to
+ implement a full-featured World Wide Web browser.
+
+ """
+
+ # Space handling policy: blank spaces at the boundary between elements
+ # are handled by the outermost context. "Literal" data is not checked
+ # to determine context, so spaces in literal data are handled directly
+ # in all circumstances.
+
+ def __init__(self, writer):
+ self.writer = writer # Output device
+ self.align = None # Current alignment
+ self.align_stack = [] # Alignment stack
+ self.font_stack = [] # Font state
+ self.margin_stack = [] # Margin state
+ self.spacing = None # Vertical spacing state
+ self.style_stack = [] # Other state, e.g. color
+ self.nospace = 1 # Should leading space be suppressed
+ self.softspace = 0 # Should a space be inserted
+ self.para_end = 1 # Just ended a paragraph
+ self.parskip = 0 # Skipped space between paragraphs?
+ self.hard_break = 1 # Have a hard break
+ self.have_label = 0
+
+ def end_paragraph(self, blankline):
+ if not self.hard_break:
+ self.writer.send_line_break()
+ self.have_label = 0
+ if self.parskip < blankline and not self.have_label:
+ self.writer.send_paragraph(blankline - self.parskip)
+ self.parskip = blankline
+ self.have_label = 0
+ self.hard_break = self.nospace = self.para_end = 1
+ self.softspace = 0
+
+ def add_line_break(self):
+ if not (self.hard_break or self.para_end):
+ self.writer.send_line_break()
+ self.have_label = self.parskip = 0
+ self.hard_break = self.nospace = 1
+ self.softspace = 0
+
+ def add_hor_rule(self, *args, **kw):
+ if not self.hard_break:
+ self.writer.send_line_break()
+ self.writer.send_hor_rule(*args, **kw)
+ self.hard_break = self.nospace = 1
+ self.have_label = self.para_end = self.softspace = self.parskip = 0
+
+ def add_label_data(self, format, counter, blankline = None):
+ if self.have_label or not self.hard_break:
+ self.writer.send_line_break()
+ if not self.para_end:
+ self.writer.send_paragraph((blankline and 1) or 0)
+ if isinstance(format, str):
+ self.writer.send_label_data(self.format_counter(format, counter))
+ else:
+ self.writer.send_label_data(format)
+ self.nospace = self.have_label = self.hard_break = self.para_end = 1
+ self.softspace = self.parskip = 0
+
+ def format_counter(self, format, counter):
+ label = ''
+ for c in format:
+ if c == '1':
+ label = label + ('%d' % counter)
+ elif c in 'aA':
+ if counter > 0:
+ label = label + self.format_letter(c, counter)
+ elif c in 'iI':
+ if counter > 0:
+ label = label + self.format_roman(c, counter)
+ else:
+ label = label + c
+ return label
+
+ def format_letter(self, case, counter):
+ label = ''
+ while counter > 0:
+ counter, x = divmod(counter-1, 26)
+ # This makes a strong assumption that lowercase letters
+ # and uppercase letters form two contiguous blocks, with
+ # letters in order!
+ s = chr(ord(case) + x)
+ label = s + label
+ return label
+
+ def format_roman(self, case, counter):
+ ones = ['i', 'x', 'c', 'm']
+ fives = ['v', 'l', 'd']
+ label, index = '', 0
+ # This will die of IndexError when counter is too big
+ while counter > 0:
+ counter, x = divmod(counter, 10)
+ if x == 9:
+ label = ones[index] + ones[index+1] + label
+ elif x == 4:
+ label = ones[index] + fives[index] + label
+ else:
+ if x >= 5:
+ s = fives[index]
+ x = x-5
+ else:
+ s = ''
+ s = s + ones[index]*x
+ label = s + label
+ index = index + 1
+ if case == 'I':
+ return label.upper()
+ return label
+
+ def add_flowing_data(self, data):
+ if not data: return
+ prespace = data[:1].isspace()
+ postspace = data[-1:].isspace()
+ data = " ".join(data.split())
+ if self.nospace and not data:
+ return
+ elif prespace or self.softspace:
+ if not data:
+ if not self.nospace:
+ self.softspace = 1
+ self.parskip = 0
+ return
+ if not self.nospace:
+ data = ' ' + data
+ self.hard_break = self.nospace = self.para_end = \
+ self.parskip = self.have_label = 0
+ self.softspace = postspace
+ self.writer.send_flowing_data(data)
+
+ def add_literal_data(self, data):
+ if not data: return
+ if self.softspace:
+ self.writer.send_flowing_data(" ")
+ self.hard_break = data[-1:] == '\n'
+ self.nospace = self.para_end = self.softspace = \
+ self.parskip = self.have_label = 0
+ self.writer.send_literal_data(data)
+
+ def flush_softspace(self):
+ if self.softspace:
+ self.hard_break = self.para_end = self.parskip = \
+ self.have_label = self.softspace = 0
+ self.nospace = 1
+ self.writer.send_flowing_data(' ')
+
+ def push_alignment(self, align):
+ if align and align != self.align:
+ self.writer.new_alignment(align)
+ self.align = align
+ self.align_stack.append(align)
+ else:
+ self.align_stack.append(self.align)
+
+ def pop_alignment(self):
+ if self.align_stack:
+ del self.align_stack[-1]
+ if self.align_stack:
+ self.align = align = self.align_stack[-1]
+ self.writer.new_alignment(align)
+ else:
+ self.align = None
+ self.writer.new_alignment(None)
+
+ def push_font(self, font):
+ size, i, b, tt = font
+ if self.softspace:
+ self.hard_break = self.para_end = self.softspace = 0
+ self.nospace = 1
+ self.writer.send_flowing_data(' ')
+ if self.font_stack:
+ csize, ci, cb, ctt = self.font_stack[-1]
+ if size is AS_IS: size = csize
+ if i is AS_IS: i = ci
+ if b is AS_IS: b = cb
+ if tt is AS_IS: tt = ctt
+ font = (size, i, b, tt)
+ self.font_stack.append(font)
+ self.writer.new_font(font)
+
+ def pop_font(self):
+ if self.font_stack:
+ del self.font_stack[-1]
+ if self.font_stack:
+ font = self.font_stack[-1]
+ else:
+ font = None
+ self.writer.new_font(font)
+
+ def push_margin(self, margin):
+ self.margin_stack.append(margin)
+ fstack = filter(None, self.margin_stack)
+ if not margin and fstack:
+ margin = fstack[-1]
+ self.writer.new_margin(margin, len(fstack))
+
+ def pop_margin(self):
+ if self.margin_stack:
+ del self.margin_stack[-1]
+ fstack = filter(None, self.margin_stack)
+ if fstack:
+ margin = fstack[-1]
+ else:
+ margin = None
+ self.writer.new_margin(margin, len(fstack))
+
+ def set_spacing(self, spacing):
+ self.spacing = spacing
+ self.writer.new_spacing(spacing)
+
+ def push_style(self, *styles):
+ if self.softspace:
+ self.hard_break = self.para_end = self.softspace = 0
+ self.nospace = 1
+ self.writer.send_flowing_data(' ')
+ for style in styles:
+ self.style_stack.append(style)
+ self.writer.new_styles(tuple(self.style_stack))
+
+ def pop_style(self, n=1):
+ del self.style_stack[-n:]
+ self.writer.new_styles(tuple(self.style_stack))
+
+ def assert_line_data(self, flag=1):
+ self.nospace = self.hard_break = not flag
+ self.para_end = self.parskip = self.have_label = 0
+
+
+class NullWriter:
+ """Minimal writer interface to use in testing & inheritance.
+
+ A writer which only provides the interface definition; no actions are
+ taken on any methods. This should be the base class for all writers
+ which do not need to inherit any implementation methods.
+
+ """
+ def __init__(self): pass
+ def flush(self): pass
+ def new_alignment(self, align): pass
+ def new_font(self, font): pass
+ def new_margin(self, margin, level): pass
+ def new_spacing(self, spacing): pass
+ def new_styles(self, styles): pass
+ def send_paragraph(self, blankline): pass
+ def send_line_break(self): pass
+ def send_hor_rule(self, *args, **kw): pass
+ def send_label_data(self, data): pass
+ def send_flowing_data(self, data): pass
+ def send_literal_data(self, data): pass
+
+
+class AbstractWriter(NullWriter):
+ """A writer which can be used in debugging formatters, but not much else.
+
+ Each method simply announces itself by printing its name and
+ arguments on standard output.
+
+ """
+
+ def new_alignment(self, align):
+ print "new_alignment(%r)" % (align,)
+
+ def new_font(self, font):
+ print "new_font(%r)" % (font,)
+
+ def new_margin(self, margin, level):
+ print "new_margin(%r, %d)" % (margin, level)
+
+ def new_spacing(self, spacing):
+ print "new_spacing(%r)" % (spacing,)
+
+ def new_styles(self, styles):
+ print "new_styles(%r)" % (styles,)
+
+ def send_paragraph(self, blankline):
+ print "send_paragraph(%r)" % (blankline,)
+
+ def send_line_break(self):
+ print "send_line_break()"
+
+ def send_hor_rule(self, *args, **kw):
+ print "send_hor_rule()"
+
+ def send_label_data(self, data):
+ print "send_label_data(%r)" % (data,)
+
+ def send_flowing_data(self, data):
+ print "send_flowing_data(%r)" % (data,)
+
+ def send_literal_data(self, data):
+ print "send_literal_data(%r)" % (data,)
+
+
+class DumbWriter(NullWriter):
+ """Simple writer class which writes output on the file object passed in
+ as the file parameter or, if file is omitted, on standard output. The
+ output is simply word-wrapped to the number of columns specified by
+ the maxcol parameter. This class is suitable for reflowing a sequence
+ of paragraphs.
+
+ """
+
+ def __init__(self, file=None, maxcol=72):
+ self.file = file or sys.stdout
+ self.maxcol = maxcol
+ NullWriter.__init__(self)
+ self.reset()
+
+ def reset(self):
+ self.col = 0
+ self.atbreak = 0
+
+ def send_paragraph(self, blankline):
+ self.file.write('\n'*blankline)
+ self.col = 0
+ self.atbreak = 0
+
+ def send_line_break(self):
+ self.file.write('\n')
+ self.col = 0
+ self.atbreak = 0
+
+ def send_hor_rule(self, *args, **kw):
+ self.file.write('\n')
+ self.file.write('-'*self.maxcol)
+ self.file.write('\n')
+ self.col = 0
+ self.atbreak = 0
+
+ def send_literal_data(self, data):
+ self.file.write(data)
+ i = data.rfind('\n')
+ if i >= 0:
+ self.col = 0
+ data = data[i+1:]
+ data = data.expandtabs()
+ self.col = self.col + len(data)
+ self.atbreak = 0
+
+ def send_flowing_data(self, data):
+ if not data: return
+ atbreak = self.atbreak or data[0].isspace()
+ col = self.col
+ maxcol = self.maxcol
+ write = self.file.write
+ for word in data.split():
+ if atbreak:
+ if col + len(word) >= maxcol:
+ write('\n')
+ col = 0
+ else:
+ write(' ')
+ col = col + 1
+ write(word)
+ col = col + len(word)
+ atbreak = 1
+ self.col = col
+ self.atbreak = data[-1].isspace()
+
+
+def test(file = None):
+ w = DumbWriter()
+ f = AbstractFormatter(w)
+ if file is not None:
+ fp = open(file)
+ elif sys.argv[1:]:
+ fp = open(sys.argv[1])
+ else:
+ fp = sys.stdin
+ for line in fp:
+ if line == '\n':
+ f.end_paragraph(1)
+ else:
+ f.add_flowing_data(line)
+ f.end_paragraph(0)
+
+
+if __name__ == '__main__':
+ test()
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
index 0000000000..b267245768
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/functools.py
@@ -0,0 +1,100 @@
+"""functools.py - Tools for working with functions and callable objects
+"""
+# Python module wrapper for _functools C module
+# to allow utilities written in Python to be added
+# to the functools module.
+# Written by Nick Coghlan <ncoghlan at gmail.com>
+# Copyright (C) 2006 Python Software Foundation.
+# See C source code for _functools credits/copyright
+
+from _functools import partial, reduce
+
+# update_wrapper() and wraps() are tools to help write
+# wrapper functions that can handle naive introspection
+
+WRAPPER_ASSIGNMENTS = ('__module__', '__name__', '__doc__')
+WRAPPER_UPDATES = ('__dict__',)
+def update_wrapper(wrapper,
+ wrapped,
+ assigned = WRAPPER_ASSIGNMENTS,
+ updated = WRAPPER_UPDATES):
+ """Update a wrapper function to look like the wrapped function
+
+ wrapper is the function to be updated
+ wrapped is the original function
+ assigned is a tuple naming the attributes assigned directly
+ from the wrapped function to the wrapper function (defaults to
+ functools.WRAPPER_ASSIGNMENTS)
+ updated is a tuple naming the attributes of the wrapper that
+ are updated with the corresponding attribute from the wrapped
+ function (defaults to functools.WRAPPER_UPDATES)
+ """
+ for attr in assigned:
+ setattr(wrapper, attr, getattr(wrapped, attr))
+ for attr in updated:
+ getattr(wrapper, attr).update(getattr(wrapped, attr, {}))
+ # Return the wrapper so this can be used as a decorator via partial()
+ return wrapper
+
+def wraps(wrapped,
+ assigned = WRAPPER_ASSIGNMENTS,
+ updated = WRAPPER_UPDATES):
+ """Decorator factory to apply update_wrapper() to a wrapper function
+
+ Returns a decorator that invokes update_wrapper() with the decorated
+ function as the wrapper argument and the arguments to wraps() as the
+ remaining arguments. Default arguments are as for update_wrapper().
+ This is a convenience function to simplify applying partial() to
+ update_wrapper().
+ """
+ return partial(update_wrapper, wrapped=wrapped,
+ assigned=assigned, updated=updated)
+
+def total_ordering(cls):
+ """Class decorator that fills in missing ordering methods"""
+ convert = {
+ '__lt__': [('__gt__', lambda self, other: not (self < other or self == other)),
+ ('__le__', lambda self, other: self < other or self == other),
+ ('__ge__', lambda self, other: not self < other)],
+ '__le__': [('__ge__', lambda self, other: not self <= other or self == other),
+ ('__lt__', lambda self, other: self <= other and not self == other),
+ ('__gt__', lambda self, other: not self <= other)],
+ '__gt__': [('__lt__', lambda self, other: not (self > other or self == other)),
+ ('__ge__', lambda self, other: self > other or self == other),
+ ('__le__', lambda self, other: not self > other)],
+ '__ge__': [('__le__', lambda self, other: (not self >= other) or self == other),
+ ('__gt__', lambda self, other: self >= other and not self == other),
+ ('__lt__', lambda self, other: not self >= other)]
+ }
+ roots = set(dir(cls)) & set(convert)
+ if not roots:
+ raise ValueError('must define at least one ordering operation: < > <= >=')
+ root = max(roots) # prefer __lt__ to __le__ to __gt__ to __ge__
+ for opname, opfunc in convert[root]:
+ if opname not in roots:
+ opfunc.__name__ = opname
+ opfunc.__doc__ = getattr(int, opname).__doc__
+ setattr(cls, opname, opfunc)
+ return cls
+
+def cmp_to_key(mycmp):
+ """Convert a cmp= function into a key= function"""
+ class K(object):
+ __slots__ = ['obj']
+ def __init__(self, obj, *args):
+ self.obj = obj
+ def __lt__(self, other):
+ return mycmp(self.obj, other.obj) < 0
+ def __gt__(self, other):
+ return mycmp(self.obj, other.obj) > 0
+ def __eq__(self, other):
+ return mycmp(self.obj, other.obj) == 0
+ def __le__(self, other):
+ return mycmp(self.obj, other.obj) <= 0
+ def __ge__(self, other):
+ return mycmp(self.obj, other.obj) >= 0
+ def __ne__(self, other):
+ return mycmp(self.obj, other.obj) != 0
+ def __hash__(self):
+ raise TypeError('hash not implemented')
+ return K
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
index 0000000000..09d2c45353
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/genericpath.py
@@ -0,0 +1,113 @@
+"""
+Path operations common to more than one OS
+Do not use directly. The OS specific modules import the appropriate
+functions from this module themselves.
+"""
+import os
+import stat
+
+__all__ = ['commonprefix', 'exists', 'getatime', 'getctime', 'getmtime',
+ 'getsize', 'isdir', 'isfile']
+
+
+try:
+ _unicode = unicode
+except NameError:
+ # If Python is built without Unicode support, the unicode type
+ # will not exist. Fake one.
+ class _unicode(object):
+ pass
+
+# Does a path exist?
+# This is false for dangling symbolic links on systems that support them.
+def exists(path):
+ """Test whether a path exists. Returns False for broken symbolic links"""
+ try:
+ os.stat(path)
+ except os.error:
+ return False
+ return True
+
+
+# This follows symbolic links, so both islink() and isdir() can be true
+# for the same path on systems that support symlinks
+def isfile(path):
+ """Test whether a path is a regular file"""
+ try:
+ st = os.stat(path)
+ except os.error:
+ return False
+ return stat.S_ISREG(st.st_mode)
+
+
+# Is a path a directory?
+# This follows symbolic links, so both islink() and isdir()
+# can be true for the same path on systems that support symlinks
+def isdir(s):
+ """Return true if the pathname refers to an existing directory."""
+ try:
+ st = os.stat(s)
+ except os.error:
+ return False
+ return stat.S_ISDIR(st.st_mode)
+
+
+def getsize(filename):
+ """Return the size of a file, reported by os.stat()."""
+ return os.stat(filename).st_size
+
+
+def getmtime(filename):
+ """Return the last modification time of a file, reported by os.stat()."""
+ return os.stat(filename).st_mtime
+
+
+def getatime(filename):
+ """Return the last access time of a file, reported by os.stat()."""
+ return os.stat(filename).st_atime
+
+
+def getctime(filename):
+ """Return the metadata change time of a file, reported by os.stat()."""
+ return os.stat(filename).st_ctime
+
+
+# Return the longest prefix of all list elements.
+def commonprefix(m):
+ "Given a list of pathnames, returns the longest common leading component"
+ if not m: return ''
+ s1 = min(m)
+ s2 = max(m)
+ for i, c in enumerate(s1):
+ if c != s2[i]:
+ return s1[:i]
+ return s1
+
+# Split a path in root and extension.
+# The extension is everything starting at the last dot in the last
+# pathname component; the root is everything before that.
+# It is always true that root + ext == p.
+
+# Generic implementation of splitext, to be parametrized with
+# the separators
+def _splitext(p, sep, altsep, extsep):
+ """Split the extension from a pathname.
+
+ Extension is everything from the last dot to the end, ignoring
+ leading dots. Returns "(root, ext)"; ext may be empty."""
+
+ sepIndex = p.rfind(sep)
+ if altsep:
+ altsepIndex = p.rfind(altsep)
+ sepIndex = max(sepIndex, altsepIndex)
+
+ dotIndex = p.rfind(extsep)
+ if dotIndex > sepIndex:
+ # skip all leading dots
+ filenameIndex = sepIndex + 1
+ while filenameIndex < dotIndex:
+ if p[filenameIndex] != extsep:
+ return p[:dotIndex], p[dotIndex:]
+ filenameIndex += 1
+
+ return p, ''
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
index 0000000000..c6a763a677
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/getopt.py
@@ -0,0 +1,210 @@
+"""Parser for command line options.
+
+This module helps scripts to parse the command line arguments in
+sys.argv. It supports the same conventions as the Unix getopt()
+function (including the special meanings of arguments of the form `-'
+and `--'). Long options similar to those supported by GNU software
+may be used as well via an optional third argument. This module
+provides two functions and an exception:
+
+getopt() -- Parse command line options
+gnu_getopt() -- Like getopt(), but allow option and non-option arguments
+to be intermixed.
+GetoptError -- exception (class) raised with 'opt' attribute, which is the
+option involved with the exception.
+"""
+
+# Long option support added by Lars Wirzenius <liw@iki.fi>.
+#
+# Gerrit Holl <gerrit@nl.linux.org> moved the string-based exceptions
+# to class-based exceptions.
+#
+# Peter Astrand <astrand@lysator.liu.se> added gnu_getopt().
+#
+# TODO for gnu_getopt():
+#
+# - GNU getopt_long_only mechanism
+# - allow the caller to specify ordering
+# - RETURN_IN_ORDER option
+# - GNU extension with '-' as first character of option string
+# - optional arguments, specified by double colons
+# - a option string with a W followed by semicolon should
+# treat "-W foo" as "--foo"
+
+__all__ = ["GetoptError","error","getopt","gnu_getopt"]
+
+import os
+
+class GetoptError(Exception):
+ opt = ''
+ msg = ''
+ def __init__(self, msg, opt=''):
+ self.msg = msg
+ self.opt = opt
+ Exception.__init__(self, msg, opt)
+
+ def __str__(self):
+ return self.msg
+
+error = GetoptError # backward compatibility
+
+def getopt(args, shortopts, longopts = []):
+ """getopt(args, options[, long_options]) -> opts, args
+
+ Parses command line options and parameter list. args is the
+ argument list to be parsed, without the leading reference to the
+ running program. Typically, this means "sys.argv[1:]". shortopts
+ is the string of option letters that the script wants to
+ recognize, with options that require an argument followed by a
+ colon (i.e., the same format that Unix getopt() uses). If
+ specified, longopts is a list of strings with the names of the
+ long options which should be supported. The leading '--'
+ characters should not be included in the option name. Options
+ which require an argument should be followed by an equal sign
+ ('=').
+
+ The return value consists of two elements: the first is a list of
+ (option, value) pairs; the second is the list of program arguments
+ left after the option list was stripped (this is a trailing slice
+ of the first argument). Each option-and-value pair returned has
+ the option as its first element, prefixed with a hyphen (e.g.,
+ '-x'), and the option argument as its second element, or an empty
+ string if the option has no argument. The options occur in the
+ list in the same order in which they were found, thus allowing
+ multiple occurrences. Long and short options may be mixed.
+
+ """
+
+ opts = []
+ if type(longopts) == type(""):
+ longopts = [longopts]
+ else:
+ longopts = list(longopts)
+ while args and args[0].startswith('-') and args[0] != '-':
+ if args[0] == '--':
+ args = args[1:]
+ break
+ if args[0].startswith('--'):
+ opts, args = do_longs(opts, args[0][2:], longopts, args[1:])
+ else:
+ opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:])
+
+ return opts, args
+
+def gnu_getopt(args, shortopts, longopts = []):
+ """getopt(args, options[, long_options]) -> opts, args
+
+ This function works like getopt(), except that GNU style scanning
+ mode is used by default. This means that option and non-option
+ arguments may be intermixed. The getopt() function stops
+ processing options as soon as a non-option argument is
+ encountered.
+
+ If the first character of the option string is `+', or if the
+ environment variable POSIXLY_CORRECT is set, then option
+ processing stops as soon as a non-option argument is encountered.
+
+ """
+
+ opts = []
+ prog_args = []
+ if isinstance(longopts, str):
+ longopts = [longopts]
+ else:
+ longopts = list(longopts)
+
+ # Allow options after non-option arguments?
+ if shortopts.startswith('+'):
+ shortopts = shortopts[1:]
+ all_options_first = True
+ elif os.environ.get("POSIXLY_CORRECT"):
+ all_options_first = True
+ else:
+ all_options_first = False
+
+ while args:
+ if args[0] == '--':
+ prog_args += args[1:]
+ break
+
+ if args[0][:2] == '--':
+ opts, args = do_longs(opts, args[0][2:], longopts, args[1:])
+ elif args[0][:1] == '-' and args[0] != '-':
+ opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:])
+ else:
+ if all_options_first:
+ prog_args += args
+ break
+ else:
+ prog_args.append(args[0])
+ args = args[1:]
+
+ return opts, prog_args
+
+def do_longs(opts, opt, longopts, args):
+ try:
+ i = opt.index('=')
+ except ValueError:
+ optarg = None
+ else:
+ opt, optarg = opt[:i], opt[i+1:]
+
+ has_arg, opt = long_has_args(opt, longopts)
+ if has_arg:
+ if optarg is None:
+ if not args:
+ raise GetoptError('option --%s requires argument' % opt, opt)
+ optarg, args = args[0], args[1:]
+ elif optarg is not None:
+ raise GetoptError('option --%s must not have an argument' % opt, opt)
+ opts.append(('--' + opt, optarg or ''))
+ return opts, args
+
+# Return:
+# has_arg?
+# full option name
+def long_has_args(opt, longopts):
+ possibilities = [o for o in longopts if o.startswith(opt)]
+ if not possibilities:
+ raise GetoptError('option --%s not recognized' % opt, opt)
+ # Is there an exact match?
+ if opt in possibilities:
+ return False, opt
+ elif opt + '=' in possibilities:
+ return True, opt
+ # No exact match, so better be unique.
+ if len(possibilities) > 1:
+ # XXX since possibilities contains all valid continuations, might be
+ # nice to work them into the error msg
+ raise GetoptError('option --%s not a unique prefix' % opt, opt)
+ assert len(possibilities) == 1
+ unique_match = possibilities[0]
+ has_arg = unique_match.endswith('=')
+ if has_arg:
+ unique_match = unique_match[:-1]
+ return has_arg, unique_match
+
+def do_shorts(opts, optstring, shortopts, args):
+ while optstring != '':
+ opt, optstring = optstring[0], optstring[1:]
+ if short_has_arg(opt, shortopts):
+ if optstring == '':
+ if not args:
+ raise GetoptError('option -%s requires argument' % opt,
+ opt)
+ optstring, args = args[0], args[1:]
+ optarg, optstring = optstring, ''
+ else:
+ optarg = ''
+ opts.append(('-' + opt, optarg))
+ return opts, args
+
+def short_has_arg(opt, shortopts):
+ for i in range(len(shortopts)):
+ if opt == shortopts[i] != ':':
+ return shortopts.startswith(':', i+1)
+ raise GetoptError('option -%s not recognized' % opt, opt)
+
+if __name__ == '__main__':
+ import sys
+ print getopt(sys.argv[1:], "a:b", ["alpha=", "beta"])
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
index 0000000000..a531462f57
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/gettext.py
@@ -0,0 +1,594 @@
+"""Internationalization and localization support.
+
+This module provides internationalization (I18N) and localization (L10N)
+support for your Python programs by providing an interface to the GNU gettext
+message catalog library.
+
+I18N refers to the operation by which a program is made aware of multiple
+languages. L10N refers to the adaptation of your program, once
+internationalized, to the local language and cultural habits.
+
+"""
+
+# This module represents the integration of work, contributions, feedback, and
+# suggestions from the following people:
+#
+# Martin von Loewis, who wrote the initial implementation of the underlying
+# C-based libintlmodule (later renamed _gettext), along with a skeletal
+# gettext.py implementation.
+#
+# Peter Funk, who wrote fintl.py, a fairly complete wrapper around intlmodule,
+# which also included a pure-Python implementation to read .mo files if
+# intlmodule wasn't available.
+#
+# James Henstridge, who also wrote a gettext.py module, which has some
+# interesting, but currently unsupported experimental features: the notion of
+# a Catalog class and instances, and the ability to add to a catalog file via
+# a Python API.
+#
+# Barry Warsaw integrated these modules, wrote the .install() API and code,
+# and conformed all C and Python code to Python's coding standards.
+#
+# Francois Pinard and Marc-Andre Lemburg also contributed valuably to this
+# module.
+#
+# J. David Ibanez implemented plural forms. Bruno Haible fixed some bugs.
+#
+# TODO:
+# - Lazy loading of .mo files. Currently the entire catalog is loaded into
+# memory, but that's probably bad for large translated programs. Instead,
+# the lexical sort of original strings in GNU .mo files should be exploited
+# to do binary searches and lazy initializations. Or you might want to use
+# the undocumented double-hash algorithm for .mo files with hash tables, but
+# you'll need to study the GNU gettext code to do this.
+#
+# - Support Solaris .mo file formats. Unfortunately, we've been unable to
+# find this format documented anywhere.
+
+
+import locale, copy, os, re, struct, sys
+from errno import ENOENT
+
+
+__all__ = ['NullTranslations', 'GNUTranslations', 'Catalog',
+ 'find', 'translation', 'install', 'textdomain', 'bindtextdomain',
+ 'bind_textdomain_codeset',
+ 'dgettext', 'dngettext', 'gettext', 'lgettext', 'ldgettext',
+ 'ldngettext', 'lngettext', 'ngettext',
+ ]
+
+_default_localedir = os.path.join(sys.prefix, 'share', 'locale')
+
+
+def test(condition, true, false):
+ """
+ Implements the C expression:
+
+ condition ? true : false
+
+ Required to correctly interpret plural forms.
+ """
+ if condition:
+ return true
+ else:
+ return false
+
+
+def c2py(plural):
+ """Gets a C expression as used in PO files for plural forms and returns a
+ Python lambda function that implements an equivalent expression.
+ """
+ # Security check, allow only the "n" identifier
+ try:
+ from cStringIO import StringIO
+ except ImportError:
+ from StringIO import StringIO
+ import token, tokenize
+ tokens = tokenize.generate_tokens(StringIO(plural).readline)
+ try:
+ danger = [x for x in tokens if x[0] == token.NAME and x[1] != 'n']
+ except tokenize.TokenError:
+ raise ValueError, \
+ 'plural forms expression error, maybe unbalanced parenthesis'
+ else:
+ if danger:
+ raise ValueError, 'plural forms expression could be dangerous'
+
+ # Replace some C operators by their Python equivalents
+ plural = plural.replace('&&', ' and ')
+ plural = plural.replace('||', ' or ')
+
+ expr = re.compile(r'\!([^=])')
+ plural = expr.sub(' not \\1', plural)
+
+ # Regular expression and replacement function used to transform
+ # "a?b:c" to "test(a,b,c)".
+ expr = re.compile(r'(.*?)\?(.*?):(.*)')
+ def repl(x):
+ return "test(%s, %s, %s)" % (x.group(1), x.group(2),
+ expr.sub(repl, x.group(3)))
+
+ # Code to transform the plural expression, taking care of parentheses
+ stack = ['']
+ for c in plural:
+ if c == '(':
+ stack.append('')
+ elif c == ')':
+ if len(stack) == 1:
+ # Actually, we never reach this code, because unbalanced
+ # parentheses get caught in the security check at the
+ # beginning.
+ raise ValueError, 'unbalanced parenthesis in plural form'
+ s = expr.sub(repl, stack.pop())
+ stack[-1] += '(%s)' % s
+ else:
+ stack[-1] += c
+ plural = expr.sub(repl, stack.pop())
+
+ return eval('lambda n: int(%s)' % plural)
+
+
+
+def _expand_lang(locale):
+ from locale import normalize
+ locale = normalize(locale)
+ COMPONENT_CODESET = 1 << 0
+ COMPONENT_TERRITORY = 1 << 1
+ COMPONENT_MODIFIER = 1 << 2
+ # split up the locale into its base components
+ mask = 0
+ pos = locale.find('@')
+ if pos >= 0:
+ modifier = locale[pos:]
+ locale = locale[:pos]
+ mask |= COMPONENT_MODIFIER
+ else:
+ modifier = ''
+ pos = locale.find('.')
+ if pos >= 0:
+ codeset = locale[pos:]
+ locale = locale[:pos]
+ mask |= COMPONENT_CODESET
+ else:
+ codeset = ''
+ pos = locale.find('_')
+ if pos >= 0:
+ territory = locale[pos:]
+ locale = locale[:pos]
+ mask |= COMPONENT_TERRITORY
+ else:
+ territory = ''
+ language = locale
+ ret = []
+ for i in range(mask+1):
+ if not (i & ~mask): # if all components for this combo exist ...
+ val = language
+ if i & COMPONENT_TERRITORY: val += territory
+ if i & COMPONENT_CODESET: val += codeset
+ if i & COMPONENT_MODIFIER: val += modifier
+ ret.append(val)
+ ret.reverse()
+ return ret
+
+
+
+class NullTranslations:
+ def __init__(self, fp=None):
+ self._info = {}
+ self._charset = None
+ self._output_charset = None
+ self._fallback = None
+ if fp is not None:
+ self._parse(fp)
+
+ def _parse(self, fp):
+ pass
+
+ def add_fallback(self, fallback):
+ if self._fallback:
+ self._fallback.add_fallback(fallback)
+ else:
+ self._fallback = fallback
+
+ def gettext(self, message):
+ if self._fallback:
+ return self._fallback.gettext(message)
+ return message
+
+ def lgettext(self, message):
+ if self._fallback:
+ return self._fallback.lgettext(message)
+ return message
+
+ def ngettext(self, msgid1, msgid2, n):
+ if self._fallback:
+ return self._fallback.ngettext(msgid1, msgid2, n)
+ if n == 1:
+ return msgid1
+ else:
+ return msgid2
+
+ def lngettext(self, msgid1, msgid2, n):
+ if self._fallback:
+ return self._fallback.lngettext(msgid1, msgid2, n)
+ if n == 1:
+ return msgid1
+ else:
+ return msgid2
+
+ def ugettext(self, message):
+ if self._fallback:
+ return self._fallback.ugettext(message)
+ return unicode(message)
+
+ def ungettext(self, msgid1, msgid2, n):
+ if self._fallback:
+ return self._fallback.ungettext(msgid1, msgid2, n)
+ if n == 1:
+ return unicode(msgid1)
+ else:
+ return unicode(msgid2)
+
+ def info(self):
+ return self._info
+
+ def charset(self):
+ return self._charset
+
+ def output_charset(self):
+ return self._output_charset
+
+ def set_output_charset(self, charset):
+ self._output_charset = charset
+
+ def install(self, unicode=False, names=None):
+ import __builtin__
+ __builtin__.__dict__['_'] = unicode and self.ugettext or self.gettext
+ if hasattr(names, "__contains__"):
+ if "gettext" in names:
+ __builtin__.__dict__['gettext'] = __builtin__.__dict__['_']
+ if "ngettext" in names:
+ __builtin__.__dict__['ngettext'] = (unicode and self.ungettext
+ or self.ngettext)
+ if "lgettext" in names:
+ __builtin__.__dict__['lgettext'] = self.lgettext
+ if "lngettext" in names:
+ __builtin__.__dict__['lngettext'] = self.lngettext
+
+
+class GNUTranslations(NullTranslations):
+ # Magic number of .mo files
+ LE_MAGIC = 0x950412deL
+ BE_MAGIC = 0xde120495L
+
+ def _parse(self, fp):
+ """Override this method to support alternative .mo formats."""
+ unpack = struct.unpack
+ filename = getattr(fp, 'name', '')
+ # Parse the .mo file header, which consists of 5 little endian 32
+ # bit words.
+ self._catalog = catalog = {}
+ self.plural = lambda n: int(n != 1) # germanic plural by default
+ buf = fp.read()
+ buflen = len(buf)
+ # Are we big endian or little endian?
+ magic = unpack('<I', buf[:4])[0]
+ if magic == self.LE_MAGIC:
+ version, msgcount, masteridx, transidx = unpack('<4I', buf[4:20])
+ ii = '<II'
+ elif magic == self.BE_MAGIC:
+ version, msgcount, masteridx, transidx = unpack('>4I', buf[4:20])
+ ii = '>II'
+ else:
+ raise IOError(0, 'Bad magic number', filename)
+ # Now put all messages from the .mo file buffer into the catalog
+ # dictionary.
+ for i in xrange(0, msgcount):
+ mlen, moff = unpack(ii, buf[masteridx:masteridx+8])
+ mend = moff + mlen
+ tlen, toff = unpack(ii, buf[transidx:transidx+8])
+ tend = toff + tlen
+ if mend < buflen and tend < buflen:
+ msg = buf[moff:mend]
+ tmsg = buf[toff:tend]
+ else:
+ raise IOError(0, 'File is corrupt', filename)
+ # See if we're looking at GNU .mo conventions for metadata
+ if mlen == 0:
+ # Catalog description
+ lastk = None
+ for item in tmsg.splitlines():
+ item = item.strip()
+ if not item:
+ continue
+ k = v = None
+ if ':' in item:
+ k, v = item.split(':', 1)
+ k = k.strip().lower()
+ v = v.strip()
+ self._info[k] = v
+ lastk = k
+ elif lastk:
+ self._info[lastk] += '\n' + item
+ if k == 'content-type':
+ self._charset = v.split('charset=')[1]
+ elif k == 'plural-forms':
+ v = v.split(';')
+ plural = v[1].split('plural=')[1]
+ self.plural = c2py(plural)
+ # Note: we unconditionally convert both msgids and msgstrs to
+ # Unicode using the character encoding specified in the charset
+ # parameter of the Content-Type header. The gettext documentation
+ # strongly encourages msgids to be us-ascii, but some applications
+ # require alternative encodings (e.g. Zope's ZCML and ZPT). For
+ # traditional gettext applications, the msgid conversion will
+ # cause no problems since us-ascii should always be a subset of
+ # the charset encoding. We may want to fall back to 8-bit msgids
+ # if the Unicode conversion fails.
+ if '\x00' in msg:
+ # Plural forms
+ msgid1, msgid2 = msg.split('\x00')
+ tmsg = tmsg.split('\x00')
+ if self._charset:
+ msgid1 = unicode(msgid1, self._charset)
+ tmsg = [unicode(x, self._charset) for x in tmsg]
+ for i in range(len(tmsg)):
+ catalog[(msgid1, i)] = tmsg[i]
+ else:
+ if self._charset:
+ msg = unicode(msg, self._charset)
+ tmsg = unicode(tmsg, self._charset)
+ catalog[msg] = tmsg
+ # advance to next entry in the seek tables
+ masteridx += 8
+ transidx += 8
+
+ def gettext(self, message):
+ missing = object()
+ tmsg = self._catalog.get(message, missing)
+ if tmsg is missing:
+ if self._fallback:
+ return self._fallback.gettext(message)
+ return message
+ # Encode the Unicode tmsg back to an 8-bit string, if possible
+ if self._output_charset:
+ return tmsg.encode(self._output_charset)
+ elif self._charset:
+ return tmsg.encode(self._charset)
+ return tmsg
+
+ def lgettext(self, message):
+ missing = object()
+ tmsg = self._catalog.get(message, missing)
+ if tmsg is missing:
+ if self._fallback:
+ return self._fallback.lgettext(message)
+ return message
+ if self._output_charset:
+ return tmsg.encode(self._output_charset)
+ return tmsg.encode(locale.getpreferredencoding())
+
+ def ngettext(self, msgid1, msgid2, n):
+ try:
+ tmsg = self._catalog[(msgid1, self.plural(n))]
+ if self._output_charset:
+ return tmsg.encode(self._output_charset)
+ elif self._charset:
+ return tmsg.encode(self._charset)
+ return tmsg
+ except KeyError:
+ if self._fallback:
+ return self._fallback.ngettext(msgid1, msgid2, n)
+ if n == 1:
+ return msgid1
+ else:
+ return msgid2
+
+ def lngettext(self, msgid1, msgid2, n):
+ try:
+ tmsg = self._catalog[(msgid1, self.plural(n))]
+ if self._output_charset:
+ return tmsg.encode(self._output_charset)
+ return tmsg.encode(locale.getpreferredencoding())
+ except KeyError:
+ if self._fallback:
+ return self._fallback.lngettext(msgid1, msgid2, n)
+ if n == 1:
+ return msgid1
+ else:
+ return msgid2
+
+ def ugettext(self, message):
+ missing = object()
+ tmsg = self._catalog.get(message, missing)
+ if tmsg is missing:
+ if self._fallback:
+ return self._fallback.ugettext(message)
+ return unicode(message)
+ return tmsg
+
+ def ungettext(self, msgid1, msgid2, n):
+ try:
+ tmsg = self._catalog[(msgid1, self.plural(n))]
+ except KeyError:
+ if self._fallback:
+ return self._fallback.ungettext(msgid1, msgid2, n)
+ if n == 1:
+ tmsg = unicode(msgid1)
+ else:
+ tmsg = unicode(msgid2)
+ return tmsg
+
+
+# Locate a .mo file using the gettext strategy
+def find(domain, localedir=None, languages=None, all=0):
+ # Get some reasonable defaults for arguments that were not supplied
+ if localedir is None:
+ localedir = _default_localedir
+ if languages is None:
+ languages = []
+ for envar in ('LANGUAGE', 'LC_ALL', 'LC_MESSAGES', 'LANG'):
+ val = os.environ.get(envar)
+ if val:
+ languages = val.split(':')
+ break
+ if 'C' not in languages:
+ languages.append('C')
+ # now normalize and expand the languages
+ nelangs = []
+ for lang in languages:
+ for nelang in _expand_lang(lang):
+ if nelang not in nelangs:
+ nelangs.append(nelang)
+ # select a language
+ if all:
+ result = []
+ else:
+ result = None
+ for lang in nelangs:
+ if lang == 'C':
+ break
+ mofile = os.path.join(localedir, lang, 'LC_MESSAGES', '%s.mo' % domain)
+ if os.path.exists(mofile):
+ if all:
+ result.append(mofile)
+ else:
+ return mofile
+ return result
+
+
+
+# a mapping between absolute .mo file path and Translation object
+_translations = {}
+
+def translation(domain, localedir=None, languages=None,
+ class_=None, fallback=False, codeset=None):
+ if class_ is None:
+ class_ = GNUTranslations
+ mofiles = find(domain, localedir, languages, all=1)
+ if not mofiles:
+ if fallback:
+ return NullTranslations()
+ raise IOError(ENOENT, 'No translation file found for domain', domain)
+ # Avoid opening, reading, and parsing the .mo file after it's been done
+ # once.
+ result = None
+ for mofile in mofiles:
+ key = (class_, os.path.abspath(mofile))
+ t = _translations.get(key)
+ if t is None:
+ with open(mofile, 'rb') as fp:
+ t = _translations.setdefault(key, class_(fp))
+ # Copy the translation object to allow setting fallbacks and
+ # output charset. All other instance data is shared with the
+ # cached object.
+ t = copy.copy(t)
+ if codeset:
+ t.set_output_charset(codeset)
+ if result is None:
+ result = t
+ else:
+ result.add_fallback(t)
+ return result
+
+
+def install(domain, localedir=None, unicode=False, codeset=None, names=None):
+ t = translation(domain, localedir, fallback=True, codeset=codeset)
+ t.install(unicode, names)
+
+
+
+# a mapping b/w domains and locale directories
+_localedirs = {}
+# a mapping b/w domains and codesets
+_localecodesets = {}
+# current global domain, `messages' used for compatibility w/ GNU gettext
+_current_domain = 'messages'
+
+
+def textdomain(domain=None):
+ global _current_domain
+ if domain is not None:
+ _current_domain = domain
+ return _current_domain
+
+
+def bindtextdomain(domain, localedir=None):
+ global _localedirs
+ if localedir is not None:
+ _localedirs[domain] = localedir
+ return _localedirs.get(domain, _default_localedir)
+
+
+def bind_textdomain_codeset(domain, codeset=None):
+ global _localecodesets
+ if codeset is not None:
+ _localecodesets[domain] = codeset
+ return _localecodesets.get(domain)
+
+
+def dgettext(domain, message):
+ try:
+ t = translation(domain, _localedirs.get(domain, None),
+ codeset=_localecodesets.get(domain))
+ except IOError:
+ return message
+ return t.gettext(message)
+
+def ldgettext(domain, message):
+ try:
+ t = translation(domain, _localedirs.get(domain, None),
+ codeset=_localecodesets.get(domain))
+ except IOError:
+ return message
+ return t.lgettext(message)
+
+def dngettext(domain, msgid1, msgid2, n):
+ try:
+ t = translation(domain, _localedirs.get(domain, None),
+ codeset=_localecodesets.get(domain))
+ except IOError:
+ if n == 1:
+ return msgid1
+ else:
+ return msgid2
+ return t.ngettext(msgid1, msgid2, n)
+
+def ldngettext(domain, msgid1, msgid2, n):
+ try:
+ t = translation(domain, _localedirs.get(domain, None),
+ codeset=_localecodesets.get(domain))
+ except IOError:
+ if n == 1:
+ return msgid1
+ else:
+ return msgid2
+ return t.lngettext(msgid1, msgid2, n)
+
+def gettext(message):
+ return dgettext(_current_domain, message)
+
+def lgettext(message):
+ return ldgettext(_current_domain, message)
+
+def ngettext(msgid1, msgid2, n):
+ return dngettext(_current_domain, msgid1, msgid2, n)
+
+def lngettext(msgid1, msgid2, n):
+ return ldngettext(_current_domain, msgid1, msgid2, n)
+
+# dcgettext() has been deemed unnecessary and is not implemented.
+
+# James Henstridge's Catalog constructor from GNOME gettext. Documented usage
+# was:
+#
+# import gettext
+# cat = gettext.Catalog(PACKAGE, localedir=LOCALEDIR)
+# _ = cat.gettext
+# print _('Hello World')
+
+# The resulting catalog object currently don't support access through a
+# dictionary API, which was supported (but apparently unused) in GNOME
+# gettext.
+
+Catalog = translation
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
index 0000000000..d723f2066e
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/hashlib.py
@@ -0,0 +1,221 @@
+# $Id$
+#
+# Copyright (C) 2005 Gregory P. Smith (greg@krypto.org)
+# Licensed to PSF under a Contributor Agreement.
+#
+
+__doc__ = """hashlib module - A common interface to many hash functions.
+
+new(name, string='') - returns a new hash object implementing the
+ given hash function; initializing the hash
+ using the given string data.
+
+Named constructor functions are also available, these are much faster
+than using new():
+
+md5(), sha1(), sha224(), sha256(), sha384(), and sha512()
+
+More algorithms may be available on your platform but the above are guaranteed
+to exist. See the algorithms_guaranteed and algorithms_available attributes
+to find out what algorithm names can be passed to new().
+
+NOTE: If you want the adler32 or crc32 hash functions they are available in
+the zlib module.
+
+Choose your hash function wisely. Some have known collision weaknesses.
+sha384 and sha512 will be slow on 32 bit platforms.
+
+Hash objects have these methods:
+ - update(arg): Update the hash object with the string arg. Repeated calls
+ are equivalent to a single call with the concatenation of all
+ the arguments.
+ - digest(): Return the digest of the strings passed to the update() method
+ so far. This may contain non-ASCII characters, including
+ NUL bytes.
+ - hexdigest(): Like digest() except the digest is returned as a string of
+ double length, containing only hexadecimal digits.
+ - copy(): Return a copy (clone) of the hash object. This can be used to
+ efficiently compute the digests of strings that share a common
+ initial substring.
+
+For example, to obtain the digest of the string 'Nobody inspects the
+spammish repetition':
+
+ >>> import hashlib
+ >>> m = hashlib.md5()
+ >>> m.update("Nobody inspects")
+ >>> m.update(" the spammish repetition")
+ >>> m.digest()
+ '\\xbbd\\x9c\\x83\\xdd\\x1e\\xa5\\xc9\\xd9\\xde\\xc9\\xa1\\x8d\\xf0\\xff\\xe9'
+
+More condensed:
+
+ >>> hashlib.sha224("Nobody inspects the spammish repetition").hexdigest()
+ 'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2'
+
+"""
+
+# This tuple and __get_builtin_constructor() must be modified if a new
+# always available algorithm is added.
+__always_supported = ('md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512')
+
+algorithms_guaranteed = set(__always_supported)
+algorithms_available = set(__always_supported)
+
+algorithms = __always_supported
+
+__all__ = __always_supported + ('new', 'algorithms_guaranteed',
+ 'algorithms_available', 'algorithms',
+ 'pbkdf2_hmac')
+
+
+def __get_builtin_constructor(name):
+ try:
+ if name in ('SHA1', 'sha1'):
+ import _sha
+ return _sha.new
+ elif name in ('MD5', 'md5'):
+ import _md5
+ return _md5.new
+ elif name in ('SHA256', 'sha256', 'SHA224', 'sha224'):
+ import _sha256
+ bs = name[3:]
+ if bs == '256':
+ return _sha256.sha256
+ elif bs == '224':
+ return _sha256.sha224
+ elif name in ('SHA512', 'sha512', 'SHA384', 'sha384'):
+ import _sha512
+ bs = name[3:]
+ if bs == '512':
+ return _sha512.sha512
+ elif bs == '384':
+ return _sha512.sha384
+ except ImportError:
+ pass # no extension module, this hash is unsupported.
+
+ raise ValueError('unsupported hash type ' + name)
+
+
+def __get_openssl_constructor(name):
+ try:
+ f = getattr(_hashlib, 'openssl_' + name)
+ # Allow the C module to raise ValueError. The function will be
+ # defined but the hash not actually available thanks to OpenSSL.
+ f()
+ # Use the C function directly (very fast)
+ return f
+ except (AttributeError, ValueError):
+ return __get_builtin_constructor(name)
+
+
+def __py_new(name, string=''):
+ """new(name, string='') - Return a new hashing object using the named algorithm;
+ optionally initialized with a string.
+ """
+ return __get_builtin_constructor(name)(string)
+
+
+def __hash_new(name, string=''):
+ """new(name, string='') - Return a new hashing object using the named algorithm;
+ optionally initialized with a string.
+ """
+ try:
+ return _hashlib.new(name, string)
+ except ValueError:
+ # If the _hashlib module (OpenSSL) doesn't support the named
+ # hash, try using our builtin implementations.
+ # This allows for SHA224/256 and SHA384/512 support even though
+ # the OpenSSL library prior to 0.9.8 doesn't provide them.
+ return __get_builtin_constructor(name)(string)
+
+
+try:
+ import _hashlib
+ new = __hash_new
+ __get_hash = __get_openssl_constructor
+ algorithms_available = algorithms_available.union(
+ _hashlib.openssl_md_meth_names)
+except ImportError:
+ new = __py_new
+ __get_hash = __get_builtin_constructor
+
+for __func_name in __always_supported:
+ # try them all, some may not work due to the OpenSSL
+ # version not supporting that algorithm.
+ try:
+ globals()[__func_name] = __get_hash(__func_name)
+ except ValueError:
+ import logging
+ logging.exception('code for hash %s was not found.', __func_name)
+
+
+try:
+ # OpenSSL's PKCS5_PBKDF2_HMAC requires OpenSSL 1.0+ with HMAC and SHA
+ from _hashlib import pbkdf2_hmac
+except ImportError:
+ import binascii
+ import struct
+
+ _trans_5C = b"".join(chr(x ^ 0x5C) for x in range(256))
+ _trans_36 = b"".join(chr(x ^ 0x36) for x in range(256))
+
+ def pbkdf2_hmac(hash_name, password, salt, iterations, dklen=None):
+ """Password based key derivation function 2 (PKCS #5 v2.0)
+
+ This Python implementations based on the hmac module about as fast
+ as OpenSSL's PKCS5_PBKDF2_HMAC for short passwords and much faster
+ for long passwords.
+ """
+ if not isinstance(hash_name, str):
+ raise TypeError(hash_name)
+
+ if not isinstance(password, (bytes, bytearray)):
+ password = bytes(buffer(password))
+ if not isinstance(salt, (bytes, bytearray)):
+ salt = bytes(buffer(salt))
+
+ # Fast inline HMAC implementation
+ inner = new(hash_name)
+ outer = new(hash_name)
+ blocksize = getattr(inner, 'block_size', 64)
+ if len(password) > blocksize:
+ password = new(hash_name, password).digest()
+ password = password + b'\x00' * (blocksize - len(password))
+ inner.update(password.translate(_trans_36))
+ outer.update(password.translate(_trans_5C))
+
+ def prf(msg, inner=inner, outer=outer):
+ # PBKDF2_HMAC uses the password as key. We can re-use the same
+ # digest objects and just update copies to skip initialization.
+ icpy = inner.copy()
+ ocpy = outer.copy()
+ icpy.update(msg)
+ ocpy.update(icpy.digest())
+ return ocpy.digest()
+
+ if iterations < 1:
+ raise ValueError(iterations)
+ if dklen is None:
+ dklen = outer.digest_size
+ if dklen < 1:
+ raise ValueError(dklen)
+
+ hex_format_string = "%%0%ix" % (new(hash_name).digest_size * 2)
+
+ dkey = b''
+ loop = 1
+ while len(dkey) < dklen:
+ prev = prf(salt + struct.pack(b'>I', loop))
+ rkey = int(binascii.hexlify(prev), 16)
+ for i in xrange(iterations - 1):
+ prev = prf(prev)
+ rkey ^= int(binascii.hexlify(prev), 16)
+ loop += 1
+ dkey += binascii.unhexlify(hex_format_string % rkey)
+
+ return dkey[:dklen]
+
+# Cleanup locals()
+del __always_supported, __func_name, __get_hash
+del __py_new, __hash_new, __get_openssl_constructor
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
index 0000000000..f87e9eeacf
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/heapq.py
@@ -0,0 +1,485 @@
+# -*- coding: latin-1 -*-
+
+"""Heap queue algorithm (a.k.a. priority queue).
+
+Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
+all k, counting elements from 0. For the sake of comparison,
+non-existing elements are considered to be infinite. The interesting
+property of a heap is that a[0] is always its smallest element.
+
+Usage:
+
+heap = [] # creates an empty heap
+heappush(heap, item) # pushes a new item on the heap
+item = heappop(heap) # pops the smallest item from the heap
+item = heap[0] # smallest item on the heap without popping it
+heapify(x) # transforms list into a heap, in-place, in linear time
+item = heapreplace(heap, item) # pops and returns smallest item, and adds
+ # new item; the heap size is unchanged
+
+Our API differs from textbook heap algorithms as follows:
+
+- We use 0-based indexing. This makes the relationship between the
+ index for a node and the indexes for its children slightly less
+ obvious, but is more suitable since Python uses 0-based indexing.
+
+- Our heappop() method returns the smallest item, not the largest.
+
+These two make it possible to view the heap as a regular Python list
+without surprises: heap[0] is the smallest item, and heap.sort()
+maintains the heap invariant!
+"""
+
+# Original code by Kevin O'Connor, augmented by Tim Peters and Raymond Hettinger
+
+__about__ = """Heap queues
+
+[explanation by François Pinard]
+
+Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for
+all k, counting elements from 0. For the sake of comparison,
+non-existing elements are considered to be infinite. The interesting
+property of a heap is that a[0] is always its smallest element.
+
+The strange invariant above is meant to be an efficient memory
+representation for a tournament. The numbers below are `k', not a[k]:
+
+ 0
+
+ 1 2
+
+ 3 4 5 6
+
+ 7 8 9 10 11 12 13 14
+
+ 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
+
+
+In the tree above, each cell `k' is topping `2*k+1' and `2*k+2'. In
+an usual binary tournament we see in sports, each cell is the winner
+over the two cells it tops, and we can trace the winner down the tree
+to see all opponents s/he had. However, in many computer applications
+of such tournaments, we do not need to trace the history of a winner.
+To be more memory efficient, when a winner is promoted, we try to
+replace it by something else at a lower level, and the rule becomes
+that a cell and the two cells it tops contain three different items,
+but the top cell "wins" over the two topped cells.
+
+If this heap invariant is protected at all time, index 0 is clearly
+the overall winner. The simplest algorithmic way to remove it and
+find the "next" winner is to move some loser (let's say cell 30 in the
+diagram above) into the 0 position, and then percolate this new 0 down
+the tree, exchanging values, until the invariant is re-established.
+This is clearly logarithmic on the total number of items in the tree.
+By iterating over all items, you get an O(n ln n) sort.
+
+A nice feature of this sort is that you can efficiently insert new
+items while the sort is going on, provided that the inserted items are
+not "better" than the last 0'th element you extracted. This is
+especially useful in simulation contexts, where the tree holds all
+incoming events, and the "win" condition means the smallest scheduled
+time. When an event schedule other events for execution, they are
+scheduled into the future, so they can easily go into the heap. So, a
+heap is a good structure for implementing schedulers (this is what I
+used for my MIDI sequencer :-).
+
+Various structures for implementing schedulers have been extensively
+studied, and heaps are good for this, as they are reasonably speedy,
+the speed is almost constant, and the worst case is not much different
+than the average case. However, there are other representations which
+are more efficient overall, yet the worst cases might be terrible.
+
+Heaps are also very useful in big disk sorts. You most probably all
+know that a big sort implies producing "runs" (which are pre-sorted
+sequences, which size is usually related to the amount of CPU memory),
+followed by a merging passes for these runs, which merging is often
+very cleverly organised[1]. It is very important that the initial
+sort produces the longest runs possible. Tournaments are a good way
+to that. If, using all the memory available to hold a tournament, you
+replace and percolate items that happen to fit the current run, you'll
+produce runs which are twice the size of the memory for random input,
+and much better for input fuzzily ordered.
+
+Moreover, if you output the 0'th item on disk and get an input which
+may not fit in the current tournament (because the value "wins" over
+the last output value), it cannot fit in the heap, so the size of the
+heap decreases. The freed memory could be cleverly reused immediately
+for progressively building a second heap, which grows at exactly the
+same rate the first heap is melting. When the first heap completely
+vanishes, you switch heaps and start a new run. Clever and quite
+effective!
+
+In a word, heaps are useful memory structures to know. I use them in
+a few applications, and I think it is good to keep a `heap' module
+around. :-)
+
+--------------------
+[1] The disk balancing algorithms which are current, nowadays, are
+more annoying than clever, and this is a consequence of the seeking
+capabilities of the disks. On devices which cannot seek, like big
+tape drives, the story was quite different, and one had to be very
+clever to ensure (far in advance) that each tape movement will be the
+most effective possible (that is, will best participate at
+"progressing" the merge). Some tapes were even able to read
+backwards, and this was also used to avoid the rewinding time.
+Believe me, real good tape sorts were quite spectacular to watch!
+From all times, sorting has always been a Great Art! :-)
+"""
+
+__all__ = ['heappush', 'heappop', 'heapify', 'heapreplace', 'merge',
+ 'nlargest', 'nsmallest', 'heappushpop']
+
+from itertools import islice, count, imap, izip, tee, chain
+from operator import itemgetter
+
+def cmp_lt(x, y):
+ # Use __lt__ if available; otherwise, try __le__.
+ # In Py3.x, only __lt__ will be called.
+ return (x < y) if hasattr(x, '__lt__') else (not y <= x)
+
+def heappush(heap, item):
+ """Push item onto heap, maintaining the heap invariant."""
+ heap.append(item)
+ _siftdown(heap, 0, len(heap)-1)
+
+def heappop(heap):
+ """Pop the smallest item off the heap, maintaining the heap invariant."""
+ lastelt = heap.pop() # raises appropriate IndexError if heap is empty
+ if heap:
+ returnitem = heap[0]
+ heap[0] = lastelt
+ _siftup(heap, 0)
+ else:
+ returnitem = lastelt
+ return returnitem
+
+def heapreplace(heap, item):
+ """Pop and return the current smallest value, and add the new item.
+
+ This is more efficient than heappop() followed by heappush(), and can be
+ more appropriate when using a fixed-size heap. Note that the value
+ returned may be larger than item! That constrains reasonable uses of
+ this routine unless written as part of a conditional replacement:
+
+ if item > heap[0]:
+ item = heapreplace(heap, item)
+ """
+ returnitem = heap[0] # raises appropriate IndexError if heap is empty
+ heap[0] = item
+ _siftup(heap, 0)
+ return returnitem
+
+def heappushpop(heap, item):
+ """Fast version of a heappush followed by a heappop."""
+ if heap and cmp_lt(heap[0], item):
+ item, heap[0] = heap[0], item
+ _siftup(heap, 0)
+ return item
+
+def heapify(x):
+ """Transform list into a heap, in-place, in O(len(x)) time."""
+ n = len(x)
+ # Transform bottom-up. The largest index there's any point to looking at
+ # is the largest with a child index in-range, so must have 2*i + 1 < n,
+ # or i < (n-1)/2. If n is even = 2*j, this is (2*j-1)/2 = j-1/2 so
+ # j-1 is the largest, which is n//2 - 1. If n is odd = 2*j+1, this is
+ # (2*j+1-1)/2 = j so j-1 is the largest, and that's again n//2-1.
+ for i in reversed(xrange(n//2)):
+ _siftup(x, i)
+
+def _heappushpop_max(heap, item):
+ """Maxheap version of a heappush followed by a heappop."""
+ if heap and cmp_lt(item, heap[0]):
+ item, heap[0] = heap[0], item
+ _siftup_max(heap, 0)
+ return item
+
+def _heapify_max(x):
+ """Transform list into a maxheap, in-place, in O(len(x)) time."""
+ n = len(x)
+ for i in reversed(range(n//2)):
+ _siftup_max(x, i)
+
+def nlargest(n, iterable):
+ """Find the n largest elements in a dataset.
+
+ Equivalent to: sorted(iterable, reverse=True)[:n]
+ """
+ if n < 0:
+ return []
+ it = iter(iterable)
+ result = list(islice(it, n))
+ if not result:
+ return result
+ heapify(result)
+ _heappushpop = heappushpop
+ for elem in it:
+ _heappushpop(result, elem)
+ result.sort(reverse=True)
+ return result
+
+def nsmallest(n, iterable):
+ """Find the n smallest elements in a dataset.
+
+ Equivalent to: sorted(iterable)[:n]
+ """
+ if n < 0:
+ return []
+ it = iter(iterable)
+ result = list(islice(it, n))
+ if not result:
+ return result
+ _heapify_max(result)
+ _heappushpop = _heappushpop_max
+ for elem in it:
+ _heappushpop(result, elem)
+ result.sort()
+ return result
+
+# 'heap' is a heap at all indices >= startpos, except possibly for pos. pos
+# is the index of a leaf with a possibly out-of-order value. Restore the
+# heap invariant.
+def _siftdown(heap, startpos, pos):
+ newitem = heap[pos]
+ # Follow the path to the root, moving parents down until finding a place
+ # newitem fits.
+ while pos > startpos:
+ parentpos = (pos - 1) >> 1
+ parent = heap[parentpos]
+ if cmp_lt(newitem, parent):
+ heap[pos] = parent
+ pos = parentpos
+ continue
+ break
+ heap[pos] = newitem
+
+# The child indices of heap index pos are already heaps, and we want to make
+# a heap at index pos too. We do this by bubbling the smaller child of
+# pos up (and so on with that child's children, etc) until hitting a leaf,
+# then using _siftdown to move the oddball originally at index pos into place.
+#
+# We *could* break out of the loop as soon as we find a pos where newitem <=
+# both its children, but turns out that's not a good idea, and despite that
+# many books write the algorithm that way. During a heap pop, the last array
+# element is sifted in, and that tends to be large, so that comparing it
+# against values starting from the root usually doesn't pay (= usually doesn't
+# get us out of the loop early). See Knuth, Volume 3, where this is
+# explained and quantified in an exercise.
+#
+# Cutting the # of comparisons is important, since these routines have no
+# way to extract "the priority" from an array element, so that intelligence
+# is likely to be hiding in custom __cmp__ methods, or in array elements
+# storing (priority, record) tuples. Comparisons are thus potentially
+# expensive.
+#
+# On random arrays of length 1000, making this change cut the number of
+# comparisons made by heapify() a little, and those made by exhaustive
+# heappop() a lot, in accord with theory. Here are typical results from 3
+# runs (3 just to demonstrate how small the variance is):
+#
+# Compares needed by heapify Compares needed by 1000 heappops
+# -------------------------- --------------------------------
+# 1837 cut to 1663 14996 cut to 8680
+# 1855 cut to 1659 14966 cut to 8678
+# 1847 cut to 1660 15024 cut to 8703
+#
+# Building the heap by using heappush() 1000 times instead required
+# 2198, 2148, and 2219 compares: heapify() is more efficient, when
+# you can use it.
+#
+# The total compares needed by list.sort() on the same lists were 8627,
+# 8627, and 8632 (this should be compared to the sum of heapify() and
+# heappop() compares): list.sort() is (unsurprisingly!) more efficient
+# for sorting.
+
+def _siftup(heap, pos):
+ endpos = len(heap)
+ startpos = pos
+ newitem = heap[pos]
+ # Bubble up the smaller child until hitting a leaf.
+ childpos = 2*pos + 1 # leftmost child position
+ while childpos < endpos:
+ # Set childpos to index of smaller child.
+ rightpos = childpos + 1
+ if rightpos < endpos and not cmp_lt(heap[childpos], heap[rightpos]):
+ childpos = rightpos
+ # Move the smaller child up.
+ heap[pos] = heap[childpos]
+ pos = childpos
+ childpos = 2*pos + 1
+ # The leaf at pos is empty now. Put newitem there, and bubble it up
+ # to its final resting place (by sifting its parents down).
+ heap[pos] = newitem
+ _siftdown(heap, startpos, pos)
+
+def _siftdown_max(heap, startpos, pos):
+ 'Maxheap variant of _siftdown'
+ newitem = heap[pos]
+ # Follow the path to the root, moving parents down until finding a place
+ # newitem fits.
+ while pos > startpos:
+ parentpos = (pos - 1) >> 1
+ parent = heap[parentpos]
+ if cmp_lt(parent, newitem):
+ heap[pos] = parent
+ pos = parentpos
+ continue
+ break
+ heap[pos] = newitem
+
+def _siftup_max(heap, pos):
+ 'Maxheap variant of _siftup'
+ endpos = len(heap)
+ startpos = pos
+ newitem = heap[pos]
+ # Bubble up the larger child until hitting a leaf.
+ childpos = 2*pos + 1 # leftmost child position
+ while childpos < endpos:
+ # Set childpos to index of larger child.
+ rightpos = childpos + 1
+ if rightpos < endpos and not cmp_lt(heap[rightpos], heap[childpos]):
+ childpos = rightpos
+ # Move the larger child up.
+ heap[pos] = heap[childpos]
+ pos = childpos
+ childpos = 2*pos + 1
+ # The leaf at pos is empty now. Put newitem there, and bubble it up
+ # to its final resting place (by sifting its parents down).
+ heap[pos] = newitem
+ _siftdown_max(heap, startpos, pos)
+
+# If available, use C implementation
+try:
+ from _heapq import *
+except ImportError:
+ pass
+
+def merge(*iterables):
+ '''Merge multiple sorted inputs into a single sorted output.
+
+ Similar to sorted(itertools.chain(*iterables)) but returns a generator,
+ does not pull the data into memory all at once, and assumes that each of
+ the input streams is already sorted (smallest to largest).
+
+ >>> list(merge([1,3,5,7], [0,2,4,8], [5,10,15,20], [], [25]))
+ [0, 1, 2, 3, 4, 5, 5, 7, 8, 10, 15, 20, 25]
+
+ '''
+ _heappop, _heapreplace, _StopIteration = heappop, heapreplace, StopIteration
+ _len = len
+
+ h = []
+ h_append = h.append
+ for itnum, it in enumerate(map(iter, iterables)):
+ try:
+ next = it.next
+ h_append([next(), itnum, next])
+ except _StopIteration:
+ pass
+ heapify(h)
+
+ while _len(h) > 1:
+ try:
+ while 1:
+ v, itnum, next = s = h[0]
+ yield v
+ s[0] = next() # raises StopIteration when exhausted
+ _heapreplace(h, s) # restore heap condition
+ except _StopIteration:
+ _heappop(h) # remove empty iterator
+ if h:
+ # fast case when only a single iterator remains
+ v, itnum, next = h[0]
+ yield v
+ for v in next.__self__:
+ yield v
+
+# Extend the implementations of nsmallest and nlargest to use a key= argument
+_nsmallest = nsmallest
+def nsmallest(n, iterable, key=None):
+ """Find the n smallest elements in a dataset.
+
+ Equivalent to: sorted(iterable, key=key)[:n]
+ """
+ # Short-cut for n==1 is to use min() when len(iterable)>0
+ if n == 1:
+ it = iter(iterable)
+ head = list(islice(it, 1))
+ if not head:
+ return []
+ if key is None:
+ return [min(chain(head, it))]
+ return [min(chain(head, it), key=key)]
+
+ # When n>=size, it's faster to use sorted()
+ try:
+ size = len(iterable)
+ except (TypeError, AttributeError):
+ pass
+ else:
+ if n >= size:
+ return sorted(iterable, key=key)[:n]
+
+ # When key is none, use simpler decoration
+ if key is None:
+ it = izip(iterable, count()) # decorate
+ result = _nsmallest(n, it)
+ return map(itemgetter(0), result) # undecorate
+
+ # General case, slowest method
+ in1, in2 = tee(iterable)
+ it = izip(imap(key, in1), count(), in2) # decorate
+ result = _nsmallest(n, it)
+ return map(itemgetter(2), result) # undecorate
+
+_nlargest = nlargest
+def nlargest(n, iterable, key=None):
+ """Find the n largest elements in a dataset.
+
+ Equivalent to: sorted(iterable, key=key, reverse=True)[:n]
+ """
+
+ # Short-cut for n==1 is to use max() when len(iterable)>0
+ if n == 1:
+ it = iter(iterable)
+ head = list(islice(it, 1))
+ if not head:
+ return []
+ if key is None:
+ return [max(chain(head, it))]
+ return [max(chain(head, it), key=key)]
+
+ # When n>=size, it's faster to use sorted()
+ try:
+ size = len(iterable)
+ except (TypeError, AttributeError):
+ pass
+ else:
+ if n >= size:
+ return sorted(iterable, key=key, reverse=True)[:n]
+
+ # When key is none, use simpler decoration
+ if key is None:
+ it = izip(iterable, count(0,-1)) # decorate
+ result = _nlargest(n, it)
+ return map(itemgetter(0), result) # undecorate
+
+ # General case, slowest method
+ in1, in2 = tee(iterable)
+ it = izip(imap(key, in1), count(0,-1), in2) # decorate
+ result = _nlargest(n, it)
+ return map(itemgetter(2), result) # undecorate
+
+if __name__ == "__main__":
+ # Simple sanity test
+ heap = []
+ data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0]
+ for item in data:
+ heappush(heap, item)
+ sort = []
+ while heap:
+ sort.append(heappop(heap))
+ print sort
+
+ import doctest
+ doctest.testmod()
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
index 0000000000..a44aea4fbc
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/importlib/__init__.py
@@ -0,0 +1,38 @@
+"""Backport of importlib.import_module from 3.x."""
+# While not critical (and in no way guaranteed!), it would be nice to keep this
+# code compatible with Python 2.3.
+import sys
+
+def _resolve_name(name, package, level):
+ """Return the absolute name of the module to be imported."""
+ if not hasattr(package, 'rindex'):
+ raise ValueError("'package' not set to a string")
+ dot = len(package)
+ for x in xrange(level, 1, -1):
+ try:
+ dot = package.rindex('.', 0, dot)
+ except ValueError:
+ raise ValueError("attempted relative import beyond top-level "
+ "package")
+ return "%s.%s" % (package[:dot], name)
+
+
+def import_module(name, package=None):
+ """Import a module.
+
+ The 'package' argument is required when performing a relative import. It
+ specifies the package to use as the anchor point from which to resolve the
+ relative import to an absolute import.
+
+ """
+ if name.startswith('.'):
+ if not package:
+ raise TypeError("relative imports require the 'package' argument")
+ level = 0
+ for character in name:
+ if character != '.':
+ break
+ level += 1
+ name = _resolve_name(name[level:], package, level)
+ __import__(name)
+ return sys.modules[name]
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
index 0000000000..ada38738a1
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/inspect.py
@@ -0,0 +1,1059 @@
+# -*- coding: iso-8859-1 -*-
+"""Get useful information from live Python objects.
+
+This module encapsulates the interface provided by the internal special
+attributes (func_*, co_*, im_*, tb_*, etc.) in a friendlier fashion.
+It also provides some help for examining source code and class layout.
+
+Here are some of the useful functions provided by this module:
+
+ ismodule(), isclass(), ismethod(), isfunction(), isgeneratorfunction(),
+ isgenerator(), istraceback(), isframe(), iscode(), isbuiltin(),
+ isroutine() - check object types
+ getmembers() - get members of an object that satisfy a given condition
+
+ getfile(), getsourcefile(), getsource() - find an object's source code
+ getdoc(), getcomments() - get documentation on an object
+ getmodule() - determine the module that an object came from
+ getclasstree() - arrange classes so as to represent their hierarchy
+
+ getargspec(), getargvalues(), getcallargs() - get info about function arguments
+ formatargspec(), formatargvalues() - format an argument spec
+ getouterframes(), getinnerframes() - get info about frames
+ currentframe() - get the current stack frame
+ stack(), trace() - get info about frames on the stack or in a traceback
+"""
+
+# This module is in the public domain. No warranties.
+
+__author__ = 'Ka-Ping Yee <ping@lfw.org>'
+__date__ = '1 Jan 2001'
+
+import sys
+import os
+import types
+import string
+import re
+import dis
+import imp
+import tokenize
+import linecache
+from operator import attrgetter
+from collections import namedtuple
+
+# These constants are from Include/code.h.
+CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, CO_VARKEYWORDS = 0x1, 0x2, 0x4, 0x8
+CO_NESTED, CO_GENERATOR, CO_NOFREE = 0x10, 0x20, 0x40
+# See Include/object.h
+TPFLAGS_IS_ABSTRACT = 1 << 20
+
+# ----------------------------------------------------------- type-checking
+def ismodule(object):
+ """Return true if the object is a module.
+
+ Module objects provide these attributes:
+ __doc__ documentation string
+ __file__ filename (missing for built-in modules)"""
+ return isinstance(object, types.ModuleType)
+
+def isclass(object):
+ """Return true if the object is a class.
+
+ Class objects provide these attributes:
+ __doc__ documentation string
+ __module__ name of module in which this class was defined"""
+ return isinstance(object, (type, types.ClassType))
+
+def ismethod(object):
+ """Return true if the object is an instance method.
+
+ Instance method objects provide these attributes:
+ __doc__ documentation string
+ __name__ name with which this method was defined
+ im_class class object in which this method belongs
+ im_func function object containing implementation of method
+ im_self instance to which this method is bound, or None"""
+ return isinstance(object, types.MethodType)
+
+def ismethoddescriptor(object):
+ """Return true if the object is a method descriptor.
+
+ But not if ismethod() or isclass() or isfunction() are true.
+
+ This is new in Python 2.2, and, for example, is true of int.__add__.
+ An object passing this test has a __get__ attribute but not a __set__
+ attribute, but beyond that the set of attributes varies. __name__ is
+ usually sensible, and __doc__ often is.
+
+ Methods implemented via descriptors that also pass one of the other
+ tests return false from the ismethoddescriptor() test, simply because
+ the other tests promise more -- you can, e.g., count on having the
+ im_func attribute (etc) when an object passes ismethod()."""
+ return (hasattr(object, "__get__")
+ and not hasattr(object, "__set__") # else it's a data descriptor
+ and not ismethod(object) # mutual exclusion
+ and not isfunction(object)
+ and not isclass(object))
+
+def isdatadescriptor(object):
+ """Return true if the object is a data descriptor.
+
+ Data descriptors have both a __get__ and a __set__ attribute. Examples are
+ properties (defined in Python) and getsets and members (defined in C).
+ Typically, data descriptors will also have __name__ and __doc__ attributes
+ (properties, getsets, and members have both of these attributes), but this
+ is not guaranteed."""
+ return (hasattr(object, "__set__") and hasattr(object, "__get__"))
+
+if hasattr(types, 'MemberDescriptorType'):
+ # CPython and equivalent
+ def ismemberdescriptor(object):
+ """Return true if the object is a member descriptor.
+
+ Member descriptors are specialized descriptors defined in extension
+ modules."""
+ return isinstance(object, types.MemberDescriptorType)
+else:
+ # Other implementations
+ def ismemberdescriptor(object):
+ """Return true if the object is a member descriptor.
+
+ Member descriptors are specialized descriptors defined in extension
+ modules."""
+ return False
+
+if hasattr(types, 'GetSetDescriptorType'):
+ # CPython and equivalent
+ def isgetsetdescriptor(object):
+ """Return true if the object is a getset descriptor.
+
+ getset descriptors are specialized descriptors defined in extension
+ modules."""
+ return isinstance(object, types.GetSetDescriptorType)
+else:
+ # Other implementations
+ def isgetsetdescriptor(object):
+ """Return true if the object is a getset descriptor.
+
+ getset descriptors are specialized descriptors defined in extension
+ modules."""
+ return False
+
+def isfunction(object):
+ """Return true if the object is a user-defined function.
+
+ Function objects provide these attributes:
+ __doc__ documentation string
+ __name__ name with which this function was defined
+ func_code code object containing compiled function bytecode
+ func_defaults tuple of any default values for arguments
+ func_doc (same as __doc__)
+ func_globals global namespace in which this function was defined
+ func_name (same as __name__)"""
+ return isinstance(object, types.FunctionType)
+
+def isgeneratorfunction(object):
+ """Return true if the object is a user-defined generator function.
+
+ Generator function objects provides same attributes as functions.
+
+ See help(isfunction) for attributes listing."""
+ return bool((isfunction(object) or ismethod(object)) and
+ object.func_code.co_flags & CO_GENERATOR)
+
+def isgenerator(object):
+ """Return true if the object is a generator.
+
+ Generator objects provide these attributes:
+ __iter__ defined to support iteration over container
+ close raises a new GeneratorExit exception inside the
+ generator to terminate the iteration
+ gi_code code object
+ gi_frame frame object or possibly None once the generator has
+ been exhausted
+ gi_running set to 1 when generator is executing, 0 otherwise
+ next return the next item from the container
+ send resumes the generator and "sends" a value that becomes
+ the result of the current yield-expression
+ throw used to raise an exception inside the generator"""
+ return isinstance(object, types.GeneratorType)
+
+def istraceback(object):
+ """Return true if the object is a traceback.
+
+ Traceback objects provide these attributes:
+ tb_frame frame object at this level
+ tb_lasti index of last attempted instruction in bytecode
+ tb_lineno current line number in Python source code
+ tb_next next inner traceback object (called by this level)"""
+ return isinstance(object, types.TracebackType)
+
+def isframe(object):
+ """Return true if the object is a frame object.
+
+ Frame objects provide these attributes:
+ f_back next outer frame object (this frame's caller)
+ f_builtins built-in namespace seen by this frame
+ f_code code object being executed in this frame
+ f_exc_traceback traceback if raised in this frame, or None
+ f_exc_type exception type if raised in this frame, or None
+ f_exc_value exception value if raised in this frame, or None
+ f_globals global namespace seen by this frame
+ f_lasti index of last attempted instruction in bytecode
+ f_lineno current line number in Python source code
+ f_locals local namespace seen by this frame
+ f_restricted 0 or 1 if frame is in restricted execution mode
+ f_trace tracing function for this frame, or None"""
+ return isinstance(object, types.FrameType)
+
+def iscode(object):
+ """Return true if the object is a code object.
+
+ Code objects provide these attributes:
+ co_argcount number of arguments (not including * or ** args)
+ co_code string of raw compiled bytecode
+ co_consts tuple of constants used in the bytecode
+ co_filename name of file in which this code object was created
+ co_firstlineno number of first line in Python source code
+ co_flags bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg
+ co_lnotab encoded mapping of line numbers to bytecode indices
+ co_name name with which this code object was defined
+ co_names tuple of names of local variables
+ co_nlocals number of local variables
+ co_stacksize virtual machine stack space required
+ co_varnames tuple of names of arguments and local variables"""
+ return isinstance(object, types.CodeType)
+
+def isbuiltin(object):
+ """Return true if the object is a built-in function or method.
+
+ Built-in functions and methods provide these attributes:
+ __doc__ documentation string
+ __name__ original name of this function or method
+ __self__ instance to which a method is bound, or None"""
+ return isinstance(object, types.BuiltinFunctionType)
+
+def isroutine(object):
+ """Return true if the object is any kind of function or method."""
+ return (isbuiltin(object)
+ or isfunction(object)
+ or ismethod(object)
+ or ismethoddescriptor(object))
+
+def isabstract(object):
+ """Return true if the object is an abstract base class (ABC)."""
+ return bool(isinstance(object, type) and object.__flags__ & TPFLAGS_IS_ABSTRACT)
+
+def getmembers(object, predicate=None):
+ """Return all members of an object as (name, value) pairs sorted by name.
+ Optionally, only return members that satisfy a given predicate."""
+ results = []
+ for key in dir(object):
+ try:
+ value = getattr(object, key)
+ except AttributeError:
+ continue
+ if not predicate or predicate(value):
+ results.append((key, value))
+ results.sort()
+ return results
+
+Attribute = namedtuple('Attribute', 'name kind defining_class object')
+
+def classify_class_attrs(cls):
+ """Return list of attribute-descriptor tuples.
+
+ For each name in dir(cls), the return list contains a 4-tuple
+ with these elements:
+
+ 0. The name (a string).
+
+ 1. The kind of attribute this is, one of these strings:
+ 'class method' created via classmethod()
+ 'static method' created via staticmethod()
+ 'property' created via property()
+ 'method' any other flavor of method
+ 'data' not a method
+
+ 2. The class which defined this attribute (a class).
+
+ 3. The object as obtained directly from the defining class's
+ __dict__, not via getattr. This is especially important for
+ data attributes: C.data is just a data object, but
+ C.__dict__['data'] may be a data descriptor with additional
+ info, like a __doc__ string.
+ """
+
+ mro = getmro(cls)
+ names = dir(cls)
+ result = []
+ for name in names:
+ # Get the object associated with the name, and where it was defined.
+ # Getting an obj from the __dict__ sometimes reveals more than
+ # using getattr. Static and class methods are dramatic examples.
+ # Furthermore, some objects may raise an Exception when fetched with
+ # getattr(). This is the case with some descriptors (bug #1785).
+ # Thus, we only use getattr() as a last resort.
+ homecls = None
+ for base in (cls,) + mro:
+ if name in base.__dict__:
+ obj = base.__dict__[name]
+ homecls = base
+ break
+ else:
+ obj = getattr(cls, name)
+ homecls = getattr(obj, "__objclass__", homecls)
+
+ # Classify the object.
+ if isinstance(obj, staticmethod):
+ kind = "static method"
+ elif isinstance(obj, classmethod):
+ kind = "class method"
+ elif isinstance(obj, property):
+ kind = "property"
+ elif ismethoddescriptor(obj):
+ kind = "method"
+ elif isdatadescriptor(obj):
+ kind = "data"
+ else:
+ obj_via_getattr = getattr(cls, name)
+ if (ismethod(obj_via_getattr) or
+ ismethoddescriptor(obj_via_getattr)):
+ kind = "method"
+ else:
+ kind = "data"
+ obj = obj_via_getattr
+
+ result.append(Attribute(name, kind, homecls, obj))
+
+ return result
+
+# ----------------------------------------------------------- class helpers
+def _searchbases(cls, accum):
+ # Simulate the "classic class" search order.
+ if cls in accum:
+ return
+ accum.append(cls)
+ for base in cls.__bases__:
+ _searchbases(base, accum)
+
+def getmro(cls):
+ "Return tuple of base classes (including cls) in method resolution order."
+ if hasattr(cls, "__mro__"):
+ return cls.__mro__
+ else:
+ result = []
+ _searchbases(cls, result)
+ return tuple(result)
+
+# -------------------------------------------------- source code extraction
+def indentsize(line):
+ """Return the indent size, in spaces, at the start of a line of text."""
+ expline = string.expandtabs(line)
+ return len(expline) - len(string.lstrip(expline))
+
+def getdoc(object):
+ """Get the documentation string for an object.
+
+ All tabs are expanded to spaces. To clean up docstrings that are
+ indented to line up with blocks of code, any whitespace than can be
+ uniformly removed from the second line onwards is removed."""
+ try:
+ doc = object.__doc__
+ except AttributeError:
+ return None
+ if not isinstance(doc, types.StringTypes):
+ return None
+ return cleandoc(doc)
+
+def cleandoc(doc):
+ """Clean up indentation from docstrings.
+
+ Any whitespace that can be uniformly removed from the second line
+ onwards is removed."""
+ try:
+ lines = string.split(string.expandtabs(doc), '\n')
+ except UnicodeError:
+ return None
+ else:
+ # Find minimum indentation of any non-blank lines after first line.
+ margin = sys.maxint
+ for line in lines[1:]:
+ content = len(string.lstrip(line))
+ if content:
+ indent = len(line) - content
+ margin = min(margin, indent)
+ # Remove indentation.
+ if lines:
+ lines[0] = lines[0].lstrip()
+ if margin < sys.maxint:
+ for i in range(1, len(lines)): lines[i] = lines[i][margin:]
+ # Remove any trailing or leading blank lines.
+ while lines and not lines[-1]:
+ lines.pop()
+ while lines and not lines[0]:
+ lines.pop(0)
+ return string.join(lines, '\n')
+
+def getfile(object):
+ """Work out which source or compiled file an object was defined in."""
+ if ismodule(object):
+ if hasattr(object, '__file__'):
+ return object.__file__
+ raise TypeError('{!r} is a built-in module'.format(object))
+ if isclass(object):
+ object = sys.modules.get(object.__module__)
+ if hasattr(object, '__file__'):
+ return object.__file__
+ raise TypeError('{!r} is a built-in class'.format(object))
+ if ismethod(object):
+ object = object.im_func
+ if isfunction(object):
+ object = object.func_code
+ if istraceback(object):
+ object = object.tb_frame
+ if isframe(object):
+ object = object.f_code
+ if iscode(object):
+ return object.co_filename
+ raise TypeError('{!r} is not a module, class, method, '
+ 'function, traceback, frame, or code object'.format(object))
+
+ModuleInfo = namedtuple('ModuleInfo', 'name suffix mode module_type')
+
+def getmoduleinfo(path):
+ """Get the module name, suffix, mode, and module type for a given file."""
+ filename = os.path.basename(path)
+ suffixes = map(lambda info:
+ (-len(info[0]), info[0], info[1], info[2]),
+ imp.get_suffixes())
+ suffixes.sort() # try longest suffixes first, in case they overlap
+ for neglen, suffix, mode, mtype in suffixes:
+ if filename[neglen:] == suffix:
+ return ModuleInfo(filename[:neglen], suffix, mode, mtype)
+
+def getmodulename(path):
+ """Return the module name for a given file, or None."""
+ info = getmoduleinfo(path)
+ if info: return info[0]
+
+def getsourcefile(object):
+ """Return the filename that can be used to locate an object's source.
+ Return None if no way can be identified to get the source.
+ """
+ filename = getfile(object)
+ if string.lower(filename[-4:]) in ('.pyc', '.pyo'):
+ filename = filename[:-4] + '.py'
+ for suffix, mode, kind in imp.get_suffixes():
+ if 'b' in mode and string.lower(filename[-len(suffix):]) == suffix:
+ # Looks like a binary file. We want to only return a text file.
+ return None
+ if os.path.exists(filename):
+ return filename
+ # only return a non-existent filename if the module has a PEP 302 loader
+ if hasattr(getmodule(object, filename), '__loader__'):
+ return filename
+ # or it is in the linecache
+ if filename in linecache.cache:
+ return filename
+
+def getabsfile(object, _filename=None):
+ """Return an absolute path to the source or compiled file for an object.
+
+ The idea is for each object to have a unique origin, so this routine
+ normalizes the result as much as possible."""
+ if _filename is None:
+ _filename = getsourcefile(object) or getfile(object)
+ return os.path.normcase(os.path.abspath(_filename))
+
+modulesbyfile = {}
+_filesbymodname = {}
+
+def getmodule(object, _filename=None):
+ """Return the module an object was defined in, or None if not found."""
+ if ismodule(object):
+ return object
+ if hasattr(object, '__module__'):
+ return sys.modules.get(object.__module__)
+ # Try the filename to modulename cache
+ if _filename is not None and _filename in modulesbyfile:
+ return sys.modules.get(modulesbyfile[_filename])
+ # Try the cache again with the absolute file name
+ try:
+ file = getabsfile(object, _filename)
+ except TypeError:
+ return None
+ if file in modulesbyfile:
+ return sys.modules.get(modulesbyfile[file])
+ # Update the filename to module name cache and check yet again
+ # Copy sys.modules in order to cope with changes while iterating
+ for modname, module in sys.modules.items():
+ if ismodule(module) and hasattr(module, '__file__'):
+ f = module.__file__
+ if f == _filesbymodname.get(modname, None):
+ # Have already mapped this module, so skip it
+ continue
+ _filesbymodname[modname] = f
+ f = getabsfile(module)
+ # Always map to the name the module knows itself by
+ modulesbyfile[f] = modulesbyfile[
+ os.path.realpath(f)] = module.__name__
+ if file in modulesbyfile:
+ return sys.modules.get(modulesbyfile[file])
+ # Check the main module
+ main = sys.modules['__main__']
+ if not hasattr(object, '__name__'):
+ return None
+ if hasattr(main, object.__name__):
+ mainobject = getattr(main, object.__name__)
+ if mainobject is object:
+ return main
+ # Check builtins
+ builtin = sys.modules['__builtin__']
+ if hasattr(builtin, object.__name__):
+ builtinobject = getattr(builtin, object.__name__)
+ if builtinobject is object:
+ return builtin
+
+def findsource(object):
+ """Return the entire source file and starting line number for an object.
+
+ The argument may be a module, class, method, function, traceback, frame,
+ or code object. The source code is returned as a list of all the lines
+ in the file and the line number indexes a line in that list. An IOError
+ is raised if the source code cannot be retrieved."""
+
+ file = getfile(object)
+ sourcefile = getsourcefile(object)
+ if not sourcefile and file[:1] + file[-1:] != '<>':
+ raise IOError('source code not available')
+ file = sourcefile if sourcefile else file
+
+ module = getmodule(object, file)
+ if module:
+ lines = linecache.getlines(file, module.__dict__)
+ else:
+ lines = linecache.getlines(file)
+ if not lines:
+ raise IOError('could not get source code')
+
+ if ismodule(object):
+ return lines, 0
+
+ if isclass(object):
+ name = object.__name__
+ pat = re.compile(r'^(\s*)class\s*' + name + r'\b')
+ # make some effort to find the best matching class definition:
+ # use the one with the least indentation, which is the one
+ # that's most probably not inside a function definition.
+ candidates = []
+ for i in range(len(lines)):
+ match = pat.match(lines[i])
+ if match:
+ # if it's at toplevel, it's already the best one
+ if lines[i][0] == 'c':
+ return lines, i
+ # else add whitespace to candidate list
+ candidates.append((match.group(1), i))
+ if candidates:
+ # this will sort by whitespace, and by line number,
+ # less whitespace first
+ candidates.sort()
+ return lines, candidates[0][1]
+ else:
+ raise IOError('could not find class definition')
+
+ if ismethod(object):
+ object = object.im_func
+ if isfunction(object):
+ object = object.func_code
+ if istraceback(object):
+ object = object.tb_frame
+ if isframe(object):
+ object = object.f_code
+ if iscode(object):
+ if not hasattr(object, 'co_firstlineno'):
+ raise IOError('could not find function definition')
+ lnum = object.co_firstlineno - 1
+ pat = re.compile(r'^(\s*def\s)|(.*(?<!\w)lambda(:|\s))|^(\s*@)')
+ while lnum > 0:
+ if pat.match(lines[lnum]): break
+ lnum = lnum - 1
+ return lines, lnum
+ raise IOError('could not find code object')
+
+def getcomments(object):
+ """Get lines of comments immediately preceding an object's source code.
+
+ Returns None when source can't be found.
+ """
+ try:
+ lines, lnum = findsource(object)
+ except (IOError, TypeError):
+ return None
+
+ if ismodule(object):
+ # Look for a comment block at the top of the file.
+ start = 0
+ if lines and lines[0][:2] == '#!': start = 1
+ while start < len(lines) and string.strip(lines[start]) in ('', '#'):
+ start = start + 1
+ if start < len(lines) and lines[start][:1] == '#':
+ comments = []
+ end = start
+ while end < len(lines) and lines[end][:1] == '#':
+ comments.append(string.expandtabs(lines[end]))
+ end = end + 1
+ return string.join(comments, '')
+
+ # Look for a preceding block of comments at the same indentation.
+ elif lnum > 0:
+ indent = indentsize(lines[lnum])
+ end = lnum - 1
+ if end >= 0 and string.lstrip(lines[end])[:1] == '#' and \
+ indentsize(lines[end]) == indent:
+ comments = [string.lstrip(string.expandtabs(lines[end]))]
+ if end > 0:
+ end = end - 1
+ comment = string.lstrip(string.expandtabs(lines[end]))
+ while comment[:1] == '#' and indentsize(lines[end]) == indent:
+ comments[:0] = [comment]
+ end = end - 1
+ if end < 0: break
+ comment = string.lstrip(string.expandtabs(lines[end]))
+ while comments and string.strip(comments[0]) == '#':
+ comments[:1] = []
+ while comments and string.strip(comments[-1]) == '#':
+ comments[-1:] = []
+ return string.join(comments, '')
+
+class EndOfBlock(Exception): pass
+
+class BlockFinder:
+ """Provide a tokeneater() method to detect the end of a code block."""
+ def __init__(self):
+ self.indent = 0
+ self.islambda = False
+ self.started = False
+ self.passline = False
+ self.last = 1
+
+ def tokeneater(self, type, token, srow_scol, erow_ecol, line):
+ srow, scol = srow_scol
+ erow, ecol = erow_ecol
+ if not self.started:
+ # look for the first "def", "class" or "lambda"
+ if token in ("def", "class", "lambda"):
+ if token == "lambda":
+ self.islambda = True
+ self.started = True
+ self.passline = True # skip to the end of the line
+ elif type == tokenize.NEWLINE:
+ self.passline = False # stop skipping when a NEWLINE is seen
+ self.last = srow
+ if self.islambda: # lambdas always end at the first NEWLINE
+ raise EndOfBlock
+ elif self.passline:
+ pass
+ elif type == tokenize.INDENT:
+ self.indent = self.indent + 1
+ self.passline = True
+ elif type == tokenize.DEDENT:
+ self.indent = self.indent - 1
+ # the end of matching indent/dedent pairs end a block
+ # (note that this only works for "def"/"class" blocks,
+ # not e.g. for "if: else:" or "try: finally:" blocks)
+ if self.indent <= 0:
+ raise EndOfBlock
+ elif self.indent == 0 and type not in (tokenize.COMMENT, tokenize.NL):
+ # any other token on the same indentation level end the previous
+ # block as well, except the pseudo-tokens COMMENT and NL.
+ raise EndOfBlock
+
+def getblock(lines):
+ """Extract the block of code at the top of the given list of lines."""
+ blockfinder = BlockFinder()
+ try:
+ tokenize.tokenize(iter(lines).next, blockfinder.tokeneater)
+ except (EndOfBlock, IndentationError):
+ pass
+ return lines[:blockfinder.last]
+
+def getsourcelines(object):
+ """Return a list of source lines and starting line number for an object.
+
+ The argument may be a module, class, method, function, traceback, frame,
+ or code object. The source code is returned as a list of the lines
+ corresponding to the object and the line number indicates where in the
+ original source file the first line of code was found. An IOError is
+ raised if the source code cannot be retrieved."""
+ lines, lnum = findsource(object)
+
+ if ismodule(object): return lines, 0
+ else: return getblock(lines[lnum:]), lnum + 1
+
+def getsource(object):
+ """Return the text of the source code for an object.
+
+ The argument may be a module, class, method, function, traceback, frame,
+ or code object. The source code is returned as a single string. An
+ IOError is raised if the source code cannot be retrieved."""
+ lines, lnum = getsourcelines(object)
+ return string.join(lines, '')
+
+# --------------------------------------------------- class tree extraction
+def walktree(classes, children, parent):
+ """Recursive helper function for getclasstree()."""
+ results = []
+ classes.sort(key=attrgetter('__module__', '__name__'))
+ for c in classes:
+ results.append((c, c.__bases__))
+ if c in children:
+ results.append(walktree(children[c], children, c))
+ return results
+
+def getclasstree(classes, unique=0):
+ """Arrange the given list of classes into a hierarchy of nested lists.
+
+ Where a nested list appears, it contains classes derived from the class
+ whose entry immediately precedes the list. Each entry is a 2-tuple
+ containing a class and a tuple of its base classes. If the 'unique'
+ argument is true, exactly one entry appears in the returned structure
+ for each class in the given list. Otherwise, classes using multiple
+ inheritance and their descendants will appear multiple times."""
+ children = {}
+ roots = []
+ for c in classes:
+ if c.__bases__:
+ for parent in c.__bases__:
+ if not parent in children:
+ children[parent] = []
+ if c not in children[parent]:
+ children[parent].append(c)
+ if unique and parent in classes: break
+ elif c not in roots:
+ roots.append(c)
+ for parent in children:
+ if parent not in classes:
+ roots.append(parent)
+ return walktree(roots, children, None)
+
+# ------------------------------------------------ argument list extraction
+Arguments = namedtuple('Arguments', 'args varargs keywords')
+
+def getargs(co):
+ """Get information about the arguments accepted by a code object.
+
+ Three things are returned: (args, varargs, varkw), where 'args' is
+ a list of argument names (possibly containing nested lists), and
+ 'varargs' and 'varkw' are the names of the * and ** arguments or None."""
+
+ if not iscode(co):
+ raise TypeError('{!r} is not a code object'.format(co))
+
+ nargs = co.co_argcount
+ names = co.co_varnames
+ args = list(names[:nargs])
+ step = 0
+
+ # The following acrobatics are for anonymous (tuple) arguments.
+ for i in range(nargs):
+ if args[i][:1] in ('', '.'):
+ stack, remain, count = [], [], []
+ while step < len(co.co_code):
+ op = ord(co.co_code[step])
+ step = step + 1
+ if op >= dis.HAVE_ARGUMENT:
+ opname = dis.opname[op]
+ value = ord(co.co_code[step]) + ord(co.co_code[step+1])*256
+ step = step + 2
+ if opname in ('UNPACK_TUPLE', 'UNPACK_SEQUENCE'):
+ remain.append(value)
+ count.append(value)
+ elif opname == 'STORE_FAST':
+ stack.append(names[value])
+
+ # Special case for sublists of length 1: def foo((bar))
+ # doesn't generate the UNPACK_TUPLE bytecode, so if
+ # `remain` is empty here, we have such a sublist.
+ if not remain:
+ stack[0] = [stack[0]]
+ break
+ else:
+ remain[-1] = remain[-1] - 1
+ while remain[-1] == 0:
+ remain.pop()
+ size = count.pop()
+ stack[-size:] = [stack[-size:]]
+ if not remain: break
+ remain[-1] = remain[-1] - 1
+ if not remain: break
+ args[i] = stack[0]
+
+ varargs = None
+ if co.co_flags & CO_VARARGS:
+ varargs = co.co_varnames[nargs]
+ nargs = nargs + 1
+ varkw = None
+ if co.co_flags & CO_VARKEYWORDS:
+ varkw = co.co_varnames[nargs]
+ return Arguments(args, varargs, varkw)
+
+ArgSpec = namedtuple('ArgSpec', 'args varargs keywords defaults')
+
+def getargspec(func):
+ """Get the names and default values of a function's arguments.
+
+ A tuple of four things is returned: (args, varargs, varkw, defaults).
+ 'args' is a list of the argument names (it may contain nested lists).
+ 'varargs' and 'varkw' are the names of the * and ** arguments or None.
+ 'defaults' is an n-tuple of the default values of the last n arguments.
+ """
+
+ if ismethod(func):
+ func = func.im_func
+ if not isfunction(func):
+ raise TypeError('{!r} is not a Python function'.format(func))
+ args, varargs, varkw = getargs(func.func_code)
+ return ArgSpec(args, varargs, varkw, func.func_defaults)
+
+ArgInfo = namedtuple('ArgInfo', 'args varargs keywords locals')
+
+def getargvalues(frame):
+ """Get information about arguments passed into a particular frame.
+
+ A tuple of four things is returned: (args, varargs, varkw, locals).
+ 'args' is a list of the argument names (it may contain nested lists).
+ 'varargs' and 'varkw' are the names of the * and ** arguments or None.
+ 'locals' is the locals dictionary of the given frame."""
+ args, varargs, varkw = getargs(frame.f_code)
+ return ArgInfo(args, varargs, varkw, frame.f_locals)
+
+def joinseq(seq):
+ if len(seq) == 1:
+ return '(' + seq[0] + ',)'
+ else:
+ return '(' + string.join(seq, ', ') + ')'
+
+def strseq(object, convert, join=joinseq):
+ """Recursively walk a sequence, stringifying each element."""
+ if type(object) in (list, tuple):
+ return join(map(lambda o, c=convert, j=join: strseq(o, c, j), object))
+ else:
+ return convert(object)
+
+def formatargspec(args, varargs=None, varkw=None, defaults=None,
+ formatarg=str,
+ formatvarargs=lambda name: '*' + name,
+ formatvarkw=lambda name: '**' + name,
+ formatvalue=lambda value: '=' + repr(value),
+ join=joinseq):
+ """Format an argument spec from the 4 values returned by getargspec.
+
+ The first four arguments are (args, varargs, varkw, defaults). The
+ other four arguments are the corresponding optional formatting functions
+ that are called to turn names and values into strings. The ninth
+ argument is an optional function to format the sequence of arguments."""
+ specs = []
+ if defaults:
+ firstdefault = len(args) - len(defaults)
+ for i, arg in enumerate(args):
+ spec = strseq(arg, formatarg, join)
+ if defaults and i >= firstdefault:
+ spec = spec + formatvalue(defaults[i - firstdefault])
+ specs.append(spec)
+ if varargs is not None:
+ specs.append(formatvarargs(varargs))
+ if varkw is not None:
+ specs.append(formatvarkw(varkw))
+ return '(' + string.join(specs, ', ') + ')'
+
+def formatargvalues(args, varargs, varkw, locals,
+ formatarg=str,
+ formatvarargs=lambda name: '*' + name,
+ formatvarkw=lambda name: '**' + name,
+ formatvalue=lambda value: '=' + repr(value),
+ join=joinseq):
+ """Format an argument spec from the 4 values returned by getargvalues.
+
+ The first four arguments are (args, varargs, varkw, locals). The
+ next four arguments are the corresponding optional formatting functions
+ that are called to turn names and values into strings. The ninth
+ argument is an optional function to format the sequence of arguments."""
+ def convert(name, locals=locals,
+ formatarg=formatarg, formatvalue=formatvalue):
+ return formatarg(name) + formatvalue(locals[name])
+ specs = []
+ for i in range(len(args)):
+ specs.append(strseq(args[i], convert, join))
+ if varargs:
+ specs.append(formatvarargs(varargs) + formatvalue(locals[varargs]))
+ if varkw:
+ specs.append(formatvarkw(varkw) + formatvalue(locals[varkw]))
+ return '(' + string.join(specs, ', ') + ')'
+
+def getcallargs(func, *positional, **named):
+ """Get the mapping of arguments to values.
+
+ A dict is returned, with keys the function argument names (including the
+ names of the * and ** arguments, if any), and values the respective bound
+ values from 'positional' and 'named'."""
+ args, varargs, varkw, defaults = getargspec(func)
+ f_name = func.__name__
+ arg2value = {}
+
+ # The following closures are basically because of tuple parameter unpacking.
+ assigned_tuple_params = []
+ def assign(arg, value):
+ if isinstance(arg, str):
+ arg2value[arg] = value
+ else:
+ assigned_tuple_params.append(arg)
+ value = iter(value)
+ for i, subarg in enumerate(arg):
+ try:
+ subvalue = next(value)
+ except StopIteration:
+ raise ValueError('need more than %d %s to unpack' %
+ (i, 'values' if i > 1 else 'value'))
+ assign(subarg,subvalue)
+ try:
+ next(value)
+ except StopIteration:
+ pass
+ else:
+ raise ValueError('too many values to unpack')
+ def is_assigned(arg):
+ if isinstance(arg,str):
+ return arg in arg2value
+ return arg in assigned_tuple_params
+ if ismethod(func) and func.im_self is not None:
+ # implicit 'self' (or 'cls' for classmethods) argument
+ positional = (func.im_self,) + positional
+ num_pos = len(positional)
+ num_total = num_pos + len(named)
+ num_args = len(args)
+ num_defaults = len(defaults) if defaults else 0
+ for arg, value in zip(args, positional):
+ assign(arg, value)
+ if varargs:
+ if num_pos > num_args:
+ assign(varargs, positional[-(num_pos-num_args):])
+ else:
+ assign(varargs, ())
+ elif 0 < num_args < num_pos:
+ raise TypeError('%s() takes %s %d %s (%d given)' % (
+ f_name, 'at most' if defaults else 'exactly', num_args,
+ 'arguments' if num_args > 1 else 'argument', num_total))
+ elif num_args == 0 and num_total:
+ if varkw:
+ if num_pos:
+ # XXX: We should use num_pos, but Python also uses num_total:
+ raise TypeError('%s() takes exactly 0 arguments '
+ '(%d given)' % (f_name, num_total))
+ else:
+ raise TypeError('%s() takes no arguments (%d given)' %
+ (f_name, num_total))
+ for arg in args:
+ if isinstance(arg, str) and arg in named:
+ if is_assigned(arg):
+ raise TypeError("%s() got multiple values for keyword "
+ "argument '%s'" % (f_name, arg))
+ else:
+ assign(arg, named.pop(arg))
+ if defaults: # fill in any missing values with the defaults
+ for arg, value in zip(args[-num_defaults:], defaults):
+ if not is_assigned(arg):
+ assign(arg, value)
+ if varkw:
+ assign(varkw, named)
+ elif named:
+ unexpected = next(iter(named))
+ if isinstance(unexpected, unicode):
+ unexpected = unexpected.encode(sys.getdefaultencoding(), 'replace')
+ raise TypeError("%s() got an unexpected keyword argument '%s'" %
+ (f_name, unexpected))
+ unassigned = num_args - len([arg for arg in args if is_assigned(arg)])
+ if unassigned:
+ num_required = num_args - num_defaults
+ raise TypeError('%s() takes %s %d %s (%d given)' % (
+ f_name, 'at least' if defaults else 'exactly', num_required,
+ 'arguments' if num_required > 1 else 'argument', num_total))
+ return arg2value
+
+# -------------------------------------------------- stack frame extraction
+
+Traceback = namedtuple('Traceback', 'filename lineno function code_context index')
+
+def getframeinfo(frame, context=1):
+ """Get information about a frame or traceback object.
+
+ A tuple of five things is returned: the filename, the line number of
+ the current line, the function name, a list of lines of context from
+ the source code, and the index of the current line within that list.
+ The optional second argument specifies the number of lines of context
+ to return, which are centered around the current line."""
+ if istraceback(frame):
+ lineno = frame.tb_lineno
+ frame = frame.tb_frame
+ else:
+ lineno = frame.f_lineno
+ if not isframe(frame):
+ raise TypeError('{!r} is not a frame or traceback object'.format(frame))
+
+ filename = getsourcefile(frame) or getfile(frame)
+ if context > 0:
+ start = lineno - 1 - context//2
+ try:
+ lines, lnum = findsource(frame)
+ except IOError:
+ lines = index = None
+ else:
+ start = max(start, 1)
+ start = max(0, min(start, len(lines) - context))
+ lines = lines[start:start+context]
+ index = lineno - 1 - start
+ else:
+ lines = index = None
+
+ return Traceback(filename, lineno, frame.f_code.co_name, lines, index)
+
+def getlineno(frame):
+ """Get the line number from a frame object, allowing for optimization."""
+ # FrameType.f_lineno is now a descriptor that grovels co_lnotab
+ return frame.f_lineno
+
+def getouterframes(frame, context=1):
+ """Get a list of records for a frame and all higher (calling) frames.
+
+ Each record contains a frame object, filename, line number, function
+ name, a list of lines of context, and index within the context."""
+ framelist = []
+ while frame:
+ framelist.append((frame,) + getframeinfo(frame, context))
+ frame = frame.f_back
+ return framelist
+
+def getinnerframes(tb, context=1):
+ """Get a list of records for a traceback's frame and all lower frames.
+
+ Each record contains a frame object, filename, line number, function
+ name, a list of lines of context, and index within the context."""
+ framelist = []
+ while tb:
+ framelist.append((tb.tb_frame,) + getframeinfo(tb, context))
+ tb = tb.tb_next
+ return framelist
+
+if hasattr(sys, '_getframe'):
+ currentframe = sys._getframe
+else:
+ currentframe = lambda _=None: None
+
+def stack(context=1):
+ """Return a list of records for the stack above the caller's frame."""
+ return getouterframes(sys._getframe(1), context)
+
+def trace(context=1):
+ """Return a list of records for the stack below the current exception."""
+ return getinnerframes(sys.exc_info()[2], context)
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
index 0000000000..e047147fa7
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/io.py
@@ -0,0 +1,90 @@
+"""The io module provides the Python interfaces to stream handling. The
+builtin open function is defined in this module.
+
+At the top of the I/O hierarchy is the abstract base class IOBase. It
+defines the basic interface to a stream. Note, however, that there is no
+separation between reading and writing to streams; implementations are
+allowed to raise an IOError if they do not support a given operation.
+
+Extending IOBase is RawIOBase which deals simply with the reading and
+writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide
+an interface to OS files.
+
+BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its
+subclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer
+streams that are readable, writable, and both respectively.
+BufferedRandom provides a buffered interface to random access
+streams. BytesIO is a simple stream of in-memory bytes.
+
+Another IOBase subclass, TextIOBase, deals with the encoding and decoding
+of streams into text. TextIOWrapper, which extends it, is a buffered text
+interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO
+is a in-memory stream for text.
+
+Argument names are not part of the specification, and only the arguments
+of open() are intended to be used as keyword arguments.
+
+data:
+
+DEFAULT_BUFFER_SIZE
+
+ An int containing the default buffer size used by the module's buffered
+ I/O classes. open() uses the file's blksize (as obtained by os.stat) if
+ possible.
+"""
+# New I/O library conforming to PEP 3116.
+
+__author__ = ("Guido van Rossum <guido@python.org>, "
+ "Mike Verdone <mike.verdone@gmail.com>, "
+ "Mark Russell <mark.russell@zen.co.uk>, "
+ "Antoine Pitrou <solipsis@pitrou.net>, "
+ "Amaury Forgeot d'Arc <amauryfa@gmail.com>, "
+ "Benjamin Peterson <benjamin@python.org>")
+
+__all__ = ["BlockingIOError", "open", "IOBase", "RawIOBase", "FileIO",
+ "BytesIO", "StringIO", "BufferedIOBase",
+ "BufferedReader", "BufferedWriter", "BufferedRWPair",
+ "BufferedRandom", "TextIOBase", "TextIOWrapper",
+ "UnsupportedOperation", "SEEK_SET", "SEEK_CUR", "SEEK_END"]
+
+
+import _io
+import abc
+
+from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError, UnsupportedOperation,
+ open, FileIO, BytesIO, StringIO, BufferedReader,
+ BufferedWriter, BufferedRWPair, BufferedRandom,
+ IncrementalNewlineDecoder, TextIOWrapper)
+
+OpenWrapper = _io.open # for compatibility with _pyio
+
+# for seek()
+SEEK_SET = 0
+SEEK_CUR = 1
+SEEK_END = 2
+
+# Declaring ABCs in C is tricky so we do it here.
+# Method descriptions and default implementations are inherited from the C
+# version however.
+class IOBase(_io._IOBase):
+ __metaclass__ = abc.ABCMeta
+ __doc__ = _io._IOBase.__doc__
+
+class RawIOBase(_io._RawIOBase, IOBase):
+ __doc__ = _io._RawIOBase.__doc__
+
+class BufferedIOBase(_io._BufferedIOBase, IOBase):
+ __doc__ = _io._BufferedIOBase.__doc__
+
+class TextIOBase(_io._TextIOBase, IOBase):
+ __doc__ = _io._TextIOBase.__doc__
+
+RawIOBase.register(FileIO)
+
+for klass in (BytesIO, BufferedReader, BufferedWriter, BufferedRandom,
+ BufferedRWPair):
+ BufferedIOBase.register(klass)
+
+for klass in (StringIO, TextIOWrapper):
+ TextIOBase.register(klass)
+del klass
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
index 0000000000..dafae512c6
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/__init__.py
@@ -0,0 +1,351 @@
+r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
+JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
+interchange format.
+
+:mod:`json` exposes an API familiar to users of the standard library
+:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
+version of the :mod:`json` library contained in Python 2.6, but maintains
+compatibility with Python 2.4 and Python 2.5 and (currently) has
+significant performance advantages, even without using the optional C
+extension for speedups.
+
+Encoding basic Python object hierarchies::
+
+ >>> import json
+ >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])
+ '["foo", {"bar": ["baz", null, 1.0, 2]}]'
+ >>> print json.dumps("\"foo\bar")
+ "\"foo\bar"
+ >>> print json.dumps(u'\u1234')
+ "\u1234"
+ >>> print json.dumps('\\')
+ "\\"
+ >>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)
+ {"a": 0, "b": 0, "c": 0}
+ >>> from StringIO import StringIO
+ >>> io = StringIO()
+ >>> json.dump(['streaming API'], io)
+ >>> io.getvalue()
+ '["streaming API"]'
+
+Compact encoding::
+
+ >>> import json
+ >>> json.dumps([1,2,3,{'4': 5, '6': 7}], sort_keys=True, separators=(',',':'))
+ '[1,2,3,{"4":5,"6":7}]'
+
+Pretty printing::
+
+ >>> import json
+ >>> print json.dumps({'4': 5, '6': 7}, sort_keys=True,
+ ... indent=4, separators=(',', ': '))
+ {
+ "4": 5,
+ "6": 7
+ }
+
+Decoding JSON::
+
+ >>> import json
+ >>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}]
+ >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj
+ True
+ >>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar'
+ True
+ >>> from StringIO import StringIO
+ >>> io = StringIO('["streaming API"]')
+ >>> json.load(io)[0] == 'streaming API'
+ True
+
+Specializing JSON object decoding::
+
+ >>> import json
+ >>> def as_complex(dct):
+ ... if '__complex__' in dct:
+ ... return complex(dct['real'], dct['imag'])
+ ... return dct
+ ...
+ >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}',
+ ... object_hook=as_complex)
+ (1+2j)
+ >>> from decimal import Decimal
+ >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1')
+ True
+
+Specializing JSON object encoding::
+
+ >>> import json
+ >>> def encode_complex(obj):
+ ... if isinstance(obj, complex):
+ ... return [obj.real, obj.imag]
+ ... raise TypeError(repr(o) + " is not JSON serializable")
+ ...
+ >>> json.dumps(2 + 1j, default=encode_complex)
+ '[2.0, 1.0]'
+ >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j)
+ '[2.0, 1.0]'
+ >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j))
+ '[2.0, 1.0]'
+
+
+Using json.tool from the shell to validate and pretty-print::
+
+ $ echo '{"json":"obj"}' | python -m json.tool
+ {
+ "json": "obj"
+ }
+ $ echo '{ 1.2:3.4}' | python -m json.tool
+ Expecting property name enclosed in double quotes: line 1 column 3 (char 2)
+"""
+__version__ = '2.0.9'
+__all__ = [
+ 'dump', 'dumps', 'load', 'loads',
+ 'JSONDecoder', 'JSONEncoder',
+]
+
+__author__ = 'Bob Ippolito <bob@redivi.com>'
+
+from .decoder import JSONDecoder
+from .encoder import JSONEncoder
+
+_default_encoder = JSONEncoder(
+ skipkeys=False,
+ ensure_ascii=True,
+ check_circular=True,
+ allow_nan=True,
+ indent=None,
+ separators=None,
+ encoding='utf-8',
+ default=None,
+)
+
+def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True,
+ allow_nan=True, cls=None, indent=None, separators=None,
+ encoding='utf-8', default=None, sort_keys=False, **kw):
+ """Serialize ``obj`` as a JSON formatted stream to ``fp`` (a
+ ``.write()``-supporting file-like object).
+
+ If ``skipkeys`` is true then ``dict`` keys that are not basic types
+ (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)
+ will be skipped instead of raising a ``TypeError``.
+
+ If ``ensure_ascii`` is true (the default), all non-ASCII characters in the
+ output are escaped with ``\uXXXX`` sequences, and the result is a ``str``
+ instance consisting of ASCII characters only. If ``ensure_ascii`` is
+ ``False``, some chunks written to ``fp`` may be ``unicode`` instances.
+ This usually happens because the input contains unicode strings or the
+ ``encoding`` parameter is used. Unless ``fp.write()`` explicitly
+ understands ``unicode`` (as in ``codecs.getwriter``) this is likely to
+ cause an error.
+
+ If ``check_circular`` is false, then the circular reference check
+ for container types will be skipped and a circular reference will
+ result in an ``OverflowError`` (or worse).
+
+ If ``allow_nan`` is false, then it will be a ``ValueError`` to
+ serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``)
+ in strict compliance of the JSON specification, instead of using the
+ JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).
+
+ If ``indent`` is a non-negative integer, then JSON array elements and
+ object members will be pretty-printed with that indent level. An indent
+ level of 0 will only insert newlines. ``None`` is the most compact
+ representation. Since the default item separator is ``', '``, the
+ output might include trailing whitespace when ``indent`` is specified.
+ You can use ``separators=(',', ': ')`` to avoid this.
+
+ If ``separators`` is an ``(item_separator, dict_separator)`` tuple
+ then it will be used instead of the default ``(', ', ': ')`` separators.
+ ``(',', ':')`` is the most compact JSON representation.
+
+ ``encoding`` is the character encoding for str instances, default is UTF-8.
+
+ ``default(obj)`` is a function that should return a serializable version
+ of obj or raise TypeError. The default simply raises TypeError.
+
+ If *sort_keys* is ``True`` (default: ``False``), then the output of
+ dictionaries will be sorted by key.
+
+ To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the
+ ``.default()`` method to serialize additional types), specify it with
+ the ``cls`` kwarg; otherwise ``JSONEncoder`` is used.
+
+ """
+ # cached encoder
+ if (not skipkeys and ensure_ascii and
+ check_circular and allow_nan and
+ cls is None and indent is None and separators is None and
+ encoding == 'utf-8' and default is None and not sort_keys and not kw):
+ iterable = _default_encoder.iterencode(obj)
+ else:
+ if cls is None:
+ cls = JSONEncoder
+ iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii,
+ check_circular=check_circular, allow_nan=allow_nan, indent=indent,
+ separators=separators, encoding=encoding,
+ default=default, sort_keys=sort_keys, **kw).iterencode(obj)
+ # could accelerate with writelines in some versions of Python, at
+ # a debuggability cost
+ for chunk in iterable:
+ fp.write(chunk)
+
+
+def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,
+ allow_nan=True, cls=None, indent=None, separators=None,
+ encoding='utf-8', default=None, sort_keys=False, **kw):
+ """Serialize ``obj`` to a JSON formatted ``str``.
+
+ If ``skipkeys`` is false then ``dict`` keys that are not basic types
+ (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``)
+ will be skipped instead of raising a ``TypeError``.
+
+ If ``ensure_ascii`` is false, all non-ASCII characters are not escaped, and
+ the return value may be a ``unicode`` instance. See ``dump`` for details.
+
+ If ``check_circular`` is false, then the circular reference check
+ for container types will be skipped and a circular reference will
+ result in an ``OverflowError`` (or worse).
+
+ If ``allow_nan`` is false, then it will be a ``ValueError`` to
+ serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in
+ strict compliance of the JSON specification, instead of using the
+ JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``).
+
+ If ``indent`` is a non-negative integer, then JSON array elements and
+ object members will be pretty-printed with that indent level. An indent
+ level of 0 will only insert newlines. ``None`` is the most compact
+ representation. Since the default item separator is ``', '``, the
+ output might include trailing whitespace when ``indent`` is specified.
+ You can use ``separators=(',', ': ')`` to avoid this.
+
+ If ``separators`` is an ``(item_separator, dict_separator)`` tuple
+ then it will be used instead of the default ``(', ', ': ')`` separators.
+ ``(',', ':')`` is the most compact JSON representation.
+
+ ``encoding`` is the character encoding for str instances, default is UTF-8.
+
+ ``default(obj)`` is a function that should return a serializable version
+ of obj or raise TypeError. The default simply raises TypeError.
+
+ If *sort_keys* is ``True`` (default: ``False``), then the output of
+ dictionaries will be sorted by key.
+
+ To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the
+ ``.default()`` method to serialize additional types), specify it with
+ the ``cls`` kwarg; otherwise ``JSONEncoder`` is used.
+
+ """
+ # cached encoder
+ if (not skipkeys and ensure_ascii and
+ check_circular and allow_nan and
+ cls is None and indent is None and separators is None and
+ encoding == 'utf-8' and default is None and not sort_keys and not kw):
+ return _default_encoder.encode(obj)
+ if cls is None:
+ cls = JSONEncoder
+ return cls(
+ skipkeys=skipkeys, ensure_ascii=ensure_ascii,
+ check_circular=check_circular, allow_nan=allow_nan, indent=indent,
+ separators=separators, encoding=encoding, default=default,
+ sort_keys=sort_keys, **kw).encode(obj)
+
+
+_default_decoder = JSONDecoder(encoding=None, object_hook=None,
+ object_pairs_hook=None)
+
+
+def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None,
+ parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):
+ """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing
+ a JSON document) to a Python object.
+
+ If the contents of ``fp`` is encoded with an ASCII based encoding other
+ than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must
+ be specified. Encodings that are not ASCII based (such as UCS-2) are
+ not allowed, and should be wrapped with
+ ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode``
+ object and passed to ``loads()``
+
+ ``object_hook`` is an optional function that will be called with the
+ result of any object literal decode (a ``dict``). The return value of
+ ``object_hook`` will be used instead of the ``dict``. This feature
+ can be used to implement custom decoders (e.g. JSON-RPC class hinting).
+
+ ``object_pairs_hook`` is an optional function that will be called with the
+ result of any object literal decoded with an ordered list of pairs. The
+ return value of ``object_pairs_hook`` will be used instead of the ``dict``.
+ This feature can be used to implement custom decoders that rely on the
+ order that the key and value pairs are decoded (for example,
+ collections.OrderedDict will remember the order of insertion). If
+ ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority.
+
+ To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
+ kwarg; otherwise ``JSONDecoder`` is used.
+
+ """
+ return loads(fp.read(),
+ encoding=encoding, cls=cls, object_hook=object_hook,
+ parse_float=parse_float, parse_int=parse_int,
+ parse_constant=parse_constant, object_pairs_hook=object_pairs_hook,
+ **kw)
+
+
+def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None,
+ parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):
+ """Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON
+ document) to a Python object.
+
+ If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding
+ other than utf-8 (e.g. latin-1) then an appropriate ``encoding`` name
+ must be specified. Encodings that are not ASCII based (such as UCS-2)
+ are not allowed and should be decoded to ``unicode`` first.
+
+ ``object_hook`` is an optional function that will be called with the
+ result of any object literal decode (a ``dict``). The return value of
+ ``object_hook`` will be used instead of the ``dict``. This feature
+ can be used to implement custom decoders (e.g. JSON-RPC class hinting).
+
+ ``object_pairs_hook`` is an optional function that will be called with the
+ result of any object literal decoded with an ordered list of pairs. The
+ return value of ``object_pairs_hook`` will be used instead of the ``dict``.
+ This feature can be used to implement custom decoders that rely on the
+ order that the key and value pairs are decoded (for example,
+ collections.OrderedDict will remember the order of insertion). If
+ ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority.
+
+ ``parse_float``, if specified, will be called with the string
+ of every JSON float to be decoded. By default this is equivalent to
+ float(num_str). This can be used to use another datatype or parser
+ for JSON floats (e.g. decimal.Decimal).
+
+ ``parse_int``, if specified, will be called with the string
+ of every JSON int to be decoded. By default this is equivalent to
+ int(num_str). This can be used to use another datatype or parser
+ for JSON integers (e.g. float).
+
+ ``parse_constant``, if specified, will be called with one of the
+ following strings: -Infinity, Infinity, NaN, null, true, false.
+ This can be used to raise an exception if invalid JSON numbers
+ are encountered.
+
+ To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
+ kwarg; otherwise ``JSONDecoder`` is used.
+
+ """
+ if (cls is None and encoding is None and object_hook is None and
+ parse_int is None and parse_float is None and
+ parse_constant is None and object_pairs_hook is None and not kw):
+ return _default_decoder.decode(s)
+ if cls is None:
+ cls = JSONDecoder
+ if object_hook is not None:
+ kw['object_hook'] = object_hook
+ if object_pairs_hook is not None:
+ kw['object_pairs_hook'] = object_pairs_hook
+ if parse_float is not None:
+ kw['parse_float'] = parse_float
+ if parse_int is not None:
+ kw['parse_int'] = parse_int
+ if parse_constant is not None:
+ kw['parse_constant'] = parse_constant
+ return cls(encoding=encoding, **kw).decode(s)
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
index 0000000000..f2a48296cd
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/decoder.py
@@ -0,0 +1,385 @@
+"""Implementation of JSONDecoder
+"""
+import re
+import sys
+import struct
+
+from json import scanner
+try:
+ from _json import scanstring as c_scanstring
+except ImportError:
+ c_scanstring = None
+
+__all__ = ['JSONDecoder']
+
+FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL
+
+def _floatconstants():
+ _BYTES = '7FF80000000000007FF0000000000000'.decode('hex')
+ if sys.byteorder != 'big':
+ _BYTES = _BYTES[:8][::-1] + _BYTES[8:][::-1]
+ nan, inf = struct.unpack('dd', _BYTES)
+ return nan, inf, -inf
+
+NaN, PosInf, NegInf = _floatconstants()
+
+
+def linecol(doc, pos):
+ lineno = doc.count('\n', 0, pos) + 1
+ if lineno == 1:
+ colno = pos + 1
+ else:
+ colno = pos - doc.rindex('\n', 0, pos)
+ return lineno, colno
+
+
+def errmsg(msg, doc, pos, end=None):
+ # Note that this function is called from _json
+ lineno, colno = linecol(doc, pos)
+ if end is None:
+ fmt = '{0}: line {1} column {2} (char {3})'
+ return fmt.format(msg, lineno, colno, pos)
+ #fmt = '%s: line %d column %d (char %d)'
+ #return fmt % (msg, lineno, colno, pos)
+ endlineno, endcolno = linecol(doc, end)
+ fmt = '{0}: line {1} column {2} - line {3} column {4} (char {5} - {6})'
+ return fmt.format(msg, lineno, colno, endlineno, endcolno, pos, end)
+ #fmt = '%s: line %d column %d - line %d column %d (char %d - %d)'
+ #return fmt % (msg, lineno, colno, endlineno, endcolno, pos, end)
+
+
+_CONSTANTS = {
+ '-Infinity': NegInf,
+ 'Infinity': PosInf,
+ 'NaN': NaN,
+}
+
+STRINGCHUNK = re.compile(r'(.*?)(["\\\x00-\x1f])', FLAGS)
+BACKSLASH = {
+ '"': u'"', '\\': u'\\', '/': u'/',
+ 'b': u'\b', 'f': u'\f', 'n': u'\n', 'r': u'\r', 't': u'\t',
+}
+
+DEFAULT_ENCODING = "utf-8"
+
+def _decode_uXXXX(s, pos):
+ esc = s[pos + 1:pos + 5]
+ if len(esc) == 4 and esc[1] not in 'xX':
+ try:
+ return int(esc, 16)
+ except ValueError:
+ pass
+ msg = "Invalid \\uXXXX escape"
+ raise ValueError(errmsg(msg, s, pos))
+
+def py_scanstring(s, end, encoding=None, strict=True,
+ _b=BACKSLASH, _m=STRINGCHUNK.match):
+ """Scan the string s for a JSON string. End is the index of the
+ character in s after the quote that started the JSON string.
+ Unescapes all valid JSON string escape sequences and raises ValueError
+ on attempt to decode an invalid string. If strict is False then literal
+ control characters are allowed in the string.
+
+ Returns a tuple of the decoded string and the index of the character in s
+ after the end quote."""
+ if encoding is None:
+ encoding = DEFAULT_ENCODING
+ chunks = []
+ _append = chunks.append
+ begin = end - 1
+ while 1:
+ chunk = _m(s, end)
+ if chunk is None:
+ raise ValueError(
+ errmsg("Unterminated string starting at", s, begin))
+ end = chunk.end()
+ content, terminator = chunk.groups()
+ # Content is contains zero or more unescaped string characters
+ if content:
+ if not isinstance(content, unicode):
+ content = unicode(content, encoding)
+ _append(content)
+ # Terminator is the end of string, a literal control character,
+ # or a backslash denoting that an escape sequence follows
+ if terminator == '"':
+ break
+ elif terminator != '\\':
+ if strict:
+ #msg = "Invalid control character %r at" % (terminator,)
+ msg = "Invalid control character {0!r} at".format(terminator)
+ raise ValueError(errmsg(msg, s, end))
+ else:
+ _append(terminator)
+ continue
+ try:
+ esc = s[end]
+ except IndexError:
+ raise ValueError(
+ errmsg("Unterminated string starting at", s, begin))
+ # If not a unicode escape sequence, must be in the lookup table
+ if esc != 'u':
+ try:
+ char = _b[esc]
+ except KeyError:
+ msg = "Invalid \\escape: " + repr(esc)
+ raise ValueError(errmsg(msg, s, end))
+ end += 1
+ else:
+ # Unicode escape sequence
+ uni = _decode_uXXXX(s, end)
+ end += 5
+ # Check for surrogate pair on UCS-4 systems
+ if sys.maxunicode > 65535 and \
+ 0xd800 <= uni <= 0xdbff and s[end:end + 2] == '\\u':
+ uni2 = _decode_uXXXX(s, end + 1)
+ if 0xdc00 <= uni2 <= 0xdfff:
+ uni = 0x10000 + (((uni - 0xd800) << 10) | (uni2 - 0xdc00))
+ end += 6
+ char = unichr(uni)
+ # Append the unescaped character
+ _append(char)
+ return u''.join(chunks), end
+
+
+# Use speedup if available
+scanstring = c_scanstring or py_scanstring
+
+WHITESPACE = re.compile(r'[ \t\n\r]*', FLAGS)
+WHITESPACE_STR = ' \t\n\r'
+
+def JSONObject(s_and_end, encoding, strict, scan_once, object_hook,
+ object_pairs_hook, _w=WHITESPACE.match, _ws=WHITESPACE_STR):
+ s, end = s_and_end
+ pairs = []
+ pairs_append = pairs.append
+ # Use a slice to prevent IndexError from being raised, the following
+ # check will raise a more specific ValueError if the string is empty
+ nextchar = s[end:end + 1]
+ # Normally we expect nextchar == '"'
+ if nextchar != '"':
+ if nextchar in _ws:
+ end = _w(s, end).end()
+ nextchar = s[end:end + 1]
+ # Trivial empty object
+ if nextchar == '}':
+ if object_pairs_hook is not None:
+ result = object_pairs_hook(pairs)
+ return result, end + 1
+ pairs = {}
+ if object_hook is not None:
+ pairs = object_hook(pairs)
+ return pairs, end + 1
+ elif nextchar != '"':
+ raise ValueError(errmsg(
+ "Expecting property name enclosed in double quotes", s, end))
+ end += 1
+ while True:
+ key, end = scanstring(s, end, encoding, strict)
+
+ # To skip some function call overhead we optimize the fast paths where
+ # the JSON key separator is ": " or just ":".
+ if s[end:end + 1] != ':':
+ end = _w(s, end).end()
+ if s[end:end + 1] != ':':
+ raise ValueError(errmsg("Expecting ':' delimiter", s, end))
+ end += 1
+
+ try:
+ if s[end] in _ws:
+ end += 1
+ if s[end] in _ws:
+ end = _w(s, end + 1).end()
+ except IndexError:
+ pass
+
+ try:
+ value, end = scan_once(s, end)
+ except StopIteration:
+ raise ValueError(errmsg("Expecting object", s, end))
+ pairs_append((key, value))
+
+ try:
+ nextchar = s[end]
+ if nextchar in _ws:
+ end = _w(s, end + 1).end()
+ nextchar = s[end]
+ except IndexError:
+ nextchar = ''
+ end += 1
+
+ if nextchar == '}':
+ break
+ elif nextchar != ',':
+ raise ValueError(errmsg("Expecting ',' delimiter", s, end - 1))
+
+ try:
+ nextchar = s[end]
+ if nextchar in _ws:
+ end += 1
+ nextchar = s[end]
+ if nextchar in _ws:
+ end = _w(s, end + 1).end()
+ nextchar = s[end]
+ except IndexError:
+ nextchar = ''
+
+ end += 1
+ if nextchar != '"':
+ raise ValueError(errmsg(
+ "Expecting property name enclosed in double quotes", s, end - 1))
+ if object_pairs_hook is not None:
+ result = object_pairs_hook(pairs)
+ return result, end
+ pairs = dict(pairs)
+ if object_hook is not None:
+ pairs = object_hook(pairs)
+ return pairs, end
+
+def JSONArray(s_and_end, scan_once, _w=WHITESPACE.match, _ws=WHITESPACE_STR):
+ s, end = s_and_end
+ values = []
+ nextchar = s[end:end + 1]
+ if nextchar in _ws:
+ end = _w(s, end + 1).end()
+ nextchar = s[end:end + 1]
+ # Look-ahead for trivial empty array
+ if nextchar == ']':
+ return values, end + 1
+ _append = values.append
+ while True:
+ try:
+ value, end = scan_once(s, end)
+ except StopIteration:
+ raise ValueError(errmsg("Expecting object", s, end))
+ _append(value)
+ nextchar = s[end:end + 1]
+ if nextchar in _ws:
+ end = _w(s, end + 1).end()
+ nextchar = s[end:end + 1]
+ end += 1
+ if nextchar == ']':
+ break
+ elif nextchar != ',':
+ raise ValueError(errmsg("Expecting ',' delimiter", s, end))
+ try:
+ if s[end] in _ws:
+ end += 1
+ if s[end] in _ws:
+ end = _w(s, end + 1).end()
+ except IndexError:
+ pass
+
+ return values, end
+
+class JSONDecoder(object):
+ """Simple JSON <http://json.org> decoder
+
+ Performs the following translations in decoding by default:
+
+ +---------------+-------------------+
+ | JSON | Python |
+ +===============+===================+
+ | object | dict |
+ +---------------+-------------------+
+ | array | list |
+ +---------------+-------------------+
+ | string | unicode |
+ +---------------+-------------------+
+ | number (int) | int, long |
+ +---------------+-------------------+
+ | number (real) | float |
+ +---------------+-------------------+
+ | true | True |
+ +---------------+-------------------+
+ | false | False |
+ +---------------+-------------------+
+ | null | None |
+ +---------------+-------------------+
+
+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as
+ their corresponding ``float`` values, which is outside the JSON spec.
+
+ """
+
+ def __init__(self, encoding=None, object_hook=None, parse_float=None,
+ parse_int=None, parse_constant=None, strict=True,
+ object_pairs_hook=None):
+ """``encoding`` determines the encoding used to interpret any ``str``
+ objects decoded by this instance (utf-8 by default). It has no
+ effect when decoding ``unicode`` objects.
+
+ Note that currently only encodings that are a superset of ASCII work,
+ strings of other encodings should be passed in as ``unicode``.
+
+ ``object_hook``, if specified, will be called with the result
+ of every JSON object decoded and its return value will be used in
+ place of the given ``dict``. This can be used to provide custom
+ deserializations (e.g. to support JSON-RPC class hinting).
+
+ ``object_pairs_hook``, if specified will be called with the result of
+ every JSON object decoded with an ordered list of pairs. The return
+ value of ``object_pairs_hook`` will be used instead of the ``dict``.
+ This feature can be used to implement custom decoders that rely on the
+ order that the key and value pairs are decoded (for example,
+ collections.OrderedDict will remember the order of insertion). If
+ ``object_hook`` is also defined, the ``object_pairs_hook`` takes
+ priority.
+
+ ``parse_float``, if specified, will be called with the string
+ of every JSON float to be decoded. By default this is equivalent to
+ float(num_str). This can be used to use another datatype or parser
+ for JSON floats (e.g. decimal.Decimal).
+
+ ``parse_int``, if specified, will be called with the string
+ of every JSON int to be decoded. By default this is equivalent to
+ int(num_str). This can be used to use another datatype or parser
+ for JSON integers (e.g. float).
+
+ ``parse_constant``, if specified, will be called with one of the
+ following strings: -Infinity, Infinity, NaN.
+ This can be used to raise an exception if invalid JSON numbers
+ are encountered.
+
+ If ``strict`` is false (true is the default), then control
+ characters will be allowed inside strings. Control characters in
+ this context are those with character codes in the 0-31 range,
+ including ``'\\t'`` (tab), ``'\\n'``, ``'\\r'`` and ``'\\0'``.
+
+ """
+ self.encoding = encoding
+ self.object_hook = object_hook
+ self.object_pairs_hook = object_pairs_hook
+ self.parse_float = parse_float or float
+ self.parse_int = parse_int or int
+ self.parse_constant = parse_constant or _CONSTANTS.__getitem__
+ self.strict = strict
+ self.parse_object = JSONObject
+ self.parse_array = JSONArray
+ self.parse_string = scanstring
+ self.scan_once = scanner.make_scanner(self)
+
+ def decode(self, s, _w=WHITESPACE.match):
+ """Return the Python representation of ``s`` (a ``str`` or ``unicode``
+ instance containing a JSON document)
+
+ """
+ obj, end = self.raw_decode(s, idx=_w(s, 0).end())
+ end = _w(s, end).end()
+ if end != len(s):
+ raise ValueError(errmsg("Extra data", s, end, len(s)))
+ return obj
+
+ def raw_decode(self, s, idx=0):
+ """Decode a JSON document from ``s`` (a ``str`` or ``unicode``
+ beginning with a JSON document) and return a 2-tuple of the Python
+ representation and the index in ``s`` where the document ended.
+
+ This can be used to decode a JSON document from a string that may
+ have extraneous data at the end.
+
+ """
+ try:
+ obj, end = self.scan_once(s, idx)
+ except StopIteration:
+ raise ValueError("No JSON object could be decoded")
+ return obj, end
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
index 0000000000..cd1a120e37
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/encoder.py
@@ -0,0 +1,448 @@
+"""Implementation of JSONEncoder
+"""
+import re
+
+try:
+ from _json import encode_basestring_ascii as c_encode_basestring_ascii
+except ImportError:
+ c_encode_basestring_ascii = None
+try:
+ from _json import make_encoder as c_make_encoder
+except ImportError:
+ c_make_encoder = None
+
+ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]')
+ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])')
+HAS_UTF8 = re.compile(r'[\x80-\xff]')
+ESCAPE_DCT = {
+ '\\': '\\\\',
+ '"': '\\"',
+ '\b': '\\b',
+ '\f': '\\f',
+ '\n': '\\n',
+ '\r': '\\r',
+ '\t': '\\t',
+}
+for i in range(0x20):
+ ESCAPE_DCT.setdefault(chr(i), '\\u{0:04x}'.format(i))
+ #ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,))
+
+INFINITY = float('inf')
+FLOAT_REPR = repr
+
+def encode_basestring(s):
+ """Return a JSON representation of a Python string
+
+ """
+ def replace(match):
+ return ESCAPE_DCT[match.group(0)]
+ return '"' + ESCAPE.sub(replace, s) + '"'
+
+
+def py_encode_basestring_ascii(s):
+ """Return an ASCII-only JSON representation of a Python string
+
+ """
+ if isinstance(s, str) and HAS_UTF8.search(s) is not None:
+ s = s.decode('utf-8')
+ def replace(match):
+ s = match.group(0)
+ try:
+ return ESCAPE_DCT[s]
+ except KeyError:
+ n = ord(s)
+ if n < 0x10000:
+ return '\\u{0:04x}'.format(n)
+ #return '\\u%04x' % (n,)
+ else:
+ # surrogate pair
+ n -= 0x10000
+ s1 = 0xd800 | ((n >> 10) & 0x3ff)
+ s2 = 0xdc00 | (n & 0x3ff)
+ return '\\u{0:04x}\\u{1:04x}'.format(s1, s2)
+ #return '\\u%04x\\u%04x' % (s1, s2)
+ return '"' + str(ESCAPE_ASCII.sub(replace, s)) + '"'
+
+
+encode_basestring_ascii = (
+ c_encode_basestring_ascii or py_encode_basestring_ascii)
+
+class JSONEncoder(object):
+ """Extensible JSON <http://json.org> encoder for Python data structures.
+
+ Supports the following objects and types by default:
+
+ +-------------------+---------------+
+ | Python | JSON |
+ +===================+===============+
+ | dict | object |
+ +-------------------+---------------+
+ | list, tuple | array |
+ +-------------------+---------------+
+ | str, unicode | string |
+ +-------------------+---------------+
+ | int, long, float | number |
+ +-------------------+---------------+
+ | True | true |
+ +-------------------+---------------+
+ | False | false |
+ +-------------------+---------------+
+ | None | null |
+ +-------------------+---------------+
+
+ To extend this to recognize other objects, subclass and implement a
+ ``.default()`` method with another method that returns a serializable
+ object for ``o`` if possible, otherwise it should call the superclass
+ implementation (to raise ``TypeError``).
+
+ """
+ item_separator = ', '
+ key_separator = ': '
+ def __init__(self, skipkeys=False, ensure_ascii=True,
+ check_circular=True, allow_nan=True, sort_keys=False,
+ indent=None, separators=None, encoding='utf-8', default=None):
+ """Constructor for JSONEncoder, with sensible defaults.
+
+ If skipkeys is false, then it is a TypeError to attempt
+ encoding of keys that are not str, int, long, float or None. If
+ skipkeys is True, such items are simply skipped.
+
+ If *ensure_ascii* is true (the default), all non-ASCII
+ characters in the output are escaped with \uXXXX sequences,
+ and the results are str instances consisting of ASCII
+ characters only. If ensure_ascii is False, a result may be a
+ unicode instance. This usually happens if the input contains
+ unicode strings or the *encoding* parameter is used.
+
+ If check_circular is true, then lists, dicts, and custom encoded
+ objects will be checked for circular references during encoding to
+ prevent an infinite recursion (which would cause an OverflowError).
+ Otherwise, no such check takes place.
+
+ If allow_nan is true, then NaN, Infinity, and -Infinity will be
+ encoded as such. This behavior is not JSON specification compliant,
+ but is consistent with most JavaScript based encoders and decoders.
+ Otherwise, it will be a ValueError to encode such floats.
+
+ If sort_keys is true, then the output of dictionaries will be
+ sorted by key; this is useful for regression tests to ensure
+ that JSON serializations can be compared on a day-to-day basis.
+
+ If indent is a non-negative integer, then JSON array
+ elements and object members will be pretty-printed with that
+ indent level. An indent level of 0 will only insert newlines.
+ None is the most compact representation. Since the default
+ item separator is ', ', the output might include trailing
+ whitespace when indent is specified. You can use
+ separators=(',', ': ') to avoid this.
+
+ If specified, separators should be a (item_separator, key_separator)
+ tuple. The default is (', ', ': '). To get the most compact JSON
+ representation you should specify (',', ':') to eliminate whitespace.
+
+ If specified, default is a function that gets called for objects
+ that can't otherwise be serialized. It should return a JSON encodable
+ version of the object or raise a ``TypeError``.
+
+ If encoding is not None, then all input strings will be
+ transformed into unicode using that encoding prior to JSON-encoding.
+ The default is UTF-8.
+
+ """
+
+ self.skipkeys = skipkeys
+ self.ensure_ascii = ensure_ascii
+ self.check_circular = check_circular
+ self.allow_nan = allow_nan
+ self.sort_keys = sort_keys
+ self.indent = indent
+ if separators is not None:
+ self.item_separator, self.key_separator = separators
+ if default is not None:
+ self.default = default
+ self.encoding = encoding
+
+ def default(self, o):
+ """Implement this method in a subclass such that it returns
+ a serializable object for ``o``, or calls the base implementation
+ (to raise a ``TypeError``).
+
+ For example, to support arbitrary iterators, you could
+ implement default like this::
+
+ def default(self, o):
+ try:
+ iterable = iter(o)
+ except TypeError:
+ pass
+ else:
+ return list(iterable)
+ # Let the base class default method raise the TypeError
+ return JSONEncoder.default(self, o)
+
+ """
+ raise TypeError(repr(o) + " is not JSON serializable")
+
+ def encode(self, o):
+ """Return a JSON string representation of a Python data structure.
+
+ >>> JSONEncoder().encode({"foo": ["bar", "baz"]})
+ '{"foo": ["bar", "baz"]}'
+
+ """
+ # This is for extremely simple cases and benchmarks.
+ if isinstance(o, basestring):
+ if isinstance(o, str):
+ _encoding = self.encoding
+ if (_encoding is not None
+ and not (_encoding == 'utf-8')):
+ o = o.decode(_encoding)
+ if self.ensure_ascii:
+ return encode_basestring_ascii(o)
+ else:
+ return encode_basestring(o)
+ # This doesn't pass the iterator directly to ''.join() because the
+ # exceptions aren't as detailed. The list call should be roughly
+ # equivalent to the PySequence_Fast that ''.join() would do.
+ chunks = self.iterencode(o, _one_shot=True)
+ if not isinstance(chunks, (list, tuple)):
+ chunks = list(chunks)
+ return ''.join(chunks)
+
+ def iterencode(self, o, _one_shot=False):
+ """Encode the given object and yield each string
+ representation as available.
+
+ For example::
+
+ for chunk in JSONEncoder().iterencode(bigobject):
+ mysocket.write(chunk)
+
+ """
+ if self.check_circular:
+ markers = {}
+ else:
+ markers = None
+ if self.ensure_ascii:
+ _encoder = encode_basestring_ascii
+ else:
+ _encoder = encode_basestring
+ if self.encoding != 'utf-8':
+ def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding):
+ if isinstance(o, str):
+ o = o.decode(_encoding)
+ return _orig_encoder(o)
+
+ def floatstr(o, allow_nan=self.allow_nan,
+ _repr=FLOAT_REPR, _inf=INFINITY, _neginf=-INFINITY):
+ # Check for specials. Note that this type of test is processor
+ # and/or platform-specific, so do tests which don't depend on the
+ # internals.
+
+ if o != o:
+ text = 'NaN'
+ elif o == _inf:
+ text = 'Infinity'
+ elif o == _neginf:
+ text = '-Infinity'
+ else:
+ return _repr(o)
+
+ if not allow_nan:
+ raise ValueError(
+ "Out of range float values are not JSON compliant: " +
+ repr(o))
+
+ return text
+
+
+ if (_one_shot and c_make_encoder is not None
+ and self.indent is None and not self.sort_keys):
+ _iterencode = c_make_encoder(
+ markers, self.default, _encoder, self.indent,
+ self.key_separator, self.item_separator, self.sort_keys,
+ self.skipkeys, self.allow_nan)
+ else:
+ _iterencode = _make_iterencode(
+ markers, self.default, _encoder, self.indent, floatstr,
+ self.key_separator, self.item_separator, self.sort_keys,
+ self.skipkeys, _one_shot)
+ return _iterencode(o, 0)
+
+def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,
+ _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot,
+ ## HACK: hand-optimized bytecode; turn globals into locals
+ ValueError=ValueError,
+ basestring=basestring,
+ dict=dict,
+ float=float,
+ id=id,
+ int=int,
+ isinstance=isinstance,
+ list=list,
+ long=long,
+ str=str,
+ tuple=tuple,
+ ):
+
+ def _iterencode_list(lst, _current_indent_level):
+ if not lst:
+ yield '[]'
+ return
+ if markers is not None:
+ markerid = id(lst)
+ if markerid in markers:
+ raise ValueError("Circular reference detected")
+ markers[markerid] = lst
+ buf = '['
+ if _indent is not None:
+ _current_indent_level += 1
+ newline_indent = '\n' + (' ' * (_indent * _current_indent_level))
+ separator = _item_separator + newline_indent
+ buf += newline_indent
+ else:
+ newline_indent = None
+ separator = _item_separator
+ first = True
+ for value in lst:
+ if first:
+ first = False
+ else:
+ buf = separator
+ if isinstance(value, basestring):
+ yield buf + _encoder(value)
+ elif value is None:
+ yield buf + 'null'
+ elif value is True:
+ yield buf + 'true'
+ elif value is False:
+ yield buf + 'false'
+ elif isinstance(value, (int, long)):
+ yield buf + str(value)
+ elif isinstance(value, float):
+ yield buf + _floatstr(value)
+ else:
+ yield buf
+ if isinstance(value, (list, tuple)):
+ chunks = _iterencode_list(value, _current_indent_level)
+ elif isinstance(value, dict):
+ chunks = _iterencode_dict(value, _current_indent_level)
+ else:
+ chunks = _iterencode(value, _current_indent_level)
+ for chunk in chunks:
+ yield chunk
+ if newline_indent is not None:
+ _current_indent_level -= 1
+ yield '\n' + (' ' * (_indent * _current_indent_level))
+ yield ']'
+ if markers is not None:
+ del markers[markerid]
+
+ def _iterencode_dict(dct, _current_indent_level):
+ if not dct:
+ yield '{}'
+ return
+ if markers is not None:
+ markerid = id(dct)
+ if markerid in markers:
+ raise ValueError("Circular reference detected")
+ markers[markerid] = dct
+ yield '{'
+ if _indent is not None:
+ _current_indent_level += 1
+ newline_indent = '\n' + (' ' * (_indent * _current_indent_level))
+ item_separator = _item_separator + newline_indent
+ yield newline_indent
+ else:
+ newline_indent = None
+ item_separator = _item_separator
+ first = True
+ if _sort_keys:
+ items = sorted(dct.items(), key=lambda kv: kv[0])
+ else:
+ items = dct.iteritems()
+ for key, value in items:
+ if isinstance(key, basestring):
+ pass
+ # JavaScript is weakly typed for these, so it makes sense to
+ # also allow them. Many encoders seem to do something like this.
+ elif isinstance(key, float):
+ key = _floatstr(key)
+ elif key is True:
+ key = 'true'
+ elif key is False:
+ key = 'false'
+ elif key is None:
+ key = 'null'
+ elif isinstance(key, (int, long)):
+ key = str(key)
+ elif _skipkeys:
+ continue
+ else:
+ raise TypeError("key " + repr(key) + " is not a string")
+ if first:
+ first = False
+ else:
+ yield item_separator
+ yield _encoder(key)
+ yield _key_separator
+ if isinstance(value, basestring):
+ yield _encoder(value)
+ elif value is None:
+ yield 'null'
+ elif value is True:
+ yield 'true'
+ elif value is False:
+ yield 'false'
+ elif isinstance(value, (int, long)):
+ yield str(value)
+ elif isinstance(value, float):
+ yield _floatstr(value)
+ else:
+ if isinstance(value, (list, tuple)):
+ chunks = _iterencode_list(value, _current_indent_level)
+ elif isinstance(value, dict):
+ chunks = _iterencode_dict(value, _current_indent_level)
+ else:
+ chunks = _iterencode(value, _current_indent_level)
+ for chunk in chunks:
+ yield chunk
+ if newline_indent is not None:
+ _current_indent_level -= 1
+ yield '\n' + (' ' * (_indent * _current_indent_level))
+ yield '}'
+ if markers is not None:
+ del markers[markerid]
+
+ def _iterencode(o, _current_indent_level):
+ if isinstance(o, basestring):
+ yield _encoder(o)
+ elif o is None:
+ yield 'null'
+ elif o is True:
+ yield 'true'
+ elif o is False:
+ yield 'false'
+ elif isinstance(o, (int, long)):
+ yield str(o)
+ elif isinstance(o, float):
+ yield _floatstr(o)
+ elif isinstance(o, (list, tuple)):
+ for chunk in _iterencode_list(o, _current_indent_level):
+ yield chunk
+ elif isinstance(o, dict):
+ for chunk in _iterencode_dict(o, _current_indent_level):
+ yield chunk
+ else:
+ if markers is not None:
+ markerid = id(o)
+ if markerid in markers:
+ raise ValueError("Circular reference detected")
+ markers[markerid] = o
+ o = _default(o)
+ for chunk in _iterencode(o, _current_indent_level):
+ yield chunk
+ if markers is not None:
+ del markers[markerid]
+
+ return _iterencode
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
index 0000000000..259e9550f0
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/scanner.py
@@ -0,0 +1,67 @@
+"""JSON token scanner
+"""
+import re
+try:
+ from _json import make_scanner as c_make_scanner
+except ImportError:
+ c_make_scanner = None
+
+__all__ = ['make_scanner']
+
+NUMBER_RE = re.compile(
+ r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?',
+ (re.VERBOSE | re.MULTILINE | re.DOTALL))
+
+def py_make_scanner(context):
+ parse_object = context.parse_object
+ parse_array = context.parse_array
+ parse_string = context.parse_string
+ match_number = NUMBER_RE.match
+ encoding = context.encoding
+ strict = context.strict
+ parse_float = context.parse_float
+ parse_int = context.parse_int
+ parse_constant = context.parse_constant
+ object_hook = context.object_hook
+ object_pairs_hook = context.object_pairs_hook
+
+ def _scan_once(string, idx):
+ try:
+ nextchar = string[idx]
+ except IndexError:
+ raise StopIteration
+
+ if nextchar == '"':
+ return parse_string(string, idx + 1, encoding, strict)
+ elif nextchar == '{':
+ return parse_object((string, idx + 1), encoding, strict,
+ _scan_once, object_hook, object_pairs_hook)
+ elif nextchar == '[':
+ return parse_array((string, idx + 1), _scan_once)
+ elif nextchar == 'n' and string[idx:idx + 4] == 'null':
+ return None, idx + 4
+ elif nextchar == 't' and string[idx:idx + 4] == 'true':
+ return True, idx + 4
+ elif nextchar == 'f' and string[idx:idx + 5] == 'false':
+ return False, idx + 5
+
+ m = match_number(string, idx)
+ if m is not None:
+ integer, frac, exp = m.groups()
+ if frac or exp:
+ res = parse_float(integer + (frac or '') + (exp or ''))
+ else:
+ res = parse_int(integer)
+ return res, m.end()
+ elif nextchar == 'N' and string[idx:idx + 3] == 'NaN':
+ return parse_constant('NaN'), idx + 3
+ elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity':
+ return parse_constant('Infinity'), idx + 8
+ elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':
+ return parse_constant('-Infinity'), idx + 9
+ else:
+ raise StopIteration
+
+ return _scan_once
+
+make_scanner = c_make_scanner or py_make_scanner
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
index 0000000000..17d384937b
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/__init__.py
@@ -0,0 +1,73 @@
+import os
+import sys
+import json
+import doctest
+import unittest
+
+from test import test_support
+
+# import json with and without accelerations
+cjson = test_support.import_fresh_module('json', fresh=['_json'])
+pyjson = test_support.import_fresh_module('json', blocked=['_json'])
+
+# create two base classes that will be used by the other tests
+class PyTest(unittest.TestCase):
+ json = pyjson
+ loads = staticmethod(pyjson.loads)
+ dumps = staticmethod(pyjson.dumps)
+
+@unittest.skipUnless(cjson, 'requires _json')
+class CTest(unittest.TestCase):
+ if cjson is not None:
+ json = cjson
+ loads = staticmethod(cjson.loads)
+ dumps = staticmethod(cjson.dumps)
+
+# test PyTest and CTest checking if the functions come from the right module
+class TestPyTest(PyTest):
+ def test_pyjson(self):
+ self.assertEqual(self.json.scanner.make_scanner.__module__,
+ 'json.scanner')
+ self.assertEqual(self.json.decoder.scanstring.__module__,
+ 'json.decoder')
+ self.assertEqual(self.json.encoder.encode_basestring_ascii.__module__,
+ 'json.encoder')
+
+class TestCTest(CTest):
+ def test_cjson(self):
+ self.assertEqual(self.json.scanner.make_scanner.__module__, '_json')
+ self.assertEqual(self.json.decoder.scanstring.__module__, '_json')
+ self.assertEqual(self.json.encoder.c_make_encoder.__module__, '_json')
+ self.assertEqual(self.json.encoder.encode_basestring_ascii.__module__,
+ '_json')
+
+
+here = os.path.dirname(__file__)
+
+def test_suite():
+ suite = additional_tests()
+ loader = unittest.TestLoader()
+ for fn in os.listdir(here):
+ if fn.startswith("test") and fn.endswith(".py"):
+ modname = "json.tests." + fn[:-3]
+ __import__(modname)
+ module = sys.modules[modname]
+ suite.addTests(loader.loadTestsFromModule(module))
+ return suite
+
+def additional_tests():
+ suite = unittest.TestSuite()
+ for mod in (json, json.encoder, json.decoder):
+ suite.addTest(doctest.DocTestSuite(mod))
+ suite.addTest(TestPyTest('test_pyjson'))
+ suite.addTest(TestCTest('test_cjson'))
+ return suite
+
+def main():
+ suite = test_suite()
+ runner = unittest.TextTestRunner()
+ runner.run(suite)
+
+if __name__ == '__main__':
+ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
+ main()
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
index 0000000000..94a63c5beb
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_check_circular.py
@@ -0,0 +1,34 @@
+from json.tests import PyTest, CTest
+
+
+def default_iterable(obj):
+ return list(obj)
+
+class TestCheckCircular(object):
+ def test_circular_dict(self):
+ dct = {}
+ dct['a'] = dct
+ self.assertRaises(ValueError, self.dumps, dct)
+
+ def test_circular_list(self):
+ lst = []
+ lst.append(lst)
+ self.assertRaises(ValueError, self.dumps, lst)
+
+ def test_circular_composite(self):
+ dct2 = {}
+ dct2['a'] = []
+ dct2['a'].append(dct2)
+ self.assertRaises(ValueError, self.dumps, dct2)
+
+ def test_circular_default(self):
+ self.dumps([set()], default=default_iterable)
+ self.assertRaises(TypeError, self.dumps, [set()])
+
+ def test_circular_off_default(self):
+ self.dumps([set()], default=default_iterable, check_circular=False)
+ self.assertRaises(TypeError, self.dumps, [set()], check_circular=False)
+
+
+class TestPyCheckCircular(TestCheckCircular, PyTest): pass
+class TestCCheckCircular(TestCheckCircular, CTest): pass
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
index 0000000000..1c763c4c16
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_decode.py
@@ -0,0 +1,69 @@
+import decimal
+from StringIO import StringIO
+from collections import OrderedDict
+from json.tests import PyTest, CTest
+
+
+class TestDecode(object):
+ def test_decimal(self):
+ rval = self.loads('1.1', parse_float=decimal.Decimal)
+ self.assertTrue(isinstance(rval, decimal.Decimal))
+ self.assertEqual(rval, decimal.Decimal('1.1'))
+
+ def test_float(self):
+ rval = self.loads('1', parse_int=float)
+ self.assertTrue(isinstance(rval, float))
+ self.assertEqual(rval, 1.0)
+
+ def test_decoder_optimizations(self):
+ # Several optimizations were made that skip over calls to
+ # the whitespace regex, so this test is designed to try and
+ # exercise the uncommon cases. The array cases are already covered.
+ rval = self.loads('{ "key" : "value" , "k":"v" }')
+ self.assertEqual(rval, {"key":"value", "k":"v"})
+
+ def test_empty_objects(self):
+ self.assertEqual(self.loads('{}'), {})
+ self.assertEqual(self.loads('[]'), [])
+ self.assertEqual(self.loads('""'), u"")
+ self.assertIsInstance(self.loads('""'), unicode)
+
+ def test_object_pairs_hook(self):
+ s = '{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}'
+ p = [("xkd", 1), ("kcw", 2), ("art", 3), ("hxm", 4),
+ ("qrt", 5), ("pad", 6), ("hoy", 7)]
+ self.assertEqual(self.loads(s), eval(s))
+ self.assertEqual(self.loads(s, object_pairs_hook=lambda x: x), p)
+ self.assertEqual(self.json.load(StringIO(s),
+ object_pairs_hook=lambda x: x), p)
+ od = self.loads(s, object_pairs_hook=OrderedDict)
+ self.assertEqual(od, OrderedDict(p))
+ self.assertEqual(type(od), OrderedDict)
+ # the object_pairs_hook takes priority over the object_hook
+ self.assertEqual(self.loads(s, object_pairs_hook=OrderedDict,
+ object_hook=lambda x: None),
+ OrderedDict(p))
+ # check that empty objects literals work (see #17368)
+ self.assertEqual(self.loads('{}', object_pairs_hook=OrderedDict),
+ OrderedDict())
+ self.assertEqual(self.loads('{"empty": {}}',
+ object_pairs_hook=OrderedDict),
+ OrderedDict([('empty', OrderedDict())]))
+
+ def test_extra_data(self):
+ s = '[1, 2, 3]5'
+ msg = 'Extra data'
+ self.assertRaisesRegexp(ValueError, msg, self.loads, s)
+
+ def test_invalid_escape(self):
+ s = '["abc\\y"]'
+ msg = 'escape'
+ self.assertRaisesRegexp(ValueError, msg, self.loads, s)
+
+ def test_negative_index(self):
+ d = self.json.JSONDecoder()
+ self.assertRaises(ValueError, d.raw_decode, 'a'*42, -50000)
+ self.assertRaises(ValueError, d.raw_decode, u'a'*42, -50000)
+
+class TestPyDecode(TestDecode, PyTest): pass
+class TestCDecode(TestDecode, CTest): pass
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
index 0000000000..74aacee8e7
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_default.py
@@ -0,0 +1,12 @@
+from json.tests import PyTest, CTest
+
+
+class TestDefault(object):
+ def test_default(self):
+ self.assertEqual(
+ self.dumps(type, default=repr),
+ self.dumps(repr(type)))
+
+
+class TestPyDefault(TestDefault, PyTest): pass
+class TestCDefault(TestDefault, CTest): pass
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
index 0000000000..1b4661207d
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_dump.py
@@ -0,0 +1,32 @@
+from cStringIO import StringIO
+from json.tests import PyTest, CTest
+
+
+class TestDump(object):
+ def test_dump(self):
+ sio = StringIO()
+ self.json.dump({}, sio)
+ self.assertEqual(sio.getvalue(), '{}')
+
+ def test_dumps(self):
+ self.assertEqual(self.dumps({}), '{}')
+
+ def test_encode_truefalse(self):
+ self.assertEqual(self.dumps(
+ {True: False, False: True}, sort_keys=True),
+ '{"false": true, "true": false}')
+ self.assertEqual(self.dumps(
+ {2: 3.0, 4.0: 5L, False: 1, 6L: True}, sort_keys=True),
+ '{"false": 1, "2": 3.0, "4.0": 5, "6": true}')
+
+ # Issue 16228: Crash on encoding resized list
+ def test_encode_mutated(self):
+ a = [object()] * 10
+ def crasher(obj):
+ del a[-1]
+ self.assertEqual(self.dumps(a, default=crasher),
+ '[null, null, null, null, null]')
+
+
+class TestPyDump(TestDump, PyTest): pass
+class TestCDump(TestDump, CTest): pass
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
index 0000000000..d3a8d5cb02
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_encode_basestring_ascii.py
@@ -0,0 +1,41 @@
+from collections import OrderedDict
+from json.tests import PyTest, CTest
+
+
+CASES = [
+ (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~!@#$%^&*()_+-=[]{}|;:\',./<>?"'),
+ (u'\u0123\u4567\u89ab\ucdef\uabcd\uef4a', '"\\u0123\\u4567\\u89ab\\ucdef\\uabcd\\uef4a"'),
+ (u'controls', '"controls"'),
+ (u'\x08\x0c\n\r\t', '"\\b\\f\\n\\r\\t"'),
+ (u'{"object with 1 member":["array with 1 element"]}', '"{\\"object with 1 member\\":[\\"array with 1 element\\"]}"'),
+ (u' s p a c e d ', '" s p a c e d "'),
+ (u'\U0001d120', '"\\ud834\\udd20"'),
+ (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'),
+ ('\xce\xb1\xce\xa9', '"\\u03b1\\u03a9"'),
+ (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'),
+ ('\xce\xb1\xce\xa9', '"\\u03b1\\u03a9"'),
+ (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'),
+ (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'),
+ (u"`1~!@#$%^&*()_+-={':[,]}|;.</>?", '"`1~!@#$%^&*()_+-={\':[,]}|;.</>?"'),
+ (u'\x08\x0c\n\r\t', '"\\b\\f\\n\\r\\t"'),
+ (u'\u0123\u4567\u89ab\ucdef\uabcd\uef4a', '"\\u0123\\u4567\\u89ab\\ucdef\\uabcd\\uef4a"'),
+]
+
+class TestEncodeBasestringAscii(object):
+ def test_encode_basestring_ascii(self):
+ fname = self.json.encoder.encode_basestring_ascii.__name__
+ for input_string, expect in CASES:
+ result = self.json.encoder.encode_basestring_ascii(input_string)
+ self.assertEqual(result, expect,
+ '{0!r} != {1!r} for {2}({3!r})'.format(
+ result, expect, fname, input_string))
+
+ def test_ordered_dict(self):
+ # See issue 6105
+ items = [('one', 1), ('two', 2), ('three', 3), ('four', 4), ('five', 5)]
+ s = self.dumps(OrderedDict(items))
+ self.assertEqual(s, '{"one": 1, "two": 2, "three": 3, "four": 4, "five": 5}')
+
+
+class TestPyEncodeBasestringAscii(TestEncodeBasestringAscii, PyTest): pass
+class TestCEncodeBasestringAscii(TestEncodeBasestringAscii, CTest): pass
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
index 0000000000..2f249cb9ea
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_fail.py
@@ -0,0 +1,105 @@
+from json.tests import PyTest, CTest
+
+# 2007-10-05
+JSONDOCS = [
+ # http://json.org/JSON_checker/test/fail1.json
+ '"A JSON payload should be an object or array, not a string."',
+ # http://json.org/JSON_checker/test/fail2.json
+ '["Unclosed array"',
+ # http://json.org/JSON_checker/test/fail3.json
+ '{unquoted_key: "keys must be quoted"}',
+ # http://json.org/JSON_checker/test/fail4.json
+ '["extra comma",]',
+ # http://json.org/JSON_checker/test/fail5.json
+ '["double extra comma",,]',
+ # http://json.org/JSON_checker/test/fail6.json
+ '[ , "<-- missing value"]',
+ # http://json.org/JSON_checker/test/fail7.json
+ '["Comma after the close"],',
+ # http://json.org/JSON_checker/test/fail8.json
+ '["Extra close"]]',
+ # http://json.org/JSON_checker/test/fail9.json
+ '{"Extra comma": true,}',
+ # http://json.org/JSON_checker/test/fail10.json
+ '{"Extra value after close": true} "misplaced quoted value"',
+ # http://json.org/JSON_checker/test/fail11.json
+ '{"Illegal expression": 1 + 2}',
+ # http://json.org/JSON_checker/test/fail12.json
+ '{"Illegal invocation": alert()}',
+ # http://json.org/JSON_checker/test/fail13.json
+ '{"Numbers cannot have leading zeroes": 013}',
+ # http://json.org/JSON_checker/test/fail14.json
+ '{"Numbers cannot be hex": 0x14}',
+ # http://json.org/JSON_checker/test/fail15.json
+ '["Illegal backslash escape: \\x15"]',
+ # http://json.org/JSON_checker/test/fail16.json
+ '[\\naked]',
+ # http://json.org/JSON_checker/test/fail17.json
+ '["Illegal backslash escape: \\017"]',
+ # http://json.org/JSON_checker/test/fail18.json
+ '[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]',
+ # http://json.org/JSON_checker/test/fail19.json
+ '{"Missing colon" null}',
+ # http://json.org/JSON_checker/test/fail20.json
+ '{"Double colon":: null}',
+ # http://json.org/JSON_checker/test/fail21.json
+ '{"Comma instead of colon", null}',
+ # http://json.org/JSON_checker/test/fail22.json
+ '["Colon instead of comma": false]',
+ # http://json.org/JSON_checker/test/fail23.json
+ '["Bad value", truth]',
+ # http://json.org/JSON_checker/test/fail24.json
+ "['single quote']",
+ # http://json.org/JSON_checker/test/fail25.json
+ '["\ttab\tcharacter\tin\tstring\t"]',
+ # http://json.org/JSON_checker/test/fail26.json
+ '["tab\\ character\\ in\\ string\\ "]',
+ # http://json.org/JSON_checker/test/fail27.json
+ '["line\nbreak"]',
+ # http://json.org/JSON_checker/test/fail28.json
+ '["line\\\nbreak"]',
+ # http://json.org/JSON_checker/test/fail29.json
+ '[0e]',
+ # http://json.org/JSON_checker/test/fail30.json
+ '[0e+]',
+ # http://json.org/JSON_checker/test/fail31.json
+ '[0e+-1]',
+ # http://json.org/JSON_checker/test/fail32.json
+ '{"Comma instead if closing brace": true,',
+ # http://json.org/JSON_checker/test/fail33.json
+ '["mismatch"}',
+ # http://code.google.com/p/simplejson/issues/detail?id=3
+ u'["A\u001FZ control characters in string"]',
+]
+
+SKIPS = {
+ 1: "why not have a string payload?",
+ 18: "spec doesn't specify any nesting limitations",
+}
+
+class TestFail(object):
+ def test_failures(self):
+ for idx, doc in enumerate(JSONDOCS):
+ idx = idx + 1
+ if idx in SKIPS:
+ self.loads(doc)
+ continue
+ try:
+ self.loads(doc)
+ except ValueError:
+ pass
+ else:
+ self.fail("Expected failure for fail{0}.json: {1!r}".format(idx, doc))
+
+ def test_non_string_keys_dict(self):
+ data = {'a' : 1, (1, 2) : 2}
+
+ #This is for c encoder
+ self.assertRaises(TypeError, self.dumps, data)
+
+ #This is for python encoder
+ self.assertRaises(TypeError, self.dumps, data, indent=True)
+
+
+class TestPyFail(TestFail, PyTest): pass
+class TestCFail(TestFail, CTest): pass
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
index 0000000000..1fba25be0e
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_float.py
@@ -0,0 +1,37 @@
+import math
+from json.tests import PyTest, CTest
+
+
+class TestFloat(object):
+ def test_floats(self):
+ for num in [1617161771.7650001, math.pi, math.pi**100,
+ math.pi**-100, 3.1]:
+ self.assertEqual(float(self.dumps(num)), num)
+ self.assertEqual(self.loads(self.dumps(num)), num)
+ self.assertEqual(self.loads(unicode(self.dumps(num))), num)
+
+ def test_ints(self):
+ for num in [1, 1L, 1<<32, 1<<64]:
+ self.assertEqual(self.dumps(num), str(num))
+ self.assertEqual(int(self.dumps(num)), num)
+ self.assertEqual(self.loads(self.dumps(num)), num)
+ self.assertEqual(self.loads(unicode(self.dumps(num))), num)
+
+ def test_out_of_range(self):
+ self.assertEqual(self.loads('[23456789012E666]'), [float('inf')])
+ self.assertEqual(self.loads('[-23456789012E666]'), [float('-inf')])
+
+ def test_allow_nan(self):
+ for val in (float('inf'), float('-inf'), float('nan')):
+ out = self.dumps([val])
+ if val == val: # inf
+ self.assertEqual(self.loads(out), [val])
+ else: # nan
+ res = self.loads(out)
+ self.assertEqual(len(res), 1)
+ self.assertNotEqual(res[0], res[0])
+ self.assertRaises(ValueError, self.dumps, [val], allow_nan=False)
+
+
+class TestPyFloat(TestFloat, PyTest): pass
+class TestCFloat(TestFloat, CTest): pass
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
index 0000000000..866abb1626
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_indent.py
@@ -0,0 +1,60 @@
+import textwrap
+from StringIO import StringIO
+from json.tests import PyTest, CTest
+
+
+class TestIndent(object):
+ def test_indent(self):
+ h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 'i-vhbjkhnth',
+ {'nifty': 87}, {'field': 'yes', 'morefield': False} ]
+
+ expect = textwrap.dedent("""\
+ [
+ [
+ "blorpie"
+ ],
+ [
+ "whoops"
+ ],
+ [],
+ "d-shtaeou",
+ "d-nthiouh",
+ "i-vhbjkhnth",
+ {
+ "nifty": 87
+ },
+ {
+ "field": "yes",
+ "morefield": false
+ }
+ ]""")
+
+
+ d1 = self.dumps(h)
+ d2 = self.dumps(h, indent=2, sort_keys=True, separators=(',', ': '))
+
+ h1 = self.loads(d1)
+ h2 = self.loads(d2)
+
+ self.assertEqual(h1, h)
+ self.assertEqual(h2, h)
+ self.assertEqual(d2, expect)
+
+ def test_indent0(self):
+ h = {3: 1}
+ def check(indent, expected):
+ d1 = self.dumps(h, indent=indent)
+ self.assertEqual(d1, expected)
+
+ sio = StringIO()
+ self.json.dump(h, sio, indent=indent)
+ self.assertEqual(sio.getvalue(), expected)
+
+ # indent=0 should emit newlines
+ check(0, '{\n"3": 1\n}')
+ # indent=None is more compact
+ check(None, '{"3": 1}')
+
+
+class TestPyIndent(TestIndent, PyTest): pass
+class TestCIndent(TestIndent, CTest): pass
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
index 0000000000..8bf73bcc71
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass1.py
@@ -0,0 +1,75 @@
+from json.tests import PyTest, CTest
+
+
+# from http://json.org/JSON_checker/test/pass1.json
+JSON = r'''
+[
+ "JSON Test Pattern pass1",
+ {"object with 1 member":["array with 1 element"]},
+ {},
+ [],
+ -42,
+ true,
+ false,
+ null,
+ {
+ "integer": 1234567890,
+ "real": -9876.543210,
+ "e": 0.123456789e-12,
+ "E": 1.234567890E+34,
+ "": 23456789012E66,
+ "zero": 0,
+ "one": 1,
+ "space": " ",
+ "quote": "\"",
+ "backslash": "\\",
+ "controls": "\b\f\n\r\t",
+ "slash": "/ & \/",
+ "alpha": "abcdefghijklmnopqrstuvwyz",
+ "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",
+ "digit": "0123456789",
+ "0123456789": "digit",
+ "special": "`1~!@#$%^&*()_+-={':[,]}|;.</>?",
+ "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A",
+ "true": true,
+ "false": false,
+ "null": null,
+ "array":[ ],
+ "object":{ },
+ "address": "50 St. James Street",
+ "url": "http://www.JSON.org/",
+ "comment": "// /* <!-- --",
+ "# -- --> */": " ",
+ " s p a c e d " :[1,2 , 3
+
+,
+
+4 , 5 , 6 ,7 ],"compact":[1,2,3,4,5,6,7],
+ "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}",
+ "quotes": "&#34; \u0022 %22 0x22 034 &#x22;",
+ "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?"
+: "A key can be any string"
+ },
+ 0.5 ,98.6
+,
+99.44
+,
+
+1066,
+1e1,
+0.1e1,
+1e-1,
+1e00,2e+00,2e-00
+,"rosebud"]
+'''
+
+class TestPass1(object):
+ def test_parse(self):
+ # test in/out equivalence and parsing
+ res = self.loads(JSON)
+ out = self.dumps(res)
+ self.assertEqual(res, self.loads(out))
+
+
+class TestPyPass1(TestPass1, PyTest): pass
+class TestCPass1(TestPass1, CTest): pass
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
index 0000000000..49724901e9
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass2.py
@@ -0,0 +1,18 @@
+from json.tests import PyTest, CTest
+
+
+# from http://json.org/JSON_checker/test/pass2.json
+JSON = r'''
+[[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]]
+'''
+
+class TestPass2(object):
+ def test_parse(self):
+ # test in/out equivalence and parsing
+ res = self.loads(JSON)
+ out = self.dumps(res)
+ self.assertEqual(res, self.loads(out))
+
+
+class TestPyPass2(TestPass2, PyTest): pass
+class TestCPass2(TestPass2, CTest): pass
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
index 0000000000..8dc6d7690f
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass3.py
@@ -0,0 +1,24 @@
+from json.tests import PyTest, CTest
+
+
+# from http://json.org/JSON_checker/test/pass3.json
+JSON = r'''
+{
+ "JSON Test Pattern pass3": {
+ "The outermost value": "must be an object or array.",
+ "In this test": "It is an object."
+ }
+}
+'''
+
+
+class TestPass3(object):
+ def test_parse(self):
+ # test in/out equivalence and parsing
+ res = self.loads(JSON)
+ out = self.dumps(res)
+ self.assertEqual(res, self.loads(out))
+
+
+class TestPyPass3(TestPass3, PyTest): pass
+class TestCPass3(TestPass3, CTest): pass
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
index 0000000000..016cd81017
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_recursion.py
@@ -0,0 +1,108 @@
+from json.tests import PyTest, CTest
+
+
+class JSONTestObject:
+ pass
+
+
+class TestRecursion(object):
+ def test_listrecursion(self):
+ x = []
+ x.append(x)
+ try:
+ self.dumps(x)
+ except ValueError:
+ pass
+ else:
+ self.fail("didn't raise ValueError on list recursion")
+ x = []
+ y = [x]
+ x.append(y)
+ try:
+ self.dumps(x)
+ except ValueError:
+ pass
+ else:
+ self.fail("didn't raise ValueError on alternating list recursion")
+ y = []
+ x = [y, y]
+ # ensure that the marker is cleared
+ self.dumps(x)
+
+ def test_dictrecursion(self):
+ x = {}
+ x["test"] = x
+ try:
+ self.dumps(x)
+ except ValueError:
+ pass
+ else:
+ self.fail("didn't raise ValueError on dict recursion")
+ x = {}
+ y = {"a": x, "b": x}
+ # ensure that the marker is cleared
+ self.dumps(x)
+
+ def test_defaultrecursion(self):
+ class RecursiveJSONEncoder(self.json.JSONEncoder):
+ recurse = False
+ def default(self, o):
+ if o is JSONTestObject:
+ if self.recurse:
+ return [JSONTestObject]
+ else:
+ return 'JSONTestObject'
+ return pyjson.JSONEncoder.default(o)
+
+ enc = RecursiveJSONEncoder()
+ self.assertEqual(enc.encode(JSONTestObject), '"JSONTestObject"')
+ enc.recurse = True
+ try:
+ enc.encode(JSONTestObject)
+ except ValueError:
+ pass
+ else:
+ self.fail("didn't raise ValueError on default recursion")
+
+
+ def test_highly_nested_objects_decoding(self):
+ # test that loading highly-nested objects doesn't segfault when C
+ # accelerations are used. See #12017
+ # str
+ with self.assertRaises(RuntimeError):
+ self.loads('{"a":' * 100000 + '1' + '}' * 100000)
+ with self.assertRaises(RuntimeError):
+ self.loads('{"a":' * 100000 + '[1]' + '}' * 100000)
+ with self.assertRaises(RuntimeError):
+ self.loads('[' * 100000 + '1' + ']' * 100000)
+ # unicode
+ with self.assertRaises(RuntimeError):
+ self.loads(u'{"a":' * 100000 + u'1' + u'}' * 100000)
+ with self.assertRaises(RuntimeError):
+ self.loads(u'{"a":' * 100000 + u'[1]' + u'}' * 100000)
+ with self.assertRaises(RuntimeError):
+ self.loads(u'[' * 100000 + u'1' + u']' * 100000)
+
+ def test_highly_nested_objects_encoding(self):
+ # See #12051
+ l, d = [], {}
+ for x in xrange(100000):
+ l, d = [l], {'k':d}
+ with self.assertRaises(RuntimeError):
+ self.dumps(l)
+ with self.assertRaises(RuntimeError):
+ self.dumps(d)
+
+ def test_endless_recursion(self):
+ # See #12051
+ class EndlessJSONEncoder(self.json.JSONEncoder):
+ def default(self, o):
+ """If check_circular is False, this will keep adding another list."""
+ return [o]
+
+ with self.assertRaises(RuntimeError):
+ EndlessJSONEncoder(check_circular=False).encode(5j)
+
+
+class TestPyRecursion(TestRecursion, PyTest): pass
+class TestCRecursion(TestRecursion, CTest): pass
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
index 0000000000..f4f7b00e05
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_scanstring.py
@@ -0,0 +1,157 @@
+import sys
+from json.tests import PyTest, CTest
+
+
+class TestScanstring(object):
+ def test_scanstring(self):
+ scanstring = self.json.decoder.scanstring
+ if sys.maxunicode == 65535:
+ self.assertEqual(
+ scanstring(u'"z\U0001d120x"', 1, None, True),
+ (u'z\U0001d120x', 6))
+ else:
+ self.assertEqual(
+ scanstring(u'"z\U0001d120x"', 1, None, True),
+ (u'z\U0001d120x', 5))
+
+ self.assertEqual(
+ scanstring('"\\u007b"', 1, None, True),
+ (u'{', 8))
+
+ self.assertEqual(
+ scanstring('"A JSON payload should be an object or array, not a string."', 1, None, True),
+ (u'A JSON payload should be an object or array, not a string.', 60))
+
+ self.assertEqual(
+ scanstring('["Unclosed array"', 2, None, True),
+ (u'Unclosed array', 17))
+
+ self.assertEqual(
+ scanstring('["extra comma",]', 2, None, True),
+ (u'extra comma', 14))
+
+ self.assertEqual(
+ scanstring('["double extra comma",,]', 2, None, True),
+ (u'double extra comma', 21))
+
+ self.assertEqual(
+ scanstring('["Comma after the close"],', 2, None, True),
+ (u'Comma after the close', 24))
+
+ self.assertEqual(
+ scanstring('["Extra close"]]', 2, None, True),
+ (u'Extra close', 14))
+
+ self.assertEqual(
+ scanstring('{"Extra comma": true,}', 2, None, True),
+ (u'Extra comma', 14))
+
+ self.assertEqual(
+ scanstring('{"Extra value after close": true} "misplaced quoted value"', 2, None, True),
+ (u'Extra value after close', 26))
+
+ self.assertEqual(
+ scanstring('{"Illegal expression": 1 + 2}', 2, None, True),
+ (u'Illegal expression', 21))
+
+ self.assertEqual(
+ scanstring('{"Illegal invocation": alert()}', 2, None, True),
+ (u'Illegal invocation', 21))
+
+ self.assertEqual(
+ scanstring('{"Numbers cannot have leading zeroes": 013}', 2, None, True),
+ (u'Numbers cannot have leading zeroes', 37))
+
+ self.assertEqual(
+ scanstring('{"Numbers cannot be hex": 0x14}', 2, None, True),
+ (u'Numbers cannot be hex', 24))
+
+ self.assertEqual(
+ scanstring('[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]', 21, None, True),
+ (u'Too deep', 30))
+
+ self.assertEqual(
+ scanstring('{"Missing colon" null}', 2, None, True),
+ (u'Missing colon', 16))
+
+ self.assertEqual(
+ scanstring('{"Double colon":: null}', 2, None, True),
+ (u'Double colon', 15))
+
+ self.assertEqual(
+ scanstring('{"Comma instead of colon", null}', 2, None, True),
+ (u'Comma instead of colon', 25))
+
+ self.assertEqual(
+ scanstring('["Colon instead of comma": false]', 2, None, True),
+ (u'Colon instead of comma', 25))
+
+ self.assertEqual(
+ scanstring('["Bad value", truth]', 2, None, True),
+ (u'Bad value', 12))
+
+ def test_surrogates(self):
+ scanstring = self.json.decoder.scanstring
+ def assertScan(given, expect):
+ self.assertEqual(scanstring(given, 1, None, True),
+ (expect, len(given)))
+ if not isinstance(given, unicode):
+ given = unicode(given)
+ self.assertEqual(scanstring(given, 1, None, True),
+ (expect, len(given)))
+
+ surrogates = unichr(0xd834) + unichr(0xdd20)
+ assertScan('"z\\ud834\\u0079x"', u'z\ud834yx')
+ assertScan('"z\\ud834\\udd20x"', u'z\U0001d120x')
+ assertScan('"z\\ud834\\ud834\\udd20x"', u'z\ud834\U0001d120x')
+ assertScan('"z\\ud834x"', u'z\ud834x')
+ assertScan(u'"z\\ud834\udd20x12345"', u'z%sx12345' % surrogates)
+ assertScan('"z\\udd20x"', u'z\udd20x')
+ assertScan(u'"z\ud834\udd20x"', u'z\ud834\udd20x')
+ assertScan(u'"z\ud834\\udd20x"', u'z%sx' % surrogates)
+ assertScan(u'"z\ud834x"', u'z\ud834x')
+
+ def test_bad_escapes(self):
+ scanstring = self.json.decoder.scanstring
+ bad_escapes = [
+ '"\\"',
+ '"\\x"',
+ '"\\u"',
+ '"\\u0"',
+ '"\\u01"',
+ '"\\u012"',
+ '"\\uz012"',
+ '"\\u0z12"',
+ '"\\u01z2"',
+ '"\\u012z"',
+ '"\\u0x12"',
+ '"\\u0X12"',
+ '"\\ud834\\"',
+ '"\\ud834\\u"',
+ '"\\ud834\\ud"',
+ '"\\ud834\\udd"',
+ '"\\ud834\\udd2"',
+ '"\\ud834\\uzdd2"',
+ '"\\ud834\\udzd2"',
+ '"\\ud834\\uddz2"',
+ '"\\ud834\\udd2z"',
+ '"\\ud834\\u0x20"',
+ '"\\ud834\\u0X20"',
+ ]
+ for s in bad_escapes:
+ with self.assertRaises(ValueError):
+ scanstring(s, 1, None, True)
+
+ def test_issue3623(self):
+ self.assertRaises(ValueError, self.json.decoder.scanstring, b"xxx", 1,
+ "xxx")
+ self.assertRaises(UnicodeDecodeError,
+ self.json.encoder.encode_basestring_ascii, b"xx\xff")
+
+ def test_overflow(self):
+ with self.assertRaises(OverflowError):
+ self.json.decoder.scanstring(b"xxx", sys.maxsize+1)
+
+
+class TestPyScanstring(TestScanstring, PyTest): pass
+class TestCScanstring(TestScanstring, CTest): pass
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
index 0000000000..b468c3bd31
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_separators.py
@@ -0,0 +1,44 @@
+import textwrap
+from json.tests import PyTest, CTest
+
+
+class TestSeparators(object):
+ def test_separators(self):
+ h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 'i-vhbjkhnth',
+ {'nifty': 87}, {'field': 'yes', 'morefield': False} ]
+
+ expect = textwrap.dedent("""\
+ [
+ [
+ "blorpie"
+ ] ,
+ [
+ "whoops"
+ ] ,
+ [] ,
+ "d-shtaeou" ,
+ "d-nthiouh" ,
+ "i-vhbjkhnth" ,
+ {
+ "nifty" : 87
+ } ,
+ {
+ "field" : "yes" ,
+ "morefield" : false
+ }
+ ]""")
+
+
+ d1 = self.dumps(h)
+ d2 = self.dumps(h, indent=2, sort_keys=True, separators=(' ,', ' : '))
+
+ h1 = self.loads(d1)
+ h2 = self.loads(d2)
+
+ self.assertEqual(h1, h)
+ self.assertEqual(h2, h)
+ self.assertEqual(d2, expect)
+
+
+class TestPySeparators(TestSeparators, PyTest): pass
+class TestCSeparators(TestSeparators, CTest): pass
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
index 0000000000..bc0e00d9b2
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_speedups.py
@@ -0,0 +1,23 @@
+from json.tests import CTest
+
+
+class TestSpeedups(CTest):
+ def test_scanstring(self):
+ self.assertEqual(self.json.decoder.scanstring.__module__, "_json")
+ self.assertIs(self.json.decoder.scanstring, self.json.decoder.c_scanstring)
+
+ def test_encode_basestring_ascii(self):
+ self.assertEqual(self.json.encoder.encode_basestring_ascii.__module__,
+ "_json")
+ self.assertIs(self.json.encoder.encode_basestring_ascii,
+ self.json.encoder.c_encode_basestring_ascii)
+
+class TestDecode(CTest):
+ def test_make_scanner(self):
+ self.assertRaises(AttributeError, self.json.scanner.c_make_scanner, 1)
+
+ def test_make_encoder(self):
+ self.assertRaises(TypeError, self.json.encoder.c_make_encoder,
+ None,
+ "\xCD\x7D\x3D\x4E\x12\x4C\xF9\x79\xD7\x52\xBA\x82\xF2\x27\x4A\x7D\xA0\xCA\x75",
+ None)
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
index 0000000000..b45c1e2e44
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_tool.py
@@ -0,0 +1,69 @@
+import os
+import sys
+import textwrap
+import unittest
+import subprocess
+from test import test_support
+from test.script_helper import assert_python_ok
+
+class TestTool(unittest.TestCase):
+ data = """
+
+ [["blorpie"],[ "whoops" ] , [
+ ],\t"d-shtaeou",\r"d-nthiouh",
+ "i-vhbjkhnth", {"nifty":87}, {"morefield" :\tfalse,"field"
+ :"yes"} ]
+ """
+
+ expect = textwrap.dedent("""\
+ [
+ [
+ "blorpie"
+ ],
+ [
+ "whoops"
+ ],
+ [],
+ "d-shtaeou",
+ "d-nthiouh",
+ "i-vhbjkhnth",
+ {
+ "nifty": 87
+ },
+ {
+ "field": "yes",
+ "morefield": false
+ }
+ ]
+ """)
+
+ def test_stdin_stdout(self):
+ proc = subprocess.Popen(
+ (sys.executable, '-m', 'json.tool'),
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+ out, err = proc.communicate(self.data.encode())
+ self.assertEqual(out.splitlines(), self.expect.encode().splitlines())
+ self.assertEqual(err, None)
+
+ def _create_infile(self):
+ infile = test_support.TESTFN
+ with open(infile, "w") as fp:
+ self.addCleanup(os.remove, infile)
+ fp.write(self.data)
+ return infile
+
+ def test_infile_stdout(self):
+ infile = self._create_infile()
+ rc, out, err = assert_python_ok('-m', 'json.tool', infile)
+ self.assertEqual(out.splitlines(), self.expect.encode().splitlines())
+ self.assertEqual(err, b'')
+
+ def test_infile_outfile(self):
+ infile = self._create_infile()
+ outfile = test_support.TESTFN + '.out'
+ rc, out, err = assert_python_ok('-m', 'json.tool', infile, outfile)
+ self.addCleanup(os.remove, outfile)
+ with open(outfile, "r") as fp:
+ self.assertEqual(fp.read(), self.expect)
+ self.assertEqual(out, b'')
+ self.assertEqual(err, b'')
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
index 0000000000..4edc69a8c1
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_unicode.py
@@ -0,0 +1,89 @@
+from collections import OrderedDict
+from json.tests import PyTest, CTest
+
+
+class TestUnicode(object):
+ def test_encoding1(self):
+ encoder = self.json.JSONEncoder(encoding='utf-8')
+ u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
+ s = u.encode('utf-8')
+ ju = encoder.encode(u)
+ js = encoder.encode(s)
+ self.assertEqual(ju, js)
+
+ def test_encoding2(self):
+ u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
+ s = u.encode('utf-8')
+ ju = self.dumps(u, encoding='utf-8')
+ js = self.dumps(s, encoding='utf-8')
+ self.assertEqual(ju, js)
+
+ def test_encoding3(self):
+ u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
+ j = self.dumps(u)
+ self.assertEqual(j, '"\\u03b1\\u03a9"')
+
+ def test_encoding4(self):
+ u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
+ j = self.dumps([u])
+ self.assertEqual(j, '["\\u03b1\\u03a9"]')
+
+ def test_encoding5(self):
+ u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
+ j = self.dumps(u, ensure_ascii=False)
+ self.assertEqual(j, u'"{0}"'.format(u))
+
+ def test_encoding6(self):
+ u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
+ j = self.dumps([u], ensure_ascii=False)
+ self.assertEqual(j, u'["{0}"]'.format(u))
+
+ def test_big_unicode_encode(self):
+ u = u'\U0001d120'
+ self.assertEqual(self.dumps(u), '"\\ud834\\udd20"')
+ self.assertEqual(self.dumps(u, ensure_ascii=False), u'"\U0001d120"')
+
+ def test_big_unicode_decode(self):
+ u = u'z\U0001d120x'
+ self.assertEqual(self.loads('"' + u + '"'), u)
+ self.assertEqual(self.loads('"z\\ud834\\udd20x"'), u)
+
+ def test_unicode_decode(self):
+ for i in range(0, 0xd7ff):
+ u = unichr(i)
+ s = '"\\u{0:04x}"'.format(i)
+ self.assertEqual(self.loads(s), u)
+
+ def test_object_pairs_hook_with_unicode(self):
+ s = u'{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}'
+ p = [(u"xkd", 1), (u"kcw", 2), (u"art", 3), (u"hxm", 4),
+ (u"qrt", 5), (u"pad", 6), (u"hoy", 7)]
+ self.assertEqual(self.loads(s), eval(s))
+ self.assertEqual(self.loads(s, object_pairs_hook = lambda x: x), p)
+ od = self.loads(s, object_pairs_hook = OrderedDict)
+ self.assertEqual(od, OrderedDict(p))
+ self.assertEqual(type(od), OrderedDict)
+ # the object_pairs_hook takes priority over the object_hook
+ self.assertEqual(self.loads(s,
+ object_pairs_hook = OrderedDict,
+ object_hook = lambda x: None),
+ OrderedDict(p))
+
+ def test_default_encoding(self):
+ self.assertEqual(self.loads(u'{"a": "\xe9"}'.encode('utf-8')),
+ {'a': u'\xe9'})
+
+ def test_unicode_preservation(self):
+ self.assertEqual(type(self.loads(u'""')), unicode)
+ self.assertEqual(type(self.loads(u'"a"')), unicode)
+ self.assertEqual(type(self.loads(u'["a"]')[0]), unicode)
+ # Issue 10038.
+ self.assertEqual(type(self.loads('"foo"')), unicode)
+
+ def test_bad_encoding(self):
+ self.assertRaises(UnicodeEncodeError, self.loads, '"a"', u"rat\xe9")
+ self.assertRaises(TypeError, self.loads, '"a"', 1)
+
+
+class TestPyUnicode(TestUnicode, PyTest): pass
+class TestCUnicode(TestUnicode, CTest): pass
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
index 0000000000..ea96f6b7ad
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tool.py
@@ -0,0 +1,40 @@
+r"""Command-line tool to validate and pretty-print JSON
+
+Usage::
+
+ $ echo '{"json":"obj"}' | python -m json.tool
+ {
+ "json": "obj"
+ }
+ $ echo '{ 1.2:3.4}' | python -m json.tool
+ Expecting property name enclosed in double quotes: line 1 column 3 (char 2)
+
+"""
+import sys
+import json
+
+def main():
+ if len(sys.argv) == 1:
+ infile = sys.stdin
+ outfile = sys.stdout
+ elif len(sys.argv) == 2:
+ infile = open(sys.argv[1], 'rb')
+ outfile = sys.stdout
+ elif len(sys.argv) == 3:
+ infile = open(sys.argv[1], 'rb')
+ outfile = open(sys.argv[2], 'wb')
+ else:
+ raise SystemExit(sys.argv[0] + " [infile [outfile]]")
+ with infile:
+ try:
+ obj = json.load(infile)
+ except ValueError, e:
+ raise SystemExit(e)
+ with outfile:
+ json.dump(obj, outfile, sort_keys=True,
+ indent=4, separators=(',', ': '))
+ outfile.write('\n')
+
+
+if __name__ == '__main__':
+ main()
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
index 0000000000..d8a0746a0d
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/keyword.py
@@ -0,0 +1,93 @@
+#! /usr/bin/env python
+
+"""Keywords (from "graminit.c")
+
+This file is automatically generated; please don't muck it up!
+
+To update the symbols in this file, 'cd' to the top directory of
+the python source tree after building the interpreter and run:
+
+ ./python Lib/keyword.py
+"""
+
+__all__ = ["iskeyword", "kwlist"]
+
+kwlist = [
+#--start keywords--
+ 'and',
+ 'as',
+ 'assert',
+ 'break',
+ 'class',
+ 'continue',
+ 'def',
+ 'del',
+ 'elif',
+ 'else',
+ 'except',
+ 'exec',
+ 'finally',
+ 'for',
+ 'from',
+ 'global',
+ 'if',
+ 'import',
+ 'in',
+ 'is',
+ 'lambda',
+ 'not',
+ 'or',
+ 'pass',
+ 'print',
+ 'raise',
+ 'return',
+ 'try',
+ 'while',
+ 'with',
+ 'yield',
+#--end keywords--
+ ]
+
+iskeyword = frozenset(kwlist).__contains__
+
+def main():
+ import sys, re
+
+ args = sys.argv[1:]
+ iptfile = args and args[0] or "Python/graminit.c"
+ if len(args) > 1: optfile = args[1]
+ else: optfile = "Lib/keyword.py"
+
+ # scan the source file for keywords
+ fp = open(iptfile)
+ strprog = re.compile('"([^"]+)"')
+ lines = []
+ for line in fp:
+ if '{1, "' in line:
+ match = strprog.search(line)
+ if match:
+ lines.append(" '" + match.group(1) + "',\n")
+ fp.close()
+ lines.sort()
+
+ # load the output skeleton from the target
+ fp = open(optfile)
+ format = fp.readlines()
+ fp.close()
+
+ # insert the lines of keywords
+ try:
+ start = format.index("#--start keywords--\n") + 1
+ end = format.index("#--end keywords--\n")
+ format[start:end] = lines
+ except ValueError:
+ sys.stderr.write("target does not contain format markers\n")
+ sys.exit(1)
+
+ # write the output file
+ fp = open(optfile, 'w')
+ fp.write(''.join(format))
+ fp.close()
+
+if __name__ == "__main__":
+ main()
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
index 0000000000..1495348b66
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/linecache.py
@@ -0,0 +1,139 @@
+"""Cache lines from files.
+
+This is intended to read lines from modules imported -- hence if a filename
+is not found, it will look down the module search path for a file by
+that name.
+"""
+
+import sys
+import os
+
+__all__ = ["getline", "clearcache", "checkcache"]
+
+def getline(filename, lineno, module_globals=None):
+ lines = getlines(filename, module_globals)
+ if 1 <= lineno <= len(lines):
+ return lines[lineno-1]
+ else:
+ return ''
+
+
+# The cache
+
+cache = {} # The cache
+
+
+def clearcache():
+ """Clear the cache entirely."""
+
+ global cache
+ cache = {}
+
+
+def getlines(filename, module_globals=None):
+ """Get the lines for a file from the cache.
+ Update the cache if it doesn't contain an entry for this file already."""
+
+ if filename in cache:
+ return cache[filename][2]
+
+ try:
+ return updatecache(filename, module_globals)
+ except MemoryError:
+ clearcache()
+ return []
+
+
+def checkcache(filename=None):
+ """Discard cache entries that are out of date.
+ (This is not checked upon each call!)"""
+
+ if filename is None:
+ filenames = cache.keys()
+ else:
+ if filename in cache:
+ filenames = [filename]
+ else:
+ return
+
+ for filename in filenames:
+ size, mtime, lines, fullname = cache[filename]
+ if mtime is None:
+ continue # no-op for files loaded via a __loader__
+ try:
+ stat = os.stat(fullname)
+ except os.error:
+ del cache[filename]
+ continue
+ if size != stat.st_size or mtime != stat.st_mtime:
+ del cache[filename]
+
+
+def updatecache(filename, module_globals=None):
+ """Update a cache entry and return its list of lines.
+ If something's wrong, print a message, discard the cache entry,
+ and return an empty list."""
+
+ if filename in cache:
+ del cache[filename]
+ if not filename or (filename.startswith('<') and filename.endswith('>')):
+ return []
+
+ fullname = filename
+ try:
+ stat = os.stat(fullname)
+ except OSError:
+ basename = filename
+
+ # Try for a __loader__, if available
+ if module_globals and '__loader__' in module_globals:
+ name = module_globals.get('__name__')
+ loader = module_globals['__loader__']
+ get_source = getattr(loader, 'get_source', None)
+
+ if name and get_source:
+ try:
+ data = get_source(name)
+ except (ImportError, IOError):
+ pass
+ else:
+ if data is None:
+ # No luck, the PEP302 loader cannot find the source
+ # for this module.
+ return []
+ cache[filename] = (
+ len(data), None,
+ [line+'\n' for line in data.splitlines()], fullname
+ )
+ return cache[filename][2]
+
+ # Try looking through the module search path, which is only useful
+ # when handling a relative filename.
+ if os.path.isabs(filename):
+ return []
+
+ for dirname in sys.path:
+ # When using imputil, sys.path may contain things other than
+ # strings; ignore them when it happens.
+ try:
+ fullname = os.path.join(dirname, basename)
+ except (TypeError, AttributeError):
+ # Not sufficiently string-like to do anything useful with.
+ continue
+ try:
+ stat = os.stat(fullname)
+ break
+ except os.error:
+ pass
+ else:
+ return []
+ try:
+ with open(fullname, 'rU') as fp:
+ lines = fp.readlines()
+ except IOError:
+ return []
+ if lines and not lines[-1].endswith('\n'):
+ lines[-1] += '\n'
+ size, mtime = stat.st_size, stat.st_mtime
+ cache[filename] = size, mtime, lines, fullname
+ return lines
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
index 0000000000..7d466bf433
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/locale.py
@@ -0,0 +1,2062 @@
+""" Locale support.
+
+ The module provides low-level access to the C lib's locale APIs
+ and adds high level number formatting APIs as well as a locale
+ aliasing engine to complement these.
+
+ The aliasing engine includes support for many commonly used locale
+ names and maps them to values suitable for passing to the C lib's
+ setlocale() function. It also includes default encodings for all
+ supported locale names.
+
+"""
+
+import sys
+import encodings
+import encodings.aliases
+import re
+import operator
+import functools
+
+try:
+ _unicode = unicode
+except NameError:
+ # If Python is built without Unicode support, the unicode type
+ # will not exist. Fake one.
+ class _unicode(object):
+ pass
+
+# Try importing the _locale module.
+#
+# If this fails, fall back on a basic 'C' locale emulation.
+
+# Yuck: LC_MESSAGES is non-standard: can't tell whether it exists before
+# trying the import. So __all__ is also fiddled at the end of the file.
+__all__ = ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error",
+ "setlocale", "resetlocale", "localeconv", "strcoll", "strxfrm",
+ "str", "atof", "atoi", "format", "format_string", "currency",
+ "normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY",
+ "LC_NUMERIC", "LC_ALL", "CHAR_MAX"]
+
+try:
+
+ from _locale import *
+
+except ImportError:
+
+ # Locale emulation
+
+ CHAR_MAX = 127
+ LC_ALL = 6
+ LC_COLLATE = 3
+ LC_CTYPE = 0
+ LC_MESSAGES = 5
+ LC_MONETARY = 4
+ LC_NUMERIC = 1
+ LC_TIME = 2
+ Error = ValueError
+
+ def localeconv():
+ """ localeconv() -> dict.
+ Returns numeric and monetary locale-specific parameters.
+ """
+ # 'C' locale default values
+ return {'grouping': [127],
+ 'currency_symbol': '',
+ 'n_sign_posn': 127,
+ 'p_cs_precedes': 127,
+ 'n_cs_precedes': 127,
+ 'mon_grouping': [],
+ 'n_sep_by_space': 127,
+ 'decimal_point': '.',
+ 'negative_sign': '',
+ 'positive_sign': '',
+ 'p_sep_by_space': 127,
+ 'int_curr_symbol': '',
+ 'p_sign_posn': 127,
+ 'thousands_sep': '',
+ 'mon_thousands_sep': '',
+ 'frac_digits': 127,
+ 'mon_decimal_point': '',
+ 'int_frac_digits': 127}
+
+ def setlocale(category, value=None):
+ """ setlocale(integer,string=None) -> string.
+ Activates/queries locale processing.
+ """
+ if value not in (None, '', 'C'):
+ raise Error, '_locale emulation only supports "C" locale'
+ return 'C'
+
+ def strcoll(a,b):
+ """ strcoll(string,string) -> int.
+ Compares two strings according to the locale.
+ """
+ return cmp(a,b)
+
+ def strxfrm(s):
+ """ strxfrm(string) -> string.
+ Returns a string that behaves for cmp locale-aware.
+ """
+ return s
+
+
+_localeconv = localeconv
+
+# With this dict, you can override some items of localeconv's return value.
+# This is useful for testing purposes.
+_override_localeconv = {}
+
+@functools.wraps(_localeconv)
+def localeconv():
+ d = _localeconv()
+ if _override_localeconv:
+ d.update(_override_localeconv)
+ return d
+
+
+### Number formatting APIs
+
+# Author: Martin von Loewis
+# improved by Georg Brandl
+
+# Iterate over grouping intervals
+def _grouping_intervals(grouping):
+ last_interval = None
+ for interval in grouping:
+ # if grouping is -1, we are done
+ if interval == CHAR_MAX:
+ return
+ # 0: re-use last group ad infinitum
+ if interval == 0:
+ if last_interval is None:
+ raise ValueError("invalid grouping")
+ while True:
+ yield last_interval
+ yield interval
+ last_interval = interval
+
+#perform the grouping from right to left
+def _group(s, monetary=False):
+ conv = localeconv()
+ thousands_sep = conv[monetary and 'mon_thousands_sep' or 'thousands_sep']
+ grouping = conv[monetary and 'mon_grouping' or 'grouping']
+ if not grouping:
+ return (s, 0)
+ if s[-1] == ' ':
+ stripped = s.rstrip()
+ right_spaces = s[len(stripped):]
+ s = stripped
+ else:
+ right_spaces = ''
+ left_spaces = ''
+ groups = []
+ for interval in _grouping_intervals(grouping):
+ if not s or s[-1] not in "0123456789":
+ # only non-digit characters remain (sign, spaces)
+ left_spaces = s
+ s = ''
+ break
+ groups.append(s[-interval:])
+ s = s[:-interval]
+ if s:
+ groups.append(s)
+ groups.reverse()
+ return (
+ left_spaces + thousands_sep.join(groups) + right_spaces,
+ len(thousands_sep) * (len(groups) - 1)
+ )
+
+# Strip a given amount of excess padding from the given string
+def _strip_padding(s, amount):
+ lpos = 0
+ while amount and s[lpos] == ' ':
+ lpos += 1
+ amount -= 1
+ rpos = len(s) - 1
+ while amount and s[rpos] == ' ':
+ rpos -= 1
+ amount -= 1
+ return s[lpos:rpos+1]
+
+_percent_re = re.compile(r'%(?:\((?P<key>.*?)\))?'
+ r'(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]')
+
+def format(percent, value, grouping=False, monetary=False, *additional):
+ """Returns the locale-aware substitution of a %? specifier
+ (percent).
+
+ additional is for format strings which contain one or more
+ '*' modifiers."""
+ # this is only for one-percent-specifier strings and this should be checked
+ match = _percent_re.match(percent)
+ if not match or len(match.group())!= len(percent):
+ raise ValueError(("format() must be given exactly one %%char "
+ "format specifier, %s not valid") % repr(percent))
+ return _format(percent, value, grouping, monetary, *additional)
+
+def _format(percent, value, grouping=False, monetary=False, *additional):
+ if additional:
+ formatted = percent % ((value,) + additional)
+ else:
+ formatted = percent % value
+ # floats and decimal ints need special action!
+ if percent[-1] in 'eEfFgG':
+ seps = 0
+ parts = formatted.split('.')
+ if grouping:
+ parts[0], seps = _group(parts[0], monetary=monetary)
+ decimal_point = localeconv()[monetary and 'mon_decimal_point'
+ or 'decimal_point']
+ formatted = decimal_point.join(parts)
+ if seps:
+ formatted = _strip_padding(formatted, seps)
+ elif percent[-1] in 'diu':
+ seps = 0
+ if grouping:
+ formatted, seps = _group(formatted, monetary=monetary)
+ if seps:
+ formatted = _strip_padding(formatted, seps)
+ return formatted
+
+def format_string(f, val, grouping=False):
+ """Formats a string in the same way that the % formatting would use,
+ but takes the current locale into account.
+ Grouping is applied if the third parameter is true."""
+ percents = list(_percent_re.finditer(f))
+ new_f = _percent_re.sub('%s', f)
+
+ if operator.isMappingType(val):
+ new_val = []
+ for perc in percents:
+ if perc.group()[-1]=='%':
+ new_val.append('%')
+ else:
+ new_val.append(format(perc.group(), val, grouping))
+ else:
+ if not isinstance(val, tuple):
+ val = (val,)
+ new_val = []
+ i = 0
+ for perc in percents:
+ if perc.group()[-1]=='%':
+ new_val.append('%')
+ else:
+ starcount = perc.group('modifiers').count('*')
+ new_val.append(_format(perc.group(),
+ val[i],
+ grouping,
+ False,
+ *val[i+1:i+1+starcount]))
+ i += (1 + starcount)
+ val = tuple(new_val)
+
+ return new_f % val
+
+def currency(val, symbol=True, grouping=False, international=False):
+ """Formats val according to the currency settings
+ in the current locale."""
+ conv = localeconv()
+
+ # check for illegal values
+ digits = conv[international and 'int_frac_digits' or 'frac_digits']
+ if digits == 127:
+ raise ValueError("Currency formatting is not possible using "
+ "the 'C' locale.")
+
+ s = format('%%.%if' % digits, abs(val), grouping, monetary=True)
+ # '<' and '>' are markers if the sign must be inserted between symbol and value
+ s = '<' + s + '>'
+
+ if symbol:
+ smb = conv[international and 'int_curr_symbol' or 'currency_symbol']
+ precedes = conv[val<0 and 'n_cs_precedes' or 'p_cs_precedes']
+ separated = conv[val<0 and 'n_sep_by_space' or 'p_sep_by_space']
+
+ if precedes:
+ s = smb + (separated and ' ' or '') + s
+ else:
+ s = s + (separated and ' ' or '') + smb
+
+ sign_pos = conv[val<0 and 'n_sign_posn' or 'p_sign_posn']
+ sign = conv[val<0 and 'negative_sign' or 'positive_sign']
+
+ if sign_pos == 0:
+ s = '(' + s + ')'
+ elif sign_pos == 1:
+ s = sign + s
+ elif sign_pos == 2:
+ s = s + sign
+ elif sign_pos == 3:
+ s = s.replace('<', sign)
+ elif sign_pos == 4:
+ s = s.replace('>', sign)
+ else:
+ # the default if nothing specified;
+ # this should be the most fitting sign position
+ s = sign + s
+
+ return s.replace('<', '').replace('>', '')
+
+def str(val):
+ """Convert float to integer, taking the locale into account."""
+ return format("%.12g", val)
+
+def atof(string, func=float):
+ "Parses a string as a float according to the locale settings."
+ #First, get rid of the grouping
+ ts = localeconv()['thousands_sep']
+ if ts:
+ string = string.replace(ts, '')
+ #next, replace the decimal point with a dot
+ dd = localeconv()['decimal_point']
+ if dd:
+ string = string.replace(dd, '.')
+ #finally, parse the string
+ return func(string)
+
+def atoi(str):
+ "Converts a string to an integer according to the locale settings."
+ return atof(str, int)
+
+def _test():
+ setlocale(LC_ALL, "")
+ #do grouping
+ s1 = format("%d", 123456789,1)
+ print s1, "is", atoi(s1)
+ #standard formatting
+ s1 = str(3.14)
+ print s1, "is", atof(s1)
+
+### Locale name aliasing engine
+
+# Author: Marc-Andre Lemburg, mal@lemburg.com
+# Various tweaks by Fredrik Lundh <fredrik@pythonware.com>
+
+# store away the low-level version of setlocale (it's
+# overridden below)
+_setlocale = setlocale
+
+# Avoid relying on the locale-dependent .lower() method
+# (see issue #1813).
+_ascii_lower_map = ''.join(
+ chr(x + 32 if x >= ord('A') and x <= ord('Z') else x)
+ for x in range(256)
+)
+
+def _replace_encoding(code, encoding):
+ if '.' in code:
+ langname = code[:code.index('.')]
+ else:
+ langname = code
+ # Convert the encoding to a C lib compatible encoding string
+ norm_encoding = encodings.normalize_encoding(encoding)
+ #print('norm encoding: %r' % norm_encoding)
+ norm_encoding = encodings.aliases.aliases.get(norm_encoding,
+ norm_encoding)
+ #print('aliased encoding: %r' % norm_encoding)
+ encoding = locale_encoding_alias.get(norm_encoding,
+ norm_encoding)
+ #print('found encoding %r' % encoding)
+ return langname + '.' + encoding
+
+def normalize(localename):
+
+ """ Returns a normalized locale code for the given locale
+ name.
+
+ The returned locale code is formatted for use with
+ setlocale().
+
+ If normalization fails, the original name is returned
+ unchanged.
+
+ If the given encoding is not known, the function defaults to
+ the default encoding for the locale code just like setlocale()
+ does.
+
+ """
+ # Normalize the locale name and extract the encoding and modifier
+ if isinstance(localename, _unicode):
+ localename = localename.encode('ascii')
+ code = localename.translate(_ascii_lower_map)
+ if ':' in code:
+ # ':' is sometimes used as encoding delimiter.
+ code = code.replace(':', '.')
+ if '@' in code:
+ code, modifier = code.split('@', 1)
+ else:
+ modifier = ''
+ if '.' in code:
+ langname, encoding = code.split('.')[:2]
+ else:
+ langname = code
+ encoding = ''
+
+ # First lookup: fullname (possibly with encoding and modifier)
+ lang_enc = langname
+ if encoding:
+ norm_encoding = encoding.replace('-', '')
+ norm_encoding = norm_encoding.replace('_', '')
+ lang_enc += '.' + norm_encoding
+ lookup_name = lang_enc
+ if modifier:
+ lookup_name += '@' + modifier
+ code = locale_alias.get(lookup_name, None)
+ if code is not None:
+ return code
+ #print('first lookup failed')
+
+ if modifier:
+ # Second try: fullname without modifier (possibly with encoding)
+ code = locale_alias.get(lang_enc, None)
+ if code is not None:
+ #print('lookup without modifier succeeded')
+ if '@' not in code:
+ return code + '@' + modifier
+ if code.split('@', 1)[1].translate(_ascii_lower_map) == modifier:
+ return code
+ #print('second lookup failed')
+
+ if encoding:
+ # Third try: langname (without encoding, possibly with modifier)
+ lookup_name = langname
+ if modifier:
+ lookup_name += '@' + modifier
+ code = locale_alias.get(lookup_name, None)
+ if code is not None:
+ #print('lookup without encoding succeeded')
+ if '@' not in code:
+ return _replace_encoding(code, encoding)
+ code, modifier = code.split('@', 1)
+ return _replace_encoding(code, encoding) + '@' + modifier
+
+ if modifier:
+ # Fourth try: langname (without encoding and modifier)
+ code = locale_alias.get(langname, None)
+ if code is not None:
+ #print('lookup without modifier and encoding succeeded')
+ if '@' not in code:
+ return _replace_encoding(code, encoding) + '@' + modifier
+ code, defmod = code.split('@', 1)
+ if defmod.translate(_ascii_lower_map) == modifier:
+ return _replace_encoding(code, encoding) + '@' + defmod
+
+ return localename
+
+def _parse_localename(localename):
+
+ """ Parses the locale code for localename and returns the
+ result as tuple (language code, encoding).
+
+ The localename is normalized and passed through the locale
+ alias engine. A ValueError is raised in case the locale name
+ cannot be parsed.
+
+ The language code corresponds to RFC 1766. code and encoding
+ can be None in case the values cannot be determined or are
+ unknown to this implementation.
+
+ """
+ code = normalize(localename)
+ if '@' in code:
+ # Deal with locale modifiers
+ code, modifier = code.split('@', 1)
+ if modifier == 'euro' and '.' not in code:
+ # Assume Latin-9 for @euro locales. This is bogus,
+ # since some systems may use other encodings for these
+ # locales. Also, we ignore other modifiers.
+ return code, 'iso-8859-15'
+
+ if '.' in code:
+ return tuple(code.split('.')[:2])
+ elif code == 'C':
+ return None, None
+ raise ValueError, 'unknown locale: %s' % localename
+
+def _build_localename(localetuple):
+
+ """ Builds a locale code from the given tuple (language code,
+ encoding).
+
+ No aliasing or normalizing takes place.
+
+ """
+ language, encoding = localetuple
+ if language is None:
+ language = 'C'
+ if encoding is None:
+ return language
+ else:
+ return language + '.' + encoding
+
+def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
+
+ """ Tries to determine the default locale settings and returns
+ them as tuple (language code, encoding).
+
+ According to POSIX, a program which has not called
+ setlocale(LC_ALL, "") runs using the portable 'C' locale.
+ Calling setlocale(LC_ALL, "") lets it use the default locale as
+ defined by the LANG variable. Since we don't want to interfere
+ with the current locale setting we thus emulate the behavior
+ in the way described above.
+
+ To maintain compatibility with other platforms, not only the
+ LANG variable is tested, but a list of variables given as
+ envvars parameter. The first found to be defined will be
+ used. envvars defaults to the search path used in GNU gettext;
+ it must always contain the variable name 'LANG'.
+
+ Except for the code 'C', the language code corresponds to RFC
+ 1766. code and encoding can be None in case the values cannot
+ be determined.
+
+ """
+
+ try:
+ # check if it's supported by the _locale module
+ import _locale
+ code, encoding = _locale._getdefaultlocale()
+ except (ImportError, AttributeError):
+ pass
+ else:
+ # make sure the code/encoding values are valid
+ if sys.platform == "win32" and code and code[:2] == "0x":
+ # map windows language identifier to language name
+ code = windows_locale.get(int(code, 0))
+ # ...add other platform-specific processing here, if
+ # necessary...
+ return code, encoding
+
+ # fall back on POSIX behaviour
+ import os
+ lookup = os.environ.get
+ for variable in envvars:
+ localename = lookup(variable,None)
+ if localename:
+ if variable == 'LANGUAGE':
+ localename = localename.split(':')[0]
+ break
+ else:
+ localename = 'C'
+ return _parse_localename(localename)
+
+
+def getlocale(category=LC_CTYPE):
+
+ """ Returns the current setting for the given locale category as
+ tuple (language code, encoding).
+
+ category may be one of the LC_* value except LC_ALL. It
+ defaults to LC_CTYPE.
+
+ Except for the code 'C', the language code corresponds to RFC
+ 1766. code and encoding can be None in case the values cannot
+ be determined.
+
+ """
+ localename = _setlocale(category)
+ if category == LC_ALL and ';' in localename:
+ raise TypeError, 'category LC_ALL is not supported'
+ return _parse_localename(localename)
+
+def setlocale(category, locale=None):
+
+ """ Set the locale for the given category. The locale can be
+ a string, an iterable of two strings (language code and encoding),
+ or None.
+
+ Iterables are converted to strings using the locale aliasing
+ engine. Locale strings are passed directly to the C lib.
+
+ category may be given as one of the LC_* values.
+
+ """
+ if locale and type(locale) is not type(""):
+ # convert to string
+ locale = normalize(_build_localename(locale))
+ return _setlocale(category, locale)
+
+def resetlocale(category=LC_ALL):
+
+ """ Sets the locale for category to the default setting.
+
+ The default setting is determined by calling
+ getdefaultlocale(). category defaults to LC_ALL.
+
+ """
+ _setlocale(category, _build_localename(getdefaultlocale()))
+
+if sys.platform.startswith("win"):
+ # On Win32, this will return the ANSI code page
+ def getpreferredencoding(do_setlocale = True):
+ """Return the charset that the user is likely using."""
+ import _locale
+ return _locale._getdefaultlocale()[1]
+else:
+ # On Unix, if CODESET is available, use that.
+ try:
+ CODESET
+ except NameError:
+ # Fall back to parsing environment variables :-(
+ def getpreferredencoding(do_setlocale = True):
+ """Return the charset that the user is likely using,
+ by looking at environment variables."""
+ return getdefaultlocale()[1]
+ else:
+ def getpreferredencoding(do_setlocale = True):
+ """Return the charset that the user is likely using,
+ according to the system configuration."""
+ if do_setlocale:
+ oldloc = setlocale(LC_CTYPE)
+ try:
+ setlocale(LC_CTYPE, "")
+ except Error:
+ pass
+ result = nl_langinfo(CODESET)
+ setlocale(LC_CTYPE, oldloc)
+ return result
+ else:
+ return nl_langinfo(CODESET)
+
+
+### Database
+#
+# The following data was extracted from the locale.alias file which
+# comes with X11 and then hand edited removing the explicit encoding
+# definitions and adding some more aliases. The file is usually
+# available as /usr/lib/X11/locale/locale.alias.
+#
+
+#
+# The local_encoding_alias table maps lowercase encoding alias names
+# to C locale encoding names (case-sensitive). Note that normalize()
+# first looks up the encoding in the encodings.aliases dictionary and
+# then applies this mapping to find the correct C lib name for the
+# encoding.
+#
+locale_encoding_alias = {
+
+ # Mappings for non-standard encoding names used in locale names
+ '437': 'C',
+ 'c': 'C',
+ 'en': 'ISO8859-1',
+ 'jis': 'JIS7',
+ 'jis7': 'JIS7',
+ 'ajec': 'eucJP',
+
+ # Mappings from Python codec names to C lib encoding names
+ 'ascii': 'ISO8859-1',
+ 'latin_1': 'ISO8859-1',
+ 'iso8859_1': 'ISO8859-1',
+ 'iso8859_10': 'ISO8859-10',
+ 'iso8859_11': 'ISO8859-11',
+ 'iso8859_13': 'ISO8859-13',
+ 'iso8859_14': 'ISO8859-14',
+ 'iso8859_15': 'ISO8859-15',
+ 'iso8859_16': 'ISO8859-16',
+ 'iso8859_2': 'ISO8859-2',
+ 'iso8859_3': 'ISO8859-3',
+ 'iso8859_4': 'ISO8859-4',
+ 'iso8859_5': 'ISO8859-5',
+ 'iso8859_6': 'ISO8859-6',
+ 'iso8859_7': 'ISO8859-7',
+ 'iso8859_8': 'ISO8859-8',
+ 'iso8859_9': 'ISO8859-9',
+ 'iso2022_jp': 'JIS7',
+ 'shift_jis': 'SJIS',
+ 'tactis': 'TACTIS',
+ 'euc_jp': 'eucJP',
+ 'euc_kr': 'eucKR',
+ 'utf_8': 'UTF-8',
+ 'koi8_r': 'KOI8-R',
+ 'koi8_u': 'KOI8-U',
+ # XXX This list is still incomplete. If you know more
+ # mappings, please file a bug report. Thanks.
+}
+
+#
+# The locale_alias table maps lowercase alias names to C locale names
+# (case-sensitive). Encodings are always separated from the locale
+# name using a dot ('.'); they should only be given in case the
+# language name is needed to interpret the given encoding alias
+# correctly (CJK codes often have this need).
+#
+# Note that the normalize() function which uses this tables
+# removes '_' and '-' characters from the encoding part of the
+# locale name before doing the lookup. This saves a lot of
+# space in the table.
+#
+# MAL 2004-12-10:
+# Updated alias mapping to most recent locale.alias file
+# from X.org distribution using makelocalealias.py.
+#
+# These are the differences compared to the old mapping (Python 2.4
+# and older):
+#
+# updated 'bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
+# updated 'bg_bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
+# updated 'bulgarian' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251'
+# updated 'cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'
+# updated 'cz_cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2'
+# updated 'czech' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2'
+# updated 'dutch' -> 'nl_BE.ISO8859-1' to 'nl_NL.ISO8859-1'
+# updated 'et' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'
+# updated 'et_ee' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15'
+# updated 'fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'
+# updated 'fi_fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15'
+# updated 'iw' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
+# updated 'iw_il' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
+# updated 'japanese' -> 'ja_JP.SJIS' to 'ja_JP.eucJP'
+# updated 'lt' -> 'lt_LT.ISO8859-4' to 'lt_LT.ISO8859-13'
+# updated 'lv' -> 'lv_LV.ISO8859-4' to 'lv_LV.ISO8859-13'
+# updated 'sl' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'
+# updated 'slovene' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2'
+# updated 'th_th' -> 'th_TH.TACTIS' to 'th_TH.ISO8859-11'
+# updated 'zh_cn' -> 'zh_CN.eucCN' to 'zh_CN.gb2312'
+# updated 'zh_cn.big5' -> 'zh_TW.eucTW' to 'zh_TW.big5'
+# updated 'zh_tw' -> 'zh_TW.eucTW' to 'zh_TW.big5'
+#
+# MAL 2008-05-30:
+# Updated alias mapping to most recent locale.alias file
+# from X.org distribution using makelocalealias.py.
+#
+# These are the differences compared to the old mapping (Python 2.5
+# and older):
+#
+# updated 'cs_cs.iso88592' -> 'cs_CZ.ISO8859-2' to 'cs_CS.ISO8859-2'
+# updated 'serbocroatian' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
+# updated 'sh' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
+# updated 'sh_hr.iso88592' -> 'sh_HR.ISO8859-2' to 'hr_HR.ISO8859-2'
+# updated 'sh_sp' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
+# updated 'sh_yu' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
+# updated 'sp' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
+# updated 'sp_yu' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
+# updated 'sr' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
+# updated 'sr@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
+# updated 'sr_sp' -> 'sr_SP.ISO8859-2' to 'sr_CS.ISO8859-2'
+# updated 'sr_yu' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
+# updated 'sr_yu.cp1251@cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251'
+# updated 'sr_yu.iso88592' -> 'sr_YU.ISO8859-2' to 'sr_CS.ISO8859-2'
+# updated 'sr_yu.iso88595' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
+# updated 'sr_yu.iso88595@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
+# updated 'sr_yu.microsoftcp1251@cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251'
+# updated 'sr_yu.utf8@cyrillic' -> 'sr_YU.UTF-8' to 'sr_CS.UTF-8'
+# updated 'sr_yu@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5'
+#
+# AP 2010-04-12:
+# Updated alias mapping to most recent locale.alias file
+# from X.org distribution using makelocalealias.py.
+#
+# These are the differences compared to the old mapping (Python 2.6.5
+# and older):
+#
+# updated 'ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8'
+# updated 'ru_ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8'
+# updated 'serbocroatian' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
+# updated 'sh' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
+# updated 'sh_yu' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
+# updated 'sr' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'
+# updated 'sr@cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'
+# updated 'sr@latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
+# updated 'sr_cs.utf8@latn' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8@latin'
+# updated 'sr_cs@latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin'
+# updated 'sr_yu' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8@latin'
+# updated 'sr_yu.utf8@cyrillic' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8'
+# updated 'sr_yu@cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8'
+#
+# SS 2013-12-20:
+# Updated alias mapping to most recent locale.alias file
+# from X.org distribution using makelocalealias.py.
+#
+# These are the differences compared to the old mapping (Python 2.7.6
+# and older):
+#
+# updated 'a3' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'
+# updated 'a3_az' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'
+# updated 'a3_az.koi8c' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C'
+# updated 'cs_cs.iso88592' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2'
+# updated 'hebrew' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
+# updated 'hebrew.iso88598' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8'
+# updated 'sd' -> 'sd_IN@devanagari.UTF-8' to 'sd_IN.UTF-8'
+# updated 'sr@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'
+# updated 'sr_cs' -> 'sr_RS.UTF-8' to 'sr_CS.UTF-8'
+# updated 'sr_cs.utf8@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'
+# updated 'sr_cs@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin'
+#
+# SS 2014-10-01:
+# Updated alias mapping with glibc 2.19 supported locales.
+
+locale_alias = {
+ 'a3': 'az_AZ.KOI8-C',
+ 'a3_az': 'az_AZ.KOI8-C',
+ 'a3_az.koi8c': 'az_AZ.KOI8-C',
+ 'a3_az.koic': 'az_AZ.KOI8-C',
+ 'aa_dj': 'aa_DJ.ISO8859-1',
+ 'aa_er': 'aa_ER.UTF-8',
+ 'aa_et': 'aa_ET.UTF-8',
+ 'af': 'af_ZA.ISO8859-1',
+ 'af_za': 'af_ZA.ISO8859-1',
+ 'af_za.iso88591': 'af_ZA.ISO8859-1',
+ 'am': 'am_ET.UTF-8',
+ 'am_et': 'am_ET.UTF-8',
+ 'american': 'en_US.ISO8859-1',
+ 'american.iso88591': 'en_US.ISO8859-1',
+ 'an_es': 'an_ES.ISO8859-15',
+ 'ar': 'ar_AA.ISO8859-6',
+ 'ar_aa': 'ar_AA.ISO8859-6',
+ 'ar_aa.iso88596': 'ar_AA.ISO8859-6',
+ 'ar_ae': 'ar_AE.ISO8859-6',
+ 'ar_ae.iso88596': 'ar_AE.ISO8859-6',
+ 'ar_bh': 'ar_BH.ISO8859-6',
+ 'ar_bh.iso88596': 'ar_BH.ISO8859-6',
+ 'ar_dz': 'ar_DZ.ISO8859-6',
+ 'ar_dz.iso88596': 'ar_DZ.ISO8859-6',
+ 'ar_eg': 'ar_EG.ISO8859-6',
+ 'ar_eg.iso88596': 'ar_EG.ISO8859-6',
+ 'ar_in': 'ar_IN.UTF-8',
+ 'ar_iq': 'ar_IQ.ISO8859-6',
+ 'ar_iq.iso88596': 'ar_IQ.ISO8859-6',
+ 'ar_jo': 'ar_JO.ISO8859-6',
+ 'ar_jo.iso88596': 'ar_JO.ISO8859-6',
+ 'ar_kw': 'ar_KW.ISO8859-6',
+ 'ar_kw.iso88596': 'ar_KW.ISO8859-6',
+ 'ar_lb': 'ar_LB.ISO8859-6',
+ 'ar_lb.iso88596': 'ar_LB.ISO8859-6',
+ 'ar_ly': 'ar_LY.ISO8859-6',
+ 'ar_ly.iso88596': 'ar_LY.ISO8859-6',
+ 'ar_ma': 'ar_MA.ISO8859-6',
+ 'ar_ma.iso88596': 'ar_MA.ISO8859-6',
+ 'ar_om': 'ar_OM.ISO8859-6',
+ 'ar_om.iso88596': 'ar_OM.ISO8859-6',
+ 'ar_qa': 'ar_QA.ISO8859-6',
+ 'ar_qa.iso88596': 'ar_QA.ISO8859-6',
+ 'ar_sa': 'ar_SA.ISO8859-6',
+ 'ar_sa.iso88596': 'ar_SA.ISO8859-6',
+ 'ar_sd': 'ar_SD.ISO8859-6',
+ 'ar_sd.iso88596': 'ar_SD.ISO8859-6',
+ 'ar_sy': 'ar_SY.ISO8859-6',
+ 'ar_sy.iso88596': 'ar_SY.ISO8859-6',
+ 'ar_tn': 'ar_TN.ISO8859-6',
+ 'ar_tn.iso88596': 'ar_TN.ISO8859-6',
+ 'ar_ye': 'ar_YE.ISO8859-6',
+ 'ar_ye.iso88596': 'ar_YE.ISO8859-6',
+ 'arabic': 'ar_AA.ISO8859-6',
+ 'arabic.iso88596': 'ar_AA.ISO8859-6',
+ 'as': 'as_IN.UTF-8',
+ 'as_in': 'as_IN.UTF-8',
+ 'ast_es': 'ast_ES.ISO8859-15',
+ 'ayc_pe': 'ayc_PE.UTF-8',
+ 'az': 'az_AZ.ISO8859-9E',
+ 'az_az': 'az_AZ.ISO8859-9E',
+ 'az_az.iso88599e': 'az_AZ.ISO8859-9E',
+ 'be': 'be_BY.CP1251',
+ 'be@latin': 'be_BY.UTF-8@latin',
+ 'be_bg.utf8': 'bg_BG.UTF-8',
+ 'be_by': 'be_BY.CP1251',
+ 'be_by.cp1251': 'be_BY.CP1251',
+ 'be_by.microsoftcp1251': 'be_BY.CP1251',
+ 'be_by.utf8@latin': 'be_BY.UTF-8@latin',
+ 'be_by@latin': 'be_BY.UTF-8@latin',
+ 'bem_zm': 'bem_ZM.UTF-8',
+ 'ber_dz': 'ber_DZ.UTF-8',
+ 'ber_ma': 'ber_MA.UTF-8',
+ 'bg': 'bg_BG.CP1251',
+ 'bg_bg': 'bg_BG.CP1251',
+ 'bg_bg.cp1251': 'bg_BG.CP1251',
+ 'bg_bg.iso88595': 'bg_BG.ISO8859-5',
+ 'bg_bg.koi8r': 'bg_BG.KOI8-R',
+ 'bg_bg.microsoftcp1251': 'bg_BG.CP1251',
+ 'bho_in': 'bho_IN.UTF-8',
+ 'bn_bd': 'bn_BD.UTF-8',
+ 'bn_in': 'bn_IN.UTF-8',
+ 'bo_cn': 'bo_CN.UTF-8',
+ 'bo_in': 'bo_IN.UTF-8',
+ 'bokmal': 'nb_NO.ISO8859-1',
+ 'bokm\xe5l': 'nb_NO.ISO8859-1',
+ 'br': 'br_FR.ISO8859-1',
+ 'br_fr': 'br_FR.ISO8859-1',
+ 'br_fr.iso88591': 'br_FR.ISO8859-1',
+ 'br_fr.iso885914': 'br_FR.ISO8859-14',
+ 'br_fr.iso885915': 'br_FR.ISO8859-15',
+ 'br_fr.iso885915@euro': 'br_FR.ISO8859-15',
+ 'br_fr.utf8@euro': 'br_FR.UTF-8',
+ 'br_fr@euro': 'br_FR.ISO8859-15',
+ 'brx_in': 'brx_IN.UTF-8',
+ 'bs': 'bs_BA.ISO8859-2',
+ 'bs_ba': 'bs_BA.ISO8859-2',
+ 'bs_ba.iso88592': 'bs_BA.ISO8859-2',
+ 'bulgarian': 'bg_BG.CP1251',
+ 'byn_er': 'byn_ER.UTF-8',
+ 'c': 'C',
+ 'c-french': 'fr_CA.ISO8859-1',
+ 'c-french.iso88591': 'fr_CA.ISO8859-1',
+ 'c.ascii': 'C',
+ 'c.en': 'C',
+ 'c.iso88591': 'en_US.ISO8859-1',
+ 'c.utf8': 'en_US.UTF-8',
+ 'c_c': 'C',
+ 'c_c.c': 'C',
+ 'ca': 'ca_ES.ISO8859-1',
+ 'ca_ad': 'ca_AD.ISO8859-1',
+ 'ca_ad.iso88591': 'ca_AD.ISO8859-1',
+ 'ca_ad.iso885915': 'ca_AD.ISO8859-15',
+ 'ca_ad.iso885915@euro': 'ca_AD.ISO8859-15',
+ 'ca_ad.utf8@euro': 'ca_AD.UTF-8',
+ 'ca_ad@euro': 'ca_AD.ISO8859-15',
+ 'ca_es': 'ca_ES.ISO8859-1',
+ 'ca_es.iso88591': 'ca_ES.ISO8859-1',
+ 'ca_es.iso885915': 'ca_ES.ISO8859-15',
+ 'ca_es.iso885915@euro': 'ca_ES.ISO8859-15',
+ 'ca_es.utf8@euro': 'ca_ES.UTF-8',
+ 'ca_es@valencia': 'ca_ES.ISO8859-15@valencia',
+ 'ca_es@euro': 'ca_ES.ISO8859-15',
+ 'ca_fr': 'ca_FR.ISO8859-1',
+ 'ca_fr.iso88591': 'ca_FR.ISO8859-1',
+ 'ca_fr.iso885915': 'ca_FR.ISO8859-15',
+ 'ca_fr.iso885915@euro': 'ca_FR.ISO8859-15',
+ 'ca_fr.utf8@euro': 'ca_FR.UTF-8',
+ 'ca_fr@euro': 'ca_FR.ISO8859-15',
+ 'ca_it': 'ca_IT.ISO8859-1',
+ 'ca_it.iso88591': 'ca_IT.ISO8859-1',
+ 'ca_it.iso885915': 'ca_IT.ISO8859-15',
+ 'ca_it.iso885915@euro': 'ca_IT.ISO8859-15',
+ 'ca_it.utf8@euro': 'ca_IT.UTF-8',
+ 'ca_it@euro': 'ca_IT.ISO8859-15',
+ 'catalan': 'ca_ES.ISO8859-1',
+ 'cextend': 'en_US.ISO8859-1',
+ 'cextend.en': 'en_US.ISO8859-1',
+ 'chinese-s': 'zh_CN.eucCN',
+ 'chinese-t': 'zh_TW.eucTW',
+ 'crh_ua': 'crh_UA.UTF-8',
+ 'croatian': 'hr_HR.ISO8859-2',
+ 'cs': 'cs_CZ.ISO8859-2',
+ 'cs_cs': 'cs_CZ.ISO8859-2',
+ 'cs_cs.iso88592': 'cs_CZ.ISO8859-2',
+ 'cs_cz': 'cs_CZ.ISO8859-2',
+ 'cs_cz.iso88592': 'cs_CZ.ISO8859-2',
+ 'csb_pl': 'csb_PL.UTF-8',
+ 'cv_ru': 'cv_RU.UTF-8',
+ 'cy': 'cy_GB.ISO8859-1',
+ 'cy_gb': 'cy_GB.ISO8859-1',
+ 'cy_gb.iso88591': 'cy_GB.ISO8859-1',
+ 'cy_gb.iso885914': 'cy_GB.ISO8859-14',
+ 'cy_gb.iso885915': 'cy_GB.ISO8859-15',
+ 'cy_gb@euro': 'cy_GB.ISO8859-15',
+ 'cz': 'cs_CZ.ISO8859-2',
+ 'cz_cz': 'cs_CZ.ISO8859-2',
+ 'czech': 'cs_CZ.ISO8859-2',
+ 'da': 'da_DK.ISO8859-1',
+ 'da.iso885915': 'da_DK.ISO8859-15',
+ 'da_dk': 'da_DK.ISO8859-1',
+ 'da_dk.88591': 'da_DK.ISO8859-1',
+ 'da_dk.885915': 'da_DK.ISO8859-15',
+ 'da_dk.iso88591': 'da_DK.ISO8859-1',
+ 'da_dk.iso885915': 'da_DK.ISO8859-15',
+ 'da_dk@euro': 'da_DK.ISO8859-15',
+ 'danish': 'da_DK.ISO8859-1',
+ 'danish.iso88591': 'da_DK.ISO8859-1',
+ 'dansk': 'da_DK.ISO8859-1',
+ 'de': 'de_DE.ISO8859-1',
+ 'de.iso885915': 'de_DE.ISO8859-15',
+ 'de_at': 'de_AT.ISO8859-1',
+ 'de_at.iso88591': 'de_AT.ISO8859-1',
+ 'de_at.iso885915': 'de_AT.ISO8859-15',
+ 'de_at.iso885915@euro': 'de_AT.ISO8859-15',
+ 'de_at.utf8@euro': 'de_AT.UTF-8',
+ 'de_at@euro': 'de_AT.ISO8859-15',
+ 'de_be': 'de_BE.ISO8859-1',
+ 'de_be.iso88591': 'de_BE.ISO8859-1',
+ 'de_be.iso885915': 'de_BE.ISO8859-15',
+ 'de_be.iso885915@euro': 'de_BE.ISO8859-15',
+ 'de_be.utf8@euro': 'de_BE.UTF-8',
+ 'de_be@euro': 'de_BE.ISO8859-15',
+ 'de_ch': 'de_CH.ISO8859-1',
+ 'de_ch.iso88591': 'de_CH.ISO8859-1',
+ 'de_ch.iso885915': 'de_CH.ISO8859-15',
+ 'de_ch@euro': 'de_CH.ISO8859-15',
+ 'de_de': 'de_DE.ISO8859-1',
+ 'de_de.88591': 'de_DE.ISO8859-1',
+ 'de_de.885915': 'de_DE.ISO8859-15',
+ 'de_de.885915@euro': 'de_DE.ISO8859-15',
+ 'de_de.iso88591': 'de_DE.ISO8859-1',
+ 'de_de.iso885915': 'de_DE.ISO8859-15',
+ 'de_de.iso885915@euro': 'de_DE.ISO8859-15',
+ 'de_de.utf8@euro': 'de_DE.UTF-8',
+ 'de_de@euro': 'de_DE.ISO8859-15',
+ 'de_li.utf8': 'de_LI.UTF-8',
+ 'de_lu': 'de_LU.ISO8859-1',
+ 'de_lu.iso88591': 'de_LU.ISO8859-1',
+ 'de_lu.iso885915': 'de_LU.ISO8859-15',
+ 'de_lu.iso885915@euro': 'de_LU.ISO8859-15',
+ 'de_lu.utf8@euro': 'de_LU.UTF-8',
+ 'de_lu@euro': 'de_LU.ISO8859-15',
+ 'deutsch': 'de_DE.ISO8859-1',
+ 'doi_in': 'doi_IN.UTF-8',
+ 'dutch': 'nl_NL.ISO8859-1',
+ 'dutch.iso88591': 'nl_BE.ISO8859-1',
+ 'dv_mv': 'dv_MV.UTF-8',
+ 'dz_bt': 'dz_BT.UTF-8',
+ 'ee': 'ee_EE.ISO8859-4',
+ 'ee_ee': 'ee_EE.ISO8859-4',
+ 'ee_ee.iso88594': 'ee_EE.ISO8859-4',
+ 'eesti': 'et_EE.ISO8859-1',
+ 'el': 'el_GR.ISO8859-7',
+ 'el_cy': 'el_CY.ISO8859-7',
+ 'el_gr': 'el_GR.ISO8859-7',
+ 'el_gr.iso88597': 'el_GR.ISO8859-7',
+ 'el_gr@euro': 'el_GR.ISO8859-15',
+ 'en': 'en_US.ISO8859-1',
+ 'en.iso88591': 'en_US.ISO8859-1',
+ 'en_ag': 'en_AG.UTF-8',
+ 'en_au': 'en_AU.ISO8859-1',
+ 'en_au.iso88591': 'en_AU.ISO8859-1',
+ 'en_be': 'en_BE.ISO8859-1',
+ 'en_be@euro': 'en_BE.ISO8859-15',
+ 'en_bw': 'en_BW.ISO8859-1',
+ 'en_bw.iso88591': 'en_BW.ISO8859-1',
+ 'en_ca': 'en_CA.ISO8859-1',
+ 'en_ca.iso88591': 'en_CA.ISO8859-1',
+ 'en_dk': 'en_DK.ISO8859-1',
+ 'en_dl.utf8': 'en_DL.UTF-8',
+ 'en_gb': 'en_GB.ISO8859-1',
+ 'en_gb.88591': 'en_GB.ISO8859-1',
+ 'en_gb.iso88591': 'en_GB.ISO8859-1',
+ 'en_gb.iso885915': 'en_GB.ISO8859-15',
+ 'en_gb@euro': 'en_GB.ISO8859-15',
+ 'en_hk': 'en_HK.ISO8859-1',
+ 'en_hk.iso88591': 'en_HK.ISO8859-1',
+ 'en_ie': 'en_IE.ISO8859-1',
+ 'en_ie.iso88591': 'en_IE.ISO8859-1',
+ 'en_ie.iso885915': 'en_IE.ISO8859-15',
+ 'en_ie.iso885915@euro': 'en_IE.ISO8859-15',
+ 'en_ie.utf8@euro': 'en_IE.UTF-8',
+ 'en_ie@euro': 'en_IE.ISO8859-15',
+ 'en_in': 'en_IN.ISO8859-1',
+ 'en_ng': 'en_NG.UTF-8',
+ 'en_nz': 'en_NZ.ISO8859-1',
+ 'en_nz.iso88591': 'en_NZ.ISO8859-1',
+ 'en_ph': 'en_PH.ISO8859-1',
+ 'en_ph.iso88591': 'en_PH.ISO8859-1',
+ 'en_sg': 'en_SG.ISO8859-1',
+ 'en_sg.iso88591': 'en_SG.ISO8859-1',
+ 'en_uk': 'en_GB.ISO8859-1',
+ 'en_us': 'en_US.ISO8859-1',
+ 'en_us.88591': 'en_US.ISO8859-1',
+ 'en_us.885915': 'en_US.ISO8859-15',
+ 'en_us.iso88591': 'en_US.ISO8859-1',
+ 'en_us.iso885915': 'en_US.ISO8859-15',
+ 'en_us.iso885915@euro': 'en_US.ISO8859-15',
+ 'en_us@euro': 'en_US.ISO8859-15',
+ 'en_us@euro@euro': 'en_US.ISO8859-15',
+ 'en_za': 'en_ZA.ISO8859-1',
+ 'en_za.88591': 'en_ZA.ISO8859-1',
+ 'en_za.iso88591': 'en_ZA.ISO8859-1',
+ 'en_za.iso885915': 'en_ZA.ISO8859-15',
+ 'en_za@euro': 'en_ZA.ISO8859-15',
+ 'en_zm': 'en_ZM.UTF-8',
+ 'en_zw': 'en_ZW.ISO8859-1',
+ 'en_zw.iso88591': 'en_ZW.ISO8859-1',
+ 'en_zw.utf8': 'en_ZS.UTF-8',
+ 'eng_gb': 'en_GB.ISO8859-1',
+ 'eng_gb.8859': 'en_GB.ISO8859-1',
+ 'english': 'en_EN.ISO8859-1',
+ 'english.iso88591': 'en_EN.ISO8859-1',
+ 'english_uk': 'en_GB.ISO8859-1',
+ 'english_uk.8859': 'en_GB.ISO8859-1',
+ 'english_united-states': 'en_US.ISO8859-1',
+ 'english_united-states.437': 'C',
+ 'english_us': 'en_US.ISO8859-1',
+ 'english_us.8859': 'en_US.ISO8859-1',
+ 'english_us.ascii': 'en_US.ISO8859-1',
+ 'eo': 'eo_XX.ISO8859-3',
+ 'eo.utf8': 'eo.UTF-8',
+ 'eo_eo': 'eo_EO.ISO8859-3',
+ 'eo_eo.iso88593': 'eo_EO.ISO8859-3',
+ 'eo_us.utf8': 'eo_US.UTF-8',
+ 'eo_xx': 'eo_XX.ISO8859-3',
+ 'eo_xx.iso88593': 'eo_XX.ISO8859-3',
+ 'es': 'es_ES.ISO8859-1',
+ 'es_ar': 'es_AR.ISO8859-1',
+ 'es_ar.iso88591': 'es_AR.ISO8859-1',
+ 'es_bo': 'es_BO.ISO8859-1',
+ 'es_bo.iso88591': 'es_BO.ISO8859-1',
+ 'es_cl': 'es_CL.ISO8859-1',
+ 'es_cl.iso88591': 'es_CL.ISO8859-1',
+ 'es_co': 'es_CO.ISO8859-1',
+ 'es_co.iso88591': 'es_CO.ISO8859-1',
+ 'es_cr': 'es_CR.ISO8859-1',
+ 'es_cr.iso88591': 'es_CR.ISO8859-1',
+ 'es_cu': 'es_CU.UTF-8',
+ 'es_do': 'es_DO.ISO8859-1',
+ 'es_do.iso88591': 'es_DO.ISO8859-1',
+ 'es_ec': 'es_EC.ISO8859-1',
+ 'es_ec.iso88591': 'es_EC.ISO8859-1',
+ 'es_es': 'es_ES.ISO8859-1',
+ 'es_es.88591': 'es_ES.ISO8859-1',
+ 'es_es.iso88591': 'es_ES.ISO8859-1',
+ 'es_es.iso885915': 'es_ES.ISO8859-15',
+ 'es_es.iso885915@euro': 'es_ES.ISO8859-15',
+ 'es_es.utf8@euro': 'es_ES.UTF-8',
+ 'es_es@euro': 'es_ES.ISO8859-15',
+ 'es_gt': 'es_GT.ISO8859-1',
+ 'es_gt.iso88591': 'es_GT.ISO8859-1',
+ 'es_hn': 'es_HN.ISO8859-1',
+ 'es_hn.iso88591': 'es_HN.ISO8859-1',
+ 'es_mx': 'es_MX.ISO8859-1',
+ 'es_mx.iso88591': 'es_MX.ISO8859-1',
+ 'es_ni': 'es_NI.ISO8859-1',
+ 'es_ni.iso88591': 'es_NI.ISO8859-1',
+ 'es_pa': 'es_PA.ISO8859-1',
+ 'es_pa.iso88591': 'es_PA.ISO8859-1',
+ 'es_pa.iso885915': 'es_PA.ISO8859-15',
+ 'es_pa@euro': 'es_PA.ISO8859-15',
+ 'es_pe': 'es_PE.ISO8859-1',
+ 'es_pe.iso88591': 'es_PE.ISO8859-1',
+ 'es_pe.iso885915': 'es_PE.ISO8859-15',
+ 'es_pe@euro': 'es_PE.ISO8859-15',
+ 'es_pr': 'es_PR.ISO8859-1',
+ 'es_pr.iso88591': 'es_PR.ISO8859-1',
+ 'es_py': 'es_PY.ISO8859-1',
+ 'es_py.iso88591': 'es_PY.ISO8859-1',
+ 'es_py.iso885915': 'es_PY.ISO8859-15',
+ 'es_py@euro': 'es_PY.ISO8859-15',
+ 'es_sv': 'es_SV.ISO8859-1',
+ 'es_sv.iso88591': 'es_SV.ISO8859-1',
+ 'es_sv.iso885915': 'es_SV.ISO8859-15',
+ 'es_sv@euro': 'es_SV.ISO8859-15',
+ 'es_us': 'es_US.ISO8859-1',
+ 'es_us.iso88591': 'es_US.ISO8859-1',
+ 'es_uy': 'es_UY.ISO8859-1',
+ 'es_uy.iso88591': 'es_UY.ISO8859-1',
+ 'es_uy.iso885915': 'es_UY.ISO8859-15',
+ 'es_uy@euro': 'es_UY.ISO8859-15',
+ 'es_ve': 'es_VE.ISO8859-1',
+ 'es_ve.iso88591': 'es_VE.ISO8859-1',
+ 'es_ve.iso885915': 'es_VE.ISO8859-15',
+ 'es_ve@euro': 'es_VE.ISO8859-15',
+ 'estonian': 'et_EE.ISO8859-1',
+ 'et': 'et_EE.ISO8859-15',
+ 'et_ee': 'et_EE.ISO8859-15',
+ 'et_ee.iso88591': 'et_EE.ISO8859-1',
+ 'et_ee.iso885913': 'et_EE.ISO8859-13',
+ 'et_ee.iso885915': 'et_EE.ISO8859-15',
+ 'et_ee.iso88594': 'et_EE.ISO8859-4',
+ 'et_ee@euro': 'et_EE.ISO8859-15',
+ 'eu': 'eu_ES.ISO8859-1',
+ 'eu_es': 'eu_ES.ISO8859-1',
+ 'eu_es.iso88591': 'eu_ES.ISO8859-1',
+ 'eu_es.iso885915': 'eu_ES.ISO8859-15',
+ 'eu_es.iso885915@euro': 'eu_ES.ISO8859-15',
+ 'eu_es.utf8@euro': 'eu_ES.UTF-8',
+ 'eu_es@euro': 'eu_ES.ISO8859-15',
+ 'eu_fr': 'eu_FR.ISO8859-1',
+ 'fa': 'fa_IR.UTF-8',
+ 'fa_ir': 'fa_IR.UTF-8',
+ 'fa_ir.isiri3342': 'fa_IR.ISIRI-3342',
+ 'ff_sn': 'ff_SN.UTF-8',
+ 'fi': 'fi_FI.ISO8859-15',
+ 'fi.iso885915': 'fi_FI.ISO8859-15',
+ 'fi_fi': 'fi_FI.ISO8859-15',
+ 'fi_fi.88591': 'fi_FI.ISO8859-1',
+ 'fi_fi.iso88591': 'fi_FI.ISO8859-1',
+ 'fi_fi.iso885915': 'fi_FI.ISO8859-15',
+ 'fi_fi.iso885915@euro': 'fi_FI.ISO8859-15',
+ 'fi_fi.utf8@euro': 'fi_FI.UTF-8',
+ 'fi_fi@euro': 'fi_FI.ISO8859-15',
+ 'fil_ph': 'fil_PH.UTF-8',
+ 'finnish': 'fi_FI.ISO8859-1',
+ 'finnish.iso88591': 'fi_FI.ISO8859-1',
+ 'fo': 'fo_FO.ISO8859-1',
+ 'fo_fo': 'fo_FO.ISO8859-1',
+ 'fo_fo.iso88591': 'fo_FO.ISO8859-1',
+ 'fo_fo.iso885915': 'fo_FO.ISO8859-15',
+ 'fo_fo@euro': 'fo_FO.ISO8859-15',
+ 'fr': 'fr_FR.ISO8859-1',
+ 'fr.iso885915': 'fr_FR.ISO8859-15',
+ 'fr_be': 'fr_BE.ISO8859-1',
+ 'fr_be.88591': 'fr_BE.ISO8859-1',
+ 'fr_be.iso88591': 'fr_BE.ISO8859-1',
+ 'fr_be.iso885915': 'fr_BE.ISO8859-15',
+ 'fr_be.iso885915@euro': 'fr_BE.ISO8859-15',
+ 'fr_be.utf8@euro': 'fr_BE.UTF-8',
+ 'fr_be@euro': 'fr_BE.ISO8859-15',
+ 'fr_ca': 'fr_CA.ISO8859-1',
+ 'fr_ca.88591': 'fr_CA.ISO8859-1',
+ 'fr_ca.iso88591': 'fr_CA.ISO8859-1',
+ 'fr_ca.iso885915': 'fr_CA.ISO8859-15',
+ 'fr_ca@euro': 'fr_CA.ISO8859-15',
+ 'fr_ch': 'fr_CH.ISO8859-1',
+ 'fr_ch.88591': 'fr_CH.ISO8859-1',
+ 'fr_ch.iso88591': 'fr_CH.ISO8859-1',
+ 'fr_ch.iso885915': 'fr_CH.ISO8859-15',
+ 'fr_ch@euro': 'fr_CH.ISO8859-15',
+ 'fr_fr': 'fr_FR.ISO8859-1',
+ 'fr_fr.88591': 'fr_FR.ISO8859-1',
+ 'fr_fr.iso88591': 'fr_FR.ISO8859-1',
+ 'fr_fr.iso885915': 'fr_FR.ISO8859-15',
+ 'fr_fr.iso885915@euro': 'fr_FR.ISO8859-15',
+ 'fr_fr.utf8@euro': 'fr_FR.UTF-8',
+ 'fr_fr@euro': 'fr_FR.ISO8859-15',
+ 'fr_lu': 'fr_LU.ISO8859-1',
+ 'fr_lu.88591': 'fr_LU.ISO8859-1',
+ 'fr_lu.iso88591': 'fr_LU.ISO8859-1',
+ 'fr_lu.iso885915': 'fr_LU.ISO8859-15',
+ 'fr_lu.iso885915@euro': 'fr_LU.ISO8859-15',
+ 'fr_lu.utf8@euro': 'fr_LU.UTF-8',
+ 'fr_lu@euro': 'fr_LU.ISO8859-15',
+ 'fran\xe7ais': 'fr_FR.ISO8859-1',
+ 'fre_fr': 'fr_FR.ISO8859-1',
+ 'fre_fr.8859': 'fr_FR.ISO8859-1',
+ 'french': 'fr_FR.ISO8859-1',
+ 'french.iso88591': 'fr_CH.ISO8859-1',
+ 'french_france': 'fr_FR.ISO8859-1',
+ 'french_france.8859': 'fr_FR.ISO8859-1',
+ 'fur_it': 'fur_IT.UTF-8',
+ 'fy_de': 'fy_DE.UTF-8',
+ 'fy_nl': 'fy_NL.UTF-8',
+ 'ga': 'ga_IE.ISO8859-1',
+ 'ga_ie': 'ga_IE.ISO8859-1',
+ 'ga_ie.iso88591': 'ga_IE.ISO8859-1',
+ 'ga_ie.iso885914': 'ga_IE.ISO8859-14',
+ 'ga_ie.iso885915': 'ga_IE.ISO8859-15',
+ 'ga_ie.iso885915@euro': 'ga_IE.ISO8859-15',
+ 'ga_ie.utf8@euro': 'ga_IE.UTF-8',
+ 'ga_ie@euro': 'ga_IE.ISO8859-15',
+ 'galego': 'gl_ES.ISO8859-1',
+ 'galician': 'gl_ES.ISO8859-1',
+ 'gd': 'gd_GB.ISO8859-1',
+ 'gd_gb': 'gd_GB.ISO8859-1',
+ 'gd_gb.iso88591': 'gd_GB.ISO8859-1',
+ 'gd_gb.iso885914': 'gd_GB.ISO8859-14',
+ 'gd_gb.iso885915': 'gd_GB.ISO8859-15',
+ 'gd_gb@euro': 'gd_GB.ISO8859-15',
+ 'ger_de': 'de_DE.ISO8859-1',
+ 'ger_de.8859': 'de_DE.ISO8859-1',
+ 'german': 'de_DE.ISO8859-1',
+ 'german.iso88591': 'de_CH.ISO8859-1',
+ 'german_germany': 'de_DE.ISO8859-1',
+ 'german_germany.8859': 'de_DE.ISO8859-1',
+ 'gez_er': 'gez_ER.UTF-8',
+ 'gez_et': 'gez_ET.UTF-8',
+ 'gl': 'gl_ES.ISO8859-1',
+ 'gl_es': 'gl_ES.ISO8859-1',
+ 'gl_es.iso88591': 'gl_ES.ISO8859-1',
+ 'gl_es.iso885915': 'gl_ES.ISO8859-15',
+ 'gl_es.iso885915@euro': 'gl_ES.ISO8859-15',
+ 'gl_es.utf8@euro': 'gl_ES.UTF-8',
+ 'gl_es@euro': 'gl_ES.ISO8859-15',
+ 'greek': 'el_GR.ISO8859-7',
+ 'greek.iso88597': 'el_GR.ISO8859-7',
+ 'gu_in': 'gu_IN.UTF-8',
+ 'gv': 'gv_GB.ISO8859-1',
+ 'gv_gb': 'gv_GB.ISO8859-1',
+ 'gv_gb.iso88591': 'gv_GB.ISO8859-1',
+ 'gv_gb.iso885914': 'gv_GB.ISO8859-14',
+ 'gv_gb.iso885915': 'gv_GB.ISO8859-15',
+ 'gv_gb@euro': 'gv_GB.ISO8859-15',
+ 'ha_ng': 'ha_NG.UTF-8',
+ 'he': 'he_IL.ISO8859-8',
+ 'he_il': 'he_IL.ISO8859-8',
+ 'he_il.cp1255': 'he_IL.CP1255',
+ 'he_il.iso88598': 'he_IL.ISO8859-8',
+ 'he_il.microsoftcp1255': 'he_IL.CP1255',
+ 'hebrew': 'he_IL.ISO8859-8',
+ 'hebrew.iso88598': 'he_IL.ISO8859-8',
+ 'hi': 'hi_IN.ISCII-DEV',
+ 'hi_in': 'hi_IN.ISCII-DEV',
+ 'hi_in.isciidev': 'hi_IN.ISCII-DEV',
+ 'hne': 'hne_IN.UTF-8',
+ 'hne_in': 'hne_IN.UTF-8',
+ 'hr': 'hr_HR.ISO8859-2',
+ 'hr_hr': 'hr_HR.ISO8859-2',
+ 'hr_hr.iso88592': 'hr_HR.ISO8859-2',
+ 'hrvatski': 'hr_HR.ISO8859-2',
+ 'hsb_de': 'hsb_DE.ISO8859-2',
+ 'ht_ht': 'ht_HT.UTF-8',
+ 'hu': 'hu_HU.ISO8859-2',
+ 'hu_hu': 'hu_HU.ISO8859-2',
+ 'hu_hu.iso88592': 'hu_HU.ISO8859-2',
+ 'hungarian': 'hu_HU.ISO8859-2',
+ 'hy_am': 'hy_AM.UTF-8',
+ 'hy_am.armscii8': 'hy_AM.ARMSCII_8',
+ 'ia': 'ia.UTF-8',
+ 'ia_fr': 'ia_FR.UTF-8',
+ 'icelandic': 'is_IS.ISO8859-1',
+ 'icelandic.iso88591': 'is_IS.ISO8859-1',
+ 'id': 'id_ID.ISO8859-1',
+ 'id_id': 'id_ID.ISO8859-1',
+ 'ig_ng': 'ig_NG.UTF-8',
+ 'ik_ca': 'ik_CA.UTF-8',
+ 'in': 'id_ID.ISO8859-1',
+ 'in_id': 'id_ID.ISO8859-1',
+ 'is': 'is_IS.ISO8859-1',
+ 'is_is': 'is_IS.ISO8859-1',
+ 'is_is.iso88591': 'is_IS.ISO8859-1',
+ 'is_is.iso885915': 'is_IS.ISO8859-15',
+ 'is_is@euro': 'is_IS.ISO8859-15',
+ 'iso-8859-1': 'en_US.ISO8859-1',
+ 'iso-8859-15': 'en_US.ISO8859-15',
+ 'iso8859-1': 'en_US.ISO8859-1',
+ 'iso8859-15': 'en_US.ISO8859-15',
+ 'iso_8859_1': 'en_US.ISO8859-1',
+ 'iso_8859_15': 'en_US.ISO8859-15',
+ 'it': 'it_IT.ISO8859-1',
+ 'it.iso885915': 'it_IT.ISO8859-15',
+ 'it_ch': 'it_CH.ISO8859-1',
+ 'it_ch.iso88591': 'it_CH.ISO8859-1',
+ 'it_ch.iso885915': 'it_CH.ISO8859-15',
+ 'it_ch@euro': 'it_CH.ISO8859-15',
+ 'it_it': 'it_IT.ISO8859-1',
+ 'it_it.88591': 'it_IT.ISO8859-1',
+ 'it_it.iso88591': 'it_IT.ISO8859-1',
+ 'it_it.iso885915': 'it_IT.ISO8859-15',
+ 'it_it.iso885915@euro': 'it_IT.ISO8859-15',
+ 'it_it.utf8@euro': 'it_IT.UTF-8',
+ 'it_it@euro': 'it_IT.ISO8859-15',
+ 'italian': 'it_IT.ISO8859-1',
+ 'italian.iso88591': 'it_IT.ISO8859-1',
+ 'iu': 'iu_CA.NUNACOM-8',
+ 'iu_ca': 'iu_CA.NUNACOM-8',
+ 'iu_ca.nunacom8': 'iu_CA.NUNACOM-8',
+ 'iw': 'he_IL.ISO8859-8',
+ 'iw_il': 'he_IL.ISO8859-8',
+ 'iw_il.iso88598': 'he_IL.ISO8859-8',
+ 'iw_il.utf8': 'iw_IL.UTF-8',
+ 'ja': 'ja_JP.eucJP',
+ 'ja.jis': 'ja_JP.JIS7',
+ 'ja.sjis': 'ja_JP.SJIS',
+ 'ja_jp': 'ja_JP.eucJP',
+ 'ja_jp.ajec': 'ja_JP.eucJP',
+ 'ja_jp.euc': 'ja_JP.eucJP',
+ 'ja_jp.eucjp': 'ja_JP.eucJP',
+ 'ja_jp.iso-2022-jp': 'ja_JP.JIS7',
+ 'ja_jp.iso2022jp': 'ja_JP.JIS7',
+ 'ja_jp.jis': 'ja_JP.JIS7',
+ 'ja_jp.jis7': 'ja_JP.JIS7',
+ 'ja_jp.mscode': 'ja_JP.SJIS',
+ 'ja_jp.pck': 'ja_JP.SJIS',
+ 'ja_jp.sjis': 'ja_JP.SJIS',
+ 'ja_jp.ujis': 'ja_JP.eucJP',
+ 'japan': 'ja_JP.eucJP',
+ 'japanese': 'ja_JP.eucJP',
+ 'japanese-euc': 'ja_JP.eucJP',
+ 'japanese.euc': 'ja_JP.eucJP',
+ 'japanese.sjis': 'ja_JP.SJIS',
+ 'jp_jp': 'ja_JP.eucJP',
+ 'ka': 'ka_GE.GEORGIAN-ACADEMY',
+ 'ka_ge': 'ka_GE.GEORGIAN-ACADEMY',
+ 'ka_ge.georgianacademy': 'ka_GE.GEORGIAN-ACADEMY',
+ 'ka_ge.georgianps': 'ka_GE.GEORGIAN-PS',
+ 'ka_ge.georgianrs': 'ka_GE.GEORGIAN-ACADEMY',
+ 'kk_kz': 'kk_KZ.RK1048',
+ 'kl': 'kl_GL.ISO8859-1',
+ 'kl_gl': 'kl_GL.ISO8859-1',
+ 'kl_gl.iso88591': 'kl_GL.ISO8859-1',
+ 'kl_gl.iso885915': 'kl_GL.ISO8859-15',
+ 'kl_gl@euro': 'kl_GL.ISO8859-15',
+ 'km_kh': 'km_KH.UTF-8',
+ 'kn': 'kn_IN.UTF-8',
+ 'kn_in': 'kn_IN.UTF-8',
+ 'ko': 'ko_KR.eucKR',
+ 'ko_kr': 'ko_KR.eucKR',
+ 'ko_kr.euc': 'ko_KR.eucKR',
+ 'ko_kr.euckr': 'ko_KR.eucKR',
+ 'kok_in': 'kok_IN.UTF-8',
+ 'korean': 'ko_KR.eucKR',
+ 'korean.euc': 'ko_KR.eucKR',
+ 'ks': 'ks_IN.UTF-8',
+ 'ks_in': 'ks_IN.UTF-8',
+ 'ks_in@devanagari': 'ks_IN.UTF-8@devanagari',
+ 'ks_in@devanagari.utf8': 'ks_IN.UTF-8@devanagari',
+ 'ku_tr': 'ku_TR.ISO8859-9',
+ 'kw': 'kw_GB.ISO8859-1',
+ 'kw_gb': 'kw_GB.ISO8859-1',
+ 'kw_gb.iso88591': 'kw_GB.ISO8859-1',
+ 'kw_gb.iso885914': 'kw_GB.ISO8859-14',
+ 'kw_gb.iso885915': 'kw_GB.ISO8859-15',
+ 'kw_gb@euro': 'kw_GB.ISO8859-15',
+ 'ky': 'ky_KG.UTF-8',
+ 'ky_kg': 'ky_KG.UTF-8',
+ 'lb_lu': 'lb_LU.UTF-8',
+ 'lg_ug': 'lg_UG.ISO8859-10',
+ 'li_be': 'li_BE.UTF-8',
+ 'li_nl': 'li_NL.UTF-8',
+ 'lij_it': 'lij_IT.UTF-8',
+ 'lithuanian': 'lt_LT.ISO8859-13',
+ 'lo': 'lo_LA.MULELAO-1',
+ 'lo_la': 'lo_LA.MULELAO-1',
+ 'lo_la.cp1133': 'lo_LA.IBM-CP1133',
+ 'lo_la.ibmcp1133': 'lo_LA.IBM-CP1133',
+ 'lo_la.mulelao1': 'lo_LA.MULELAO-1',
+ 'lt': 'lt_LT.ISO8859-13',
+ 'lt_lt': 'lt_LT.ISO8859-13',
+ 'lt_lt.iso885913': 'lt_LT.ISO8859-13',
+ 'lt_lt.iso88594': 'lt_LT.ISO8859-4',
+ 'lv': 'lv_LV.ISO8859-13',
+ 'lv_lv': 'lv_LV.ISO8859-13',
+ 'lv_lv.iso885913': 'lv_LV.ISO8859-13',
+ 'lv_lv.iso88594': 'lv_LV.ISO8859-4',
+ 'mag_in': 'mag_IN.UTF-8',
+ 'mai': 'mai_IN.UTF-8',
+ 'mai_in': 'mai_IN.UTF-8',
+ 'mg_mg': 'mg_MG.ISO8859-15',
+ 'mhr_ru': 'mhr_RU.UTF-8',
+ 'mi': 'mi_NZ.ISO8859-1',
+ 'mi_nz': 'mi_NZ.ISO8859-1',
+ 'mi_nz.iso88591': 'mi_NZ.ISO8859-1',
+ 'mk': 'mk_MK.ISO8859-5',
+ 'mk_mk': 'mk_MK.ISO8859-5',
+ 'mk_mk.cp1251': 'mk_MK.CP1251',
+ 'mk_mk.iso88595': 'mk_MK.ISO8859-5',
+ 'mk_mk.microsoftcp1251': 'mk_MK.CP1251',
+ 'ml': 'ml_IN.UTF-8',
+ 'ml_in': 'ml_IN.UTF-8',
+ 'mn_mn': 'mn_MN.UTF-8',
+ 'mni_in': 'mni_IN.UTF-8',
+ 'mr': 'mr_IN.UTF-8',
+ 'mr_in': 'mr_IN.UTF-8',
+ 'ms': 'ms_MY.ISO8859-1',
+ 'ms_my': 'ms_MY.ISO8859-1',
+ 'ms_my.iso88591': 'ms_MY.ISO8859-1',
+ 'mt': 'mt_MT.ISO8859-3',
+ 'mt_mt': 'mt_MT.ISO8859-3',
+ 'mt_mt.iso88593': 'mt_MT.ISO8859-3',
+ 'my_mm': 'my_MM.UTF-8',
+ 'nan_tw@latin': 'nan_TW.UTF-8@latin',
+ 'nb': 'nb_NO.ISO8859-1',
+ 'nb_no': 'nb_NO.ISO8859-1',
+ 'nb_no.88591': 'nb_NO.ISO8859-1',
+ 'nb_no.iso88591': 'nb_NO.ISO8859-1',
+ 'nb_no.iso885915': 'nb_NO.ISO8859-15',
+ 'nb_no@euro': 'nb_NO.ISO8859-15',
+ 'nds_de': 'nds_DE.UTF-8',
+ 'nds_nl': 'nds_NL.UTF-8',
+ 'ne_np': 'ne_NP.UTF-8',
+ 'nhn_mx': 'nhn_MX.UTF-8',
+ 'niu_nu': 'niu_NU.UTF-8',
+ 'niu_nz': 'niu_NZ.UTF-8',
+ 'nl': 'nl_NL.ISO8859-1',
+ 'nl.iso885915': 'nl_NL.ISO8859-15',
+ 'nl_aw': 'nl_AW.UTF-8',
+ 'nl_be': 'nl_BE.ISO8859-1',
+ 'nl_be.88591': 'nl_BE.ISO8859-1',
+ 'nl_be.iso88591': 'nl_BE.ISO8859-1',
+ 'nl_be.iso885915': 'nl_BE.ISO8859-15',
+ 'nl_be.iso885915@euro': 'nl_BE.ISO8859-15',
+ 'nl_be.utf8@euro': 'nl_BE.UTF-8',
+ 'nl_be@euro': 'nl_BE.ISO8859-15',
+ 'nl_nl': 'nl_NL.ISO8859-1',
+ 'nl_nl.88591': 'nl_NL.ISO8859-1',
+ 'nl_nl.iso88591': 'nl_NL.ISO8859-1',
+ 'nl_nl.iso885915': 'nl_NL.ISO8859-15',
+ 'nl_nl.iso885915@euro': 'nl_NL.ISO8859-15',
+ 'nl_nl.utf8@euro': 'nl_NL.UTF-8',
+ 'nl_nl@euro': 'nl_NL.ISO8859-15',
+ 'nn': 'nn_NO.ISO8859-1',
+ 'nn_no': 'nn_NO.ISO8859-1',
+ 'nn_no.88591': 'nn_NO.ISO8859-1',
+ 'nn_no.iso88591': 'nn_NO.ISO8859-1',
+ 'nn_no.iso885915': 'nn_NO.ISO8859-15',
+ 'nn_no@euro': 'nn_NO.ISO8859-15',
+ 'no': 'no_NO.ISO8859-1',
+ 'no@nynorsk': 'ny_NO.ISO8859-1',
+ 'no_no': 'no_NO.ISO8859-1',
+ 'no_no.88591': 'no_NO.ISO8859-1',
+ 'no_no.iso88591': 'no_NO.ISO8859-1',
+ 'no_no.iso885915': 'no_NO.ISO8859-15',
+ 'no_no.iso88591@bokmal': 'no_NO.ISO8859-1',
+ 'no_no.iso88591@nynorsk': 'no_NO.ISO8859-1',
+ 'no_no@euro': 'no_NO.ISO8859-15',
+ 'norwegian': 'no_NO.ISO8859-1',
+ 'norwegian.iso88591': 'no_NO.ISO8859-1',
+ 'nr': 'nr_ZA.ISO8859-1',
+ 'nr_za': 'nr_ZA.ISO8859-1',
+ 'nr_za.iso88591': 'nr_ZA.ISO8859-1',
+ 'nso': 'nso_ZA.ISO8859-15',
+ 'nso_za': 'nso_ZA.ISO8859-15',
+ 'nso_za.iso885915': 'nso_ZA.ISO8859-15',
+ 'ny': 'ny_NO.ISO8859-1',
+ 'ny_no': 'ny_NO.ISO8859-1',
+ 'ny_no.88591': 'ny_NO.ISO8859-1',
+ 'ny_no.iso88591': 'ny_NO.ISO8859-1',
+ 'ny_no.iso885915': 'ny_NO.ISO8859-15',
+ 'ny_no@euro': 'ny_NO.ISO8859-15',
+ 'nynorsk': 'nn_NO.ISO8859-1',
+ 'oc': 'oc_FR.ISO8859-1',
+ 'oc_fr': 'oc_FR.ISO8859-1',
+ 'oc_fr.iso88591': 'oc_FR.ISO8859-1',
+ 'oc_fr.iso885915': 'oc_FR.ISO8859-15',
+ 'oc_fr@euro': 'oc_FR.ISO8859-15',
+ 'om_et': 'om_ET.UTF-8',
+ 'om_ke': 'om_KE.ISO8859-1',
+ 'or': 'or_IN.UTF-8',
+ 'or_in': 'or_IN.UTF-8',
+ 'os_ru': 'os_RU.UTF-8',
+ 'pa': 'pa_IN.UTF-8',
+ 'pa_in': 'pa_IN.UTF-8',
+ 'pa_pk': 'pa_PK.UTF-8',
+ 'pap_an': 'pap_AN.UTF-8',
+ 'pd': 'pd_US.ISO8859-1',
+ 'pd_de': 'pd_DE.ISO8859-1',
+ 'pd_de.iso88591': 'pd_DE.ISO8859-1',
+ 'pd_de.iso885915': 'pd_DE.ISO8859-15',
+ 'pd_de@euro': 'pd_DE.ISO8859-15',
+ 'pd_us': 'pd_US.ISO8859-1',
+ 'pd_us.iso88591': 'pd_US.ISO8859-1',
+ 'pd_us.iso885915': 'pd_US.ISO8859-15',
+ 'pd_us@euro': 'pd_US.ISO8859-15',
+ 'ph': 'ph_PH.ISO8859-1',
+ 'ph_ph': 'ph_PH.ISO8859-1',
+ 'ph_ph.iso88591': 'ph_PH.ISO8859-1',
+ 'pl': 'pl_PL.ISO8859-2',
+ 'pl_pl': 'pl_PL.ISO8859-2',
+ 'pl_pl.iso88592': 'pl_PL.ISO8859-2',
+ 'polish': 'pl_PL.ISO8859-2',
+ 'portuguese': 'pt_PT.ISO8859-1',
+ 'portuguese.iso88591': 'pt_PT.ISO8859-1',
+ 'portuguese_brazil': 'pt_BR.ISO8859-1',
+ 'portuguese_brazil.8859': 'pt_BR.ISO8859-1',
+ 'posix': 'C',
+ 'posix-utf2': 'C',
+ 'pp': 'pp_AN.ISO8859-1',
+ 'pp_an': 'pp_AN.ISO8859-1',
+ 'pp_an.iso88591': 'pp_AN.ISO8859-1',
+ 'ps_af': 'ps_AF.UTF-8',
+ 'pt': 'pt_PT.ISO8859-1',
+ 'pt.iso885915': 'pt_PT.ISO8859-15',
+ 'pt_br': 'pt_BR.ISO8859-1',
+ 'pt_br.88591': 'pt_BR.ISO8859-1',
+ 'pt_br.iso88591': 'pt_BR.ISO8859-1',
+ 'pt_br.iso885915': 'pt_BR.ISO8859-15',
+ 'pt_br@euro': 'pt_BR.ISO8859-15',
+ 'pt_pt': 'pt_PT.ISO8859-1',
+ 'pt_pt.88591': 'pt_PT.ISO8859-1',
+ 'pt_pt.iso88591': 'pt_PT.ISO8859-1',
+ 'pt_pt.iso885915': 'pt_PT.ISO8859-15',
+ 'pt_pt.iso885915@euro': 'pt_PT.ISO8859-15',
+ 'pt_pt.utf8@euro': 'pt_PT.UTF-8',
+ 'pt_pt@euro': 'pt_PT.ISO8859-15',
+ 'ro': 'ro_RO.ISO8859-2',
+ 'ro_ro': 'ro_RO.ISO8859-2',
+ 'ro_ro.iso88592': 'ro_RO.ISO8859-2',
+ 'romanian': 'ro_RO.ISO8859-2',
+ 'ru': 'ru_RU.UTF-8',
+ 'ru.koi8r': 'ru_RU.KOI8-R',
+ 'ru_ru': 'ru_RU.UTF-8',
+ 'ru_ru.cp1251': 'ru_RU.CP1251',
+ 'ru_ru.iso88595': 'ru_RU.ISO8859-5',
+ 'ru_ru.koi8r': 'ru_RU.KOI8-R',
+ 'ru_ru.microsoftcp1251': 'ru_RU.CP1251',
+ 'ru_ua': 'ru_UA.KOI8-U',
+ 'ru_ua.cp1251': 'ru_UA.CP1251',
+ 'ru_ua.koi8u': 'ru_UA.KOI8-U',
+ 'ru_ua.microsoftcp1251': 'ru_UA.CP1251',
+ 'rumanian': 'ro_RO.ISO8859-2',
+ 'russian': 'ru_RU.ISO8859-5',
+ 'rw': 'rw_RW.ISO8859-1',
+ 'rw_rw': 'rw_RW.ISO8859-1',
+ 'rw_rw.iso88591': 'rw_RW.ISO8859-1',
+ 'sa_in': 'sa_IN.UTF-8',
+ 'sat_in': 'sat_IN.UTF-8',
+ 'sc_it': 'sc_IT.UTF-8',
+ 'sd': 'sd_IN.UTF-8',
+ 'sd@devanagari': 'sd_IN.UTF-8@devanagari',
+ 'sd_in': 'sd_IN.UTF-8',
+ 'sd_in@devanagari': 'sd_IN.UTF-8@devanagari',
+ 'sd_in@devanagari.utf8': 'sd_IN.UTF-8@devanagari',
+ 'sd_pk': 'sd_PK.UTF-8',
+ 'se_no': 'se_NO.UTF-8',
+ 'serbocroatian': 'sr_RS.UTF-8@latin',
+ 'sh': 'sr_RS.UTF-8@latin',
+ 'sh_ba.iso88592@bosnia': 'sr_CS.ISO8859-2',
+ 'sh_hr': 'sh_HR.ISO8859-2',
+ 'sh_hr.iso88592': 'hr_HR.ISO8859-2',
+ 'sh_sp': 'sr_CS.ISO8859-2',
+ 'sh_yu': 'sr_RS.UTF-8@latin',
+ 'shs_ca': 'shs_CA.UTF-8',
+ 'si': 'si_LK.UTF-8',
+ 'si_lk': 'si_LK.UTF-8',
+ 'sid_et': 'sid_ET.UTF-8',
+ 'sinhala': 'si_LK.UTF-8',
+ 'sk': 'sk_SK.ISO8859-2',
+ 'sk_sk': 'sk_SK.ISO8859-2',
+ 'sk_sk.iso88592': 'sk_SK.ISO8859-2',
+ 'sl': 'sl_SI.ISO8859-2',
+ 'sl_cs': 'sl_CS.ISO8859-2',
+ 'sl_si': 'sl_SI.ISO8859-2',
+ 'sl_si.iso88592': 'sl_SI.ISO8859-2',
+ 'slovak': 'sk_SK.ISO8859-2',
+ 'slovene': 'sl_SI.ISO8859-2',
+ 'slovenian': 'sl_SI.ISO8859-2',
+ 'so_dj': 'so_DJ.ISO8859-1',
+ 'so_et': 'so_ET.UTF-8',
+ 'so_ke': 'so_KE.ISO8859-1',
+ 'so_so': 'so_SO.ISO8859-1',
+ 'sp': 'sr_CS.ISO8859-5',
+ 'sp_yu': 'sr_CS.ISO8859-5',
+ 'spanish': 'es_ES.ISO8859-1',
+ 'spanish.iso88591': 'es_ES.ISO8859-1',
+ 'spanish_spain': 'es_ES.ISO8859-1',
+ 'spanish_spain.8859': 'es_ES.ISO8859-1',
+ 'sq': 'sq_AL.ISO8859-2',
+ 'sq_al': 'sq_AL.ISO8859-2',
+ 'sq_al.iso88592': 'sq_AL.ISO8859-2',
+ 'sq_mk': 'sq_MK.UTF-8',
+ 'sr': 'sr_RS.UTF-8',
+ 'sr@cyrillic': 'sr_RS.UTF-8',
+ 'sr@latin': 'sr_RS.UTF-8@latin',
+ 'sr@latn': 'sr_CS.UTF-8@latin',
+ 'sr_cs': 'sr_CS.UTF-8',
+ 'sr_cs.iso88592': 'sr_CS.ISO8859-2',
+ 'sr_cs.iso88592@latn': 'sr_CS.ISO8859-2',
+ 'sr_cs.iso88595': 'sr_CS.ISO8859-5',
+ 'sr_cs.utf8@latn': 'sr_CS.UTF-8@latin',
+ 'sr_cs@latn': 'sr_CS.UTF-8@latin',
+ 'sr_me': 'sr_ME.UTF-8',
+ 'sr_rs': 'sr_RS.UTF-8',
+ 'sr_rs@latin': 'sr_RS.UTF-8@latin',
+ 'sr_rs@latn': 'sr_RS.UTF-8@latin',
+ 'sr_sp': 'sr_CS.ISO8859-2',
+ 'sr_yu': 'sr_RS.UTF-8@latin',
+ 'sr_yu.cp1251@cyrillic': 'sr_CS.CP1251',
+ 'sr_yu.iso88592': 'sr_CS.ISO8859-2',
+ 'sr_yu.iso88595': 'sr_CS.ISO8859-5',
+ 'sr_yu.iso88595@cyrillic': 'sr_CS.ISO8859-5',
+ 'sr_yu.microsoftcp1251@cyrillic': 'sr_CS.CP1251',
+ 'sr_yu.utf8': 'sr_RS.UTF-8',
+ 'sr_yu.utf8@cyrillic': 'sr_RS.UTF-8',
+ 'sr_yu@cyrillic': 'sr_RS.UTF-8',
+ 'ss': 'ss_ZA.ISO8859-1',
+ 'ss_za': 'ss_ZA.ISO8859-1',
+ 'ss_za.iso88591': 'ss_ZA.ISO8859-1',
+ 'st': 'st_ZA.ISO8859-1',
+ 'st_za': 'st_ZA.ISO8859-1',
+ 'st_za.iso88591': 'st_ZA.ISO8859-1',
+ 'sv': 'sv_SE.ISO8859-1',
+ 'sv.iso885915': 'sv_SE.ISO8859-15',
+ 'sv_fi': 'sv_FI.ISO8859-1',
+ 'sv_fi.iso88591': 'sv_FI.ISO8859-1',
+ 'sv_fi.iso885915': 'sv_FI.ISO8859-15',
+ 'sv_fi.iso885915@euro': 'sv_FI.ISO8859-15',
+ 'sv_fi.utf8@euro': 'sv_FI.UTF-8',
+ 'sv_fi@euro': 'sv_FI.ISO8859-15',
+ 'sv_se': 'sv_SE.ISO8859-1',
+ 'sv_se.88591': 'sv_SE.ISO8859-1',
+ 'sv_se.iso88591': 'sv_SE.ISO8859-1',
+ 'sv_se.iso885915': 'sv_SE.ISO8859-15',
+ 'sv_se@euro': 'sv_SE.ISO8859-15',
+ 'sw_ke': 'sw_KE.UTF-8',
+ 'sw_tz': 'sw_TZ.UTF-8',
+ 'swedish': 'sv_SE.ISO8859-1',
+ 'swedish.iso88591': 'sv_SE.ISO8859-1',
+ 'szl_pl': 'szl_PL.UTF-8',
+ 'ta': 'ta_IN.TSCII-0',
+ 'ta_in': 'ta_IN.TSCII-0',
+ 'ta_in.tscii': 'ta_IN.TSCII-0',
+ 'ta_in.tscii0': 'ta_IN.TSCII-0',
+ 'ta_lk': 'ta_LK.UTF-8',
+ 'te': 'te_IN.UTF-8',
+ 'te_in': 'te_IN.UTF-8',
+ 'tg': 'tg_TJ.KOI8-C',
+ 'tg_tj': 'tg_TJ.KOI8-C',
+ 'tg_tj.koi8c': 'tg_TJ.KOI8-C',
+ 'th': 'th_TH.ISO8859-11',
+ 'th_th': 'th_TH.ISO8859-11',
+ 'th_th.iso885911': 'th_TH.ISO8859-11',
+ 'th_th.tactis': 'th_TH.TIS620',
+ 'th_th.tis620': 'th_TH.TIS620',
+ 'thai': 'th_TH.ISO8859-11',
+ 'ti_er': 'ti_ER.UTF-8',
+ 'ti_et': 'ti_ET.UTF-8',
+ 'tig_er': 'tig_ER.UTF-8',
+ 'tk_tm': 'tk_TM.UTF-8',
+ 'tl': 'tl_PH.ISO8859-1',
+ 'tl_ph': 'tl_PH.ISO8859-1',
+ 'tl_ph.iso88591': 'tl_PH.ISO8859-1',
+ 'tn': 'tn_ZA.ISO8859-15',
+ 'tn_za': 'tn_ZA.ISO8859-15',
+ 'tn_za.iso885915': 'tn_ZA.ISO8859-15',
+ 'tr': 'tr_TR.ISO8859-9',
+ 'tr_cy': 'tr_CY.ISO8859-9',
+ 'tr_tr': 'tr_TR.ISO8859-9',
+ 'tr_tr.iso88599': 'tr_TR.ISO8859-9',
+ 'ts': 'ts_ZA.ISO8859-1',
+ 'ts_za': 'ts_ZA.ISO8859-1',
+ 'ts_za.iso88591': 'ts_ZA.ISO8859-1',
+ 'tt': 'tt_RU.TATAR-CYR',
+ 'tt_ru': 'tt_RU.TATAR-CYR',
+ 'tt_ru.koi8c': 'tt_RU.KOI8-C',
+ 'tt_ru.tatarcyr': 'tt_RU.TATAR-CYR',
+ 'tt_ru@iqtelif': 'tt_RU.UTF-8@iqtelif',
+ 'turkish': 'tr_TR.ISO8859-9',
+ 'turkish.iso88599': 'tr_TR.ISO8859-9',
+ 'ug_cn': 'ug_CN.UTF-8',
+ 'uk': 'uk_UA.KOI8-U',
+ 'uk_ua': 'uk_UA.KOI8-U',
+ 'uk_ua.cp1251': 'uk_UA.CP1251',
+ 'uk_ua.iso88595': 'uk_UA.ISO8859-5',
+ 'uk_ua.koi8u': 'uk_UA.KOI8-U',
+ 'uk_ua.microsoftcp1251': 'uk_UA.CP1251',
+ 'univ': 'en_US.utf',
+ 'universal': 'en_US.utf',
+ 'universal.utf8@ucs4': 'en_US.UTF-8',
+ 'unm_us': 'unm_US.UTF-8',
+ 'ur': 'ur_PK.CP1256',
+ 'ur_in': 'ur_IN.UTF-8',
+ 'ur_pk': 'ur_PK.CP1256',
+ 'ur_pk.cp1256': 'ur_PK.CP1256',
+ 'ur_pk.microsoftcp1256': 'ur_PK.CP1256',
+ 'uz': 'uz_UZ.UTF-8',
+ 'uz_uz': 'uz_UZ.UTF-8',
+ 'uz_uz.iso88591': 'uz_UZ.ISO8859-1',
+ 'uz_uz.utf8@cyrillic': 'uz_UZ.UTF-8',
+ 'uz_uz@cyrillic': 'uz_UZ.UTF-8',
+ 've': 've_ZA.UTF-8',
+ 've_za': 've_ZA.UTF-8',
+ 'vi': 'vi_VN.TCVN',
+ 'vi_vn': 'vi_VN.TCVN',
+ 'vi_vn.tcvn': 'vi_VN.TCVN',
+ 'vi_vn.tcvn5712': 'vi_VN.TCVN',
+ 'vi_vn.viscii': 'vi_VN.VISCII',
+ 'vi_vn.viscii111': 'vi_VN.VISCII',
+ 'wa': 'wa_BE.ISO8859-1',
+ 'wa_be': 'wa_BE.ISO8859-1',
+ 'wa_be.iso88591': 'wa_BE.ISO8859-1',
+ 'wa_be.iso885915': 'wa_BE.ISO8859-15',
+ 'wa_be.iso885915@euro': 'wa_BE.ISO8859-15',
+ 'wa_be@euro': 'wa_BE.ISO8859-15',
+ 'wae_ch': 'wae_CH.UTF-8',
+ 'wal_et': 'wal_ET.UTF-8',
+ 'wo_sn': 'wo_SN.UTF-8',
+ 'xh': 'xh_ZA.ISO8859-1',
+ 'xh_za': 'xh_ZA.ISO8859-1',
+ 'xh_za.iso88591': 'xh_ZA.ISO8859-1',
+ 'yi': 'yi_US.CP1255',
+ 'yi_us': 'yi_US.CP1255',
+ 'yi_us.cp1255': 'yi_US.CP1255',
+ 'yi_us.microsoftcp1255': 'yi_US.CP1255',
+ 'yo_ng': 'yo_NG.UTF-8',
+ 'yue_hk': 'yue_HK.UTF-8',
+ 'zh': 'zh_CN.eucCN',
+ 'zh_cn': 'zh_CN.gb2312',
+ 'zh_cn.big5': 'zh_TW.big5',
+ 'zh_cn.euc': 'zh_CN.eucCN',
+ 'zh_cn.gb18030': 'zh_CN.gb18030',
+ 'zh_cn.gb2312': 'zh_CN.gb2312',
+ 'zh_cn.gbk': 'zh_CN.gbk',
+ 'zh_hk': 'zh_HK.big5hkscs',
+ 'zh_hk.big5': 'zh_HK.big5',
+ 'zh_hk.big5hk': 'zh_HK.big5hkscs',
+ 'zh_hk.big5hkscs': 'zh_HK.big5hkscs',
+ 'zh_sg': 'zh_SG.GB2312',
+ 'zh_sg.gbk': 'zh_SG.GBK',
+ 'zh_tw': 'zh_TW.big5',
+ 'zh_tw.big5': 'zh_TW.big5',
+ 'zh_tw.euc': 'zh_TW.eucTW',
+ 'zh_tw.euctw': 'zh_TW.eucTW',
+ 'zu': 'zu_ZA.ISO8859-1',
+ 'zu_za': 'zu_ZA.ISO8859-1',
+ 'zu_za.iso88591': 'zu_ZA.ISO8859-1',
+}
+
+#
+# This maps Windows language identifiers to locale strings.
+#
+# This list has been updated from
+# http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_238z.asp
+# to include every locale up to Windows Vista.
+#
+# NOTE: this mapping is incomplete. If your language is missing, please
+# submit a bug report to the Python bug tracker at http://bugs.python.org/
+# Make sure you include the missing language identifier and the suggested
+# locale code.
+#
+
+windows_locale = {
+ 0x0436: "af_ZA", # Afrikaans
+ 0x041c: "sq_AL", # Albanian
+ 0x0484: "gsw_FR",# Alsatian - France
+ 0x045e: "am_ET", # Amharic - Ethiopia
+ 0x0401: "ar_SA", # Arabic - Saudi Arabia
+ 0x0801: "ar_IQ", # Arabic - Iraq
+ 0x0c01: "ar_EG", # Arabic - Egypt
+ 0x1001: "ar_LY", # Arabic - Libya
+ 0x1401: "ar_DZ", # Arabic - Algeria
+ 0x1801: "ar_MA", # Arabic - Morocco
+ 0x1c01: "ar_TN", # Arabic - Tunisia
+ 0x2001: "ar_OM", # Arabic - Oman
+ 0x2401: "ar_YE", # Arabic - Yemen
+ 0x2801: "ar_SY", # Arabic - Syria
+ 0x2c01: "ar_JO", # Arabic - Jordan
+ 0x3001: "ar_LB", # Arabic - Lebanon
+ 0x3401: "ar_KW", # Arabic - Kuwait
+ 0x3801: "ar_AE", # Arabic - United Arab Emirates
+ 0x3c01: "ar_BH", # Arabic - Bahrain
+ 0x4001: "ar_QA", # Arabic - Qatar
+ 0x042b: "hy_AM", # Armenian
+ 0x044d: "as_IN", # Assamese - India
+ 0x042c: "az_AZ", # Azeri - Latin
+ 0x082c: "az_AZ", # Azeri - Cyrillic
+ 0x046d: "ba_RU", # Bashkir
+ 0x042d: "eu_ES", # Basque - Russia
+ 0x0423: "be_BY", # Belarusian
+ 0x0445: "bn_IN", # Begali
+ 0x201a: "bs_BA", # Bosnian - Cyrillic
+ 0x141a: "bs_BA", # Bosnian - Latin
+ 0x047e: "br_FR", # Breton - France
+ 0x0402: "bg_BG", # Bulgarian
+# 0x0455: "my_MM", # Burmese - Not supported
+ 0x0403: "ca_ES", # Catalan
+ 0x0004: "zh_CHS",# Chinese - Simplified
+ 0x0404: "zh_TW", # Chinese - Taiwan
+ 0x0804: "zh_CN", # Chinese - PRC
+ 0x0c04: "zh_HK", # Chinese - Hong Kong S.A.R.
+ 0x1004: "zh_SG", # Chinese - Singapore
+ 0x1404: "zh_MO", # Chinese - Macao S.A.R.
+ 0x7c04: "zh_CHT",# Chinese - Traditional
+ 0x0483: "co_FR", # Corsican - France
+ 0x041a: "hr_HR", # Croatian
+ 0x101a: "hr_BA", # Croatian - Bosnia
+ 0x0405: "cs_CZ", # Czech
+ 0x0406: "da_DK", # Danish
+ 0x048c: "gbz_AF",# Dari - Afghanistan
+ 0x0465: "div_MV",# Divehi - Maldives
+ 0x0413: "nl_NL", # Dutch - The Netherlands
+ 0x0813: "nl_BE", # Dutch - Belgium
+ 0x0409: "en_US", # English - United States
+ 0x0809: "en_GB", # English - United Kingdom
+ 0x0c09: "en_AU", # English - Australia
+ 0x1009: "en_CA", # English - Canada
+ 0x1409: "en_NZ", # English - New Zealand
+ 0x1809: "en_IE", # English - Ireland
+ 0x1c09: "en_ZA", # English - South Africa
+ 0x2009: "en_JA", # English - Jamaica
+ 0x2409: "en_CB", # English - Carribbean
+ 0x2809: "en_BZ", # English - Belize
+ 0x2c09: "en_TT", # English - Trinidad
+ 0x3009: "en_ZW", # English - Zimbabwe
+ 0x3409: "en_PH", # English - Philippines
+ 0x4009: "en_IN", # English - India
+ 0x4409: "en_MY", # English - Malaysia
+ 0x4809: "en_IN", # English - Singapore
+ 0x0425: "et_EE", # Estonian
+ 0x0438: "fo_FO", # Faroese
+ 0x0464: "fil_PH",# Filipino
+ 0x040b: "fi_FI", # Finnish
+ 0x040c: "fr_FR", # French - France
+ 0x080c: "fr_BE", # French - Belgium
+ 0x0c0c: "fr_CA", # French - Canada
+ 0x100c: "fr_CH", # French - Switzerland
+ 0x140c: "fr_LU", # French - Luxembourg
+ 0x180c: "fr_MC", # French - Monaco
+ 0x0462: "fy_NL", # Frisian - Netherlands
+ 0x0456: "gl_ES", # Galician
+ 0x0437: "ka_GE", # Georgian
+ 0x0407: "de_DE", # German - Germany
+ 0x0807: "de_CH", # German - Switzerland
+ 0x0c07: "de_AT", # German - Austria
+ 0x1007: "de_LU", # German - Luxembourg
+ 0x1407: "de_LI", # German - Liechtenstein
+ 0x0408: "el_GR", # Greek
+ 0x046f: "kl_GL", # Greenlandic - Greenland
+ 0x0447: "gu_IN", # Gujarati
+ 0x0468: "ha_NG", # Hausa - Latin
+ 0x040d: "he_IL", # Hebrew
+ 0x0439: "hi_IN", # Hindi
+ 0x040e: "hu_HU", # Hungarian
+ 0x040f: "is_IS", # Icelandic
+ 0x0421: "id_ID", # Indonesian
+ 0x045d: "iu_CA", # Inuktitut - Syllabics
+ 0x085d: "iu_CA", # Inuktitut - Latin
+ 0x083c: "ga_IE", # Irish - Ireland
+ 0x0410: "it_IT", # Italian - Italy
+ 0x0810: "it_CH", # Italian - Switzerland
+ 0x0411: "ja_JP", # Japanese
+ 0x044b: "kn_IN", # Kannada - India
+ 0x043f: "kk_KZ", # Kazakh
+ 0x0453: "kh_KH", # Khmer - Cambodia
+ 0x0486: "qut_GT",# K'iche - Guatemala
+ 0x0487: "rw_RW", # Kinyarwanda - Rwanda
+ 0x0457: "kok_IN",# Konkani
+ 0x0412: "ko_KR", # Korean
+ 0x0440: "ky_KG", # Kyrgyz
+ 0x0454: "lo_LA", # Lao - Lao PDR
+ 0x0426: "lv_LV", # Latvian
+ 0x0427: "lt_LT", # Lithuanian
+ 0x082e: "dsb_DE",# Lower Sorbian - Germany
+ 0x046e: "lb_LU", # Luxembourgish
+ 0x042f: "mk_MK", # FYROM Macedonian
+ 0x043e: "ms_MY", # Malay - Malaysia
+ 0x083e: "ms_BN", # Malay - Brunei Darussalam
+ 0x044c: "ml_IN", # Malayalam - India
+ 0x043a: "mt_MT", # Maltese
+ 0x0481: "mi_NZ", # Maori
+ 0x047a: "arn_CL",# Mapudungun
+ 0x044e: "mr_IN", # Marathi
+ 0x047c: "moh_CA",# Mohawk - Canada
+ 0x0450: "mn_MN", # Mongolian - Cyrillic
+ 0x0850: "mn_CN", # Mongolian - PRC
+ 0x0461: "ne_NP", # Nepali
+ 0x0414: "nb_NO", # Norwegian - Bokmal
+ 0x0814: "nn_NO", # Norwegian - Nynorsk
+ 0x0482: "oc_FR", # Occitan - France
+ 0x0448: "or_IN", # Oriya - India
+ 0x0463: "ps_AF", # Pashto - Afghanistan
+ 0x0429: "fa_IR", # Persian
+ 0x0415: "pl_PL", # Polish
+ 0x0416: "pt_BR", # Portuguese - Brazil
+ 0x0816: "pt_PT", # Portuguese - Portugal
+ 0x0446: "pa_IN", # Punjabi
+ 0x046b: "quz_BO",# Quechua (Bolivia)
+ 0x086b: "quz_EC",# Quechua (Ecuador)
+ 0x0c6b: "quz_PE",# Quechua (Peru)
+ 0x0418: "ro_RO", # Romanian - Romania
+ 0x0417: "rm_CH", # Romansh
+ 0x0419: "ru_RU", # Russian
+ 0x243b: "smn_FI",# Sami Finland
+ 0x103b: "smj_NO",# Sami Norway
+ 0x143b: "smj_SE",# Sami Sweden
+ 0x043b: "se_NO", # Sami Northern Norway
+ 0x083b: "se_SE", # Sami Northern Sweden
+ 0x0c3b: "se_FI", # Sami Northern Finland
+ 0x203b: "sms_FI",# Sami Skolt
+ 0x183b: "sma_NO",# Sami Southern Norway
+ 0x1c3b: "sma_SE",# Sami Southern Sweden
+ 0x044f: "sa_IN", # Sanskrit
+ 0x0c1a: "sr_SP", # Serbian - Cyrillic
+ 0x1c1a: "sr_BA", # Serbian - Bosnia Cyrillic
+ 0x081a: "sr_SP", # Serbian - Latin
+ 0x181a: "sr_BA", # Serbian - Bosnia Latin
+ 0x045b: "si_LK", # Sinhala - Sri Lanka
+ 0x046c: "ns_ZA", # Northern Sotho
+ 0x0432: "tn_ZA", # Setswana - Southern Africa
+ 0x041b: "sk_SK", # Slovak
+ 0x0424: "sl_SI", # Slovenian
+ 0x040a: "es_ES", # Spanish - Spain
+ 0x080a: "es_MX", # Spanish - Mexico
+ 0x0c0a: "es_ES", # Spanish - Spain (Modern)
+ 0x100a: "es_GT", # Spanish - Guatemala
+ 0x140a: "es_CR", # Spanish - Costa Rica
+ 0x180a: "es_PA", # Spanish - Panama
+ 0x1c0a: "es_DO", # Spanish - Dominican Republic
+ 0x200a: "es_VE", # Spanish - Venezuela
+ 0x240a: "es_CO", # Spanish - Colombia
+ 0x280a: "es_PE", # Spanish - Peru
+ 0x2c0a: "es_AR", # Spanish - Argentina
+ 0x300a: "es_EC", # Spanish - Ecuador
+ 0x340a: "es_CL", # Spanish - Chile
+ 0x380a: "es_UR", # Spanish - Uruguay
+ 0x3c0a: "es_PY", # Spanish - Paraguay
+ 0x400a: "es_BO", # Spanish - Bolivia
+ 0x440a: "es_SV", # Spanish - El Salvador
+ 0x480a: "es_HN", # Spanish - Honduras
+ 0x4c0a: "es_NI", # Spanish - Nicaragua
+ 0x500a: "es_PR", # Spanish - Puerto Rico
+ 0x540a: "es_US", # Spanish - United States
+# 0x0430: "", # Sutu - Not supported
+ 0x0441: "sw_KE", # Swahili
+ 0x041d: "sv_SE", # Swedish - Sweden
+ 0x081d: "sv_FI", # Swedish - Finland
+ 0x045a: "syr_SY",# Syriac
+ 0x0428: "tg_TJ", # Tajik - Cyrillic
+ 0x085f: "tmz_DZ",# Tamazight - Latin
+ 0x0449: "ta_IN", # Tamil
+ 0x0444: "tt_RU", # Tatar
+ 0x044a: "te_IN", # Telugu
+ 0x041e: "th_TH", # Thai
+ 0x0851: "bo_BT", # Tibetan - Bhutan
+ 0x0451: "bo_CN", # Tibetan - PRC
+ 0x041f: "tr_TR", # Turkish
+ 0x0442: "tk_TM", # Turkmen - Cyrillic
+ 0x0480: "ug_CN", # Uighur - Arabic
+ 0x0422: "uk_UA", # Ukrainian
+ 0x042e: "wen_DE",# Upper Sorbian - Germany
+ 0x0420: "ur_PK", # Urdu
+ 0x0820: "ur_IN", # Urdu - India
+ 0x0443: "uz_UZ", # Uzbek - Latin
+ 0x0843: "uz_UZ", # Uzbek - Cyrillic
+ 0x042a: "vi_VN", # Vietnamese
+ 0x0452: "cy_GB", # Welsh
+ 0x0488: "wo_SN", # Wolof - Senegal
+ 0x0434: "xh_ZA", # Xhosa - South Africa
+ 0x0485: "sah_RU",# Yakut - Cyrillic
+ 0x0478: "ii_CN", # Yi - PRC
+ 0x046a: "yo_NG", # Yoruba - Nigeria
+ 0x0435: "zu_ZA", # Zulu
+}
+
+def _print_locale():
+
+ """ Test function.
+ """
+ categories = {}
+ def _init_categories(categories=categories):
+ for k,v in globals().items():
+ if k[:3] == 'LC_':
+ categories[k] = v
+ _init_categories()
+ del categories['LC_ALL']
+
+ print 'Locale defaults as determined by getdefaultlocale():'
+ print '-'*72
+ lang, enc = getdefaultlocale()
+ print 'Language: ', lang or '(undefined)'
+ print 'Encoding: ', enc or '(undefined)'
+ print
+
+ print 'Locale settings on startup:'
+ print '-'*72
+ for name,category in categories.items():
+ print name, '...'
+ lang, enc = getlocale(category)
+ print ' Language: ', lang or '(undefined)'
+ print ' Encoding: ', enc or '(undefined)'
+ print
+
+ print
+ print 'Locale settings after calling resetlocale():'
+ print '-'*72
+ resetlocale()
+ for name,category in categories.items():
+ print name, '...'
+ lang, enc = getlocale(category)
+ print ' Language: ', lang or '(undefined)'
+ print ' Encoding: ', enc or '(undefined)'
+ print
+
+ try:
+ setlocale(LC_ALL, "")
+ except:
+ print 'NOTE:'
+ print 'setlocale(LC_ALL, "") does not support the default locale'
+ print 'given in the OS environment variables.'
+ else:
+ print
+ print 'Locale settings after calling setlocale(LC_ALL, ""):'
+ print '-'*72
+ for name,category in categories.items():
+ print name, '...'
+ lang, enc = getlocale(category)
+ print ' Language: ', lang or '(undefined)'
+ print ' Encoding: ', enc or '(undefined)'
+ print
+
+###
+
+try:
+ LC_MESSAGES
+except NameError:
+ pass
+else:
+ __all__.append("LC_MESSAGES")
+
+if __name__=='__main__':
+ print 'Locale aliasing:'
+ print
+ _print_locale()
+ print
+ print 'Number formatting:'
+ print
+ _test()
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
index 0000000000..10d0b057bc
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/md5.py
@@ -0,0 +1,14 @@
+# $Id$
+#
+# Copyright (C) 2005 Gregory P. Smith (greg@krypto.org)
+# Licensed to PSF under a Contributor Agreement.
+
+import warnings
+warnings.warn("the md5 module is deprecated; use hashlib instead",
+ DeprecationWarning, 2)
+
+from hashlib import md5
+new = md5
+
+blocksize = 1 # legacy value (wrong in any useful sense)
+digest_size = 16
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
index 0000000000..3091fdcac8
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/modulefinder.py
@@ -0,0 +1,673 @@
+"""Find modules used by a script, using introspection."""
+# This module should be kept compatible with Python 2.2, see PEP 291.
+
+from __future__ import generators
+import dis
+import imp
+import marshal
+import os
+import sys
+import types
+import struct
+
+if hasattr(sys.__stdout__, "newlines"):
+ READ_MODE = "U" # universal line endings
+else:
+ # remain compatible with Python < 2.3
+ READ_MODE = "r"
+
+LOAD_CONST = chr(dis.opname.index('LOAD_CONST'))
+IMPORT_NAME = chr(dis.opname.index('IMPORT_NAME'))
+STORE_NAME = chr(dis.opname.index('STORE_NAME'))
+STORE_GLOBAL = chr(dis.opname.index('STORE_GLOBAL'))
+STORE_OPS = [STORE_NAME, STORE_GLOBAL]
+HAVE_ARGUMENT = chr(dis.HAVE_ARGUMENT)
+
+# Modulefinder does a good job at simulating Python's, but it can not
+# handle __path__ modifications packages make at runtime. Therefore there
+# is a mechanism whereby you can register extra paths in this map for a
+# package, and it will be honored.
+
+# Note this is a mapping is lists of paths.
+packagePathMap = {}
+
+# A Public interface
+def AddPackagePath(packagename, path):
+ paths = packagePathMap.get(packagename, [])
+ paths.append(path)
+ packagePathMap[packagename] = paths
+
+replacePackageMap = {}
+
+# This ReplacePackage mechanism allows modulefinder to work around the
+# way the _xmlplus package injects itself under the name "xml" into
+# sys.modules at runtime by calling ReplacePackage("_xmlplus", "xml")
+# before running ModuleFinder.
+
+def ReplacePackage(oldname, newname):
+ replacePackageMap[oldname] = newname
+
+
+class Module:
+
+ def __init__(self, name, file=None, path=None):
+ self.__name__ = name
+ self.__file__ = file
+ self.__path__ = path
+ self.__code__ = None
+ # The set of global names that are assigned to in the module.
+ # This includes those names imported through starimports of
+ # Python modules.
+ self.globalnames = {}
+ # The set of starimports this module did that could not be
+ # resolved, ie. a starimport from a non-Python module.
+ self.starimports = {}
+
+ def __repr__(self):
+ s = "Module(%r" % (self.__name__,)
+ if self.__file__ is not None:
+ s = s + ", %r" % (self.__file__,)
+ if self.__path__ is not None:
+ s = s + ", %r" % (self.__path__,)
+ s = s + ")"
+ return s
+
+class ModuleFinder:
+
+ def __init__(self, path=None, debug=0, excludes=[], replace_paths=[]):
+ if path is None:
+ path = sys.path
+ self.path = path
+ self.modules = {}
+ self.badmodules = {}
+ self.debug = debug
+ self.indent = 0
+ self.excludes = excludes
+ self.replace_paths = replace_paths
+ self.processed_paths = [] # Used in debugging only
+
+ def msg(self, level, str, *args):
+ if level <= self.debug:
+ for i in range(self.indent):
+ print " ",
+ print str,
+ for arg in args:
+ print repr(arg),
+ print
+
+ def msgin(self, *args):
+ level = args[0]
+ if level <= self.debug:
+ self.indent = self.indent + 1
+ self.msg(*args)
+
+ def msgout(self, *args):
+ level = args[0]
+ if level <= self.debug:
+ self.indent = self.indent - 1
+ self.msg(*args)
+
+ def run_script(self, pathname):
+ self.msg(2, "run_script", pathname)
+ with open(pathname, READ_MODE) as fp:
+ stuff = ("", "r", imp.PY_SOURCE)
+ self.load_module('__main__', fp, pathname, stuff)
+
+ def load_file(self, pathname):
+ dir, name = os.path.split(pathname)
+ name, ext = os.path.splitext(name)
+ with open(pathname, READ_MODE) as fp:
+ stuff = (ext, "r", imp.PY_SOURCE)
+ self.load_module(name, fp, pathname, stuff)
+
+ def import_hook(self, name, caller=None, fromlist=None, level=-1):
+ self.msg(3, "import_hook", name, caller, fromlist, level)
+ parent = self.determine_parent(caller, level=level)
+ q, tail = self.find_head_package(parent, name)
+ m = self.load_tail(q, tail)
+ if not fromlist:
+ return q
+ if m.__path__:
+ self.ensure_fromlist(m, fromlist)
+ return None
+
+ def determine_parent(self, caller, level=-1):
+ self.msgin(4, "determine_parent", caller, level)
+ if not caller or level == 0:
+ self.msgout(4, "determine_parent -> None")
+ return None
+ pname = caller.__name__
+ if level >= 1: # relative import
+ if caller.__path__:
+ level -= 1
+ if level == 0:
+ parent = self.modules[pname]
+ assert parent is caller
+ self.msgout(4, "determine_parent ->", parent)
+ return parent
+ if pname.count(".") < level:
+ raise ImportError, "relative importpath too deep"
+ pname = ".".join(pname.split(".")[:-level])
+ parent = self.modules[pname]
+ self.msgout(4, "determine_parent ->", parent)
+ return parent
+ if caller.__path__:
+ parent = self.modules[pname]
+ assert caller is parent
+ self.msgout(4, "determine_parent ->", parent)
+ return parent
+ if '.' in pname:
+ i = pname.rfind('.')
+ pname = pname[:i]
+ parent = self.modules[pname]
+ assert parent.__name__ == pname
+ self.msgout(4, "determine_parent ->", parent)
+ return parent
+ self.msgout(4, "determine_parent -> None")
+ return None
+
+ def find_head_package(self, parent, name):
+ self.msgin(4, "find_head_package", parent, name)
+ if '.' in name:
+ i = name.find('.')
+ head = name[:i]
+ tail = name[i+1:]
+ else:
+ head = name
+ tail = ""
+ if parent:
+ qname = "%s.%s" % (parent.__name__, head)
+ else:
+ qname = head
+ q = self.import_module(head, qname, parent)
+ if q:
+ self.msgout(4, "find_head_package ->", (q, tail))
+ return q, tail
+ if parent:
+ qname = head
+ parent = None
+ q = self.import_module(head, qname, parent)
+ if q:
+ self.msgout(4, "find_head_package ->", (q, tail))
+ return q, tail
+ self.msgout(4, "raise ImportError: No module named", qname)
+ raise ImportError, "No module named " + qname
+
+ def load_tail(self, q, tail):
+ self.msgin(4, "load_tail", q, tail)
+ m = q
+ while tail:
+ i = tail.find('.')
+ if i < 0: i = len(tail)
+ head, tail = tail[:i], tail[i+1:]
+ mname = "%s.%s" % (m.__name__, head)
+ m = self.import_module(head, mname, m)
+ if not m:
+ self.msgout(4, "raise ImportError: No module named", mname)
+ raise ImportError, "No module named " + mname
+ self.msgout(4, "load_tail ->", m)
+ return m
+
+ def ensure_fromlist(self, m, fromlist, recursive=0):
+ self.msg(4, "ensure_fromlist", m, fromlist, recursive)
+ for sub in fromlist:
+ if sub == "*":
+ if not recursive:
+ all = self.find_all_submodules(m)
+ if all:
+ self.ensure_fromlist(m, all, 1)
+ elif not hasattr(m, sub):
+ subname = "%s.%s" % (m.__name__, sub)
+ submod = self.import_module(sub, subname, m)
+ if not submod:
+ raise ImportError, "No module named " + subname
+
+ def find_all_submodules(self, m):
+ if not m.__path__:
+ return
+ modules = {}
+ # 'suffixes' used to be a list hardcoded to [".py", ".pyc", ".pyo"].
+ # But we must also collect Python extension modules - although
+ # we cannot separate normal dlls from Python extensions.
+ suffixes = []
+ for triple in imp.get_suffixes():
+ suffixes.append(triple[0])
+ for dir in m.__path__:
+ try:
+ names = os.listdir(dir)
+ except os.error:
+ self.msg(2, "can't list directory", dir)
+ continue
+ for name in names:
+ mod = None
+ for suff in suffixes:
+ n = len(suff)
+ if name[-n:] == suff:
+ mod = name[:-n]
+ break
+ if mod and mod != "__init__":
+ modules[mod] = mod
+ return modules.keys()
+
+ def import_module(self, partname, fqname, parent):
+ self.msgin(3, "import_module", partname, fqname, parent)
+ try:
+ m = self.modules[fqname]
+ except KeyError:
+ pass
+ else:
+ self.msgout(3, "import_module ->", m)
+ return m
+ if fqname in self.badmodules:
+ self.msgout(3, "import_module -> None")
+ return None
+ if parent and parent.__path__ is None:
+ self.msgout(3, "import_module -> None")
+ return None
+ try:
+ fp, pathname, stuff = self.find_module(partname,
+ parent and parent.__path__, parent)
+ except ImportError:
+ self.msgout(3, "import_module ->", None)
+ return None
+ try:
+ m = self.load_module(fqname, fp, pathname, stuff)
+ finally:
+ if fp: fp.close()
+ if parent:
+ setattr(parent, partname, m)
+ self.msgout(3, "import_module ->", m)
+ return m
+
+ def load_module(self, fqname, fp, pathname, file_info):
+ suffix, mode, type = file_info
+ self.msgin(2, "load_module", fqname, fp and "fp", pathname)
+ if type == imp.PKG_DIRECTORY:
+ m = self.load_package(fqname, pathname)
+ self.msgout(2, "load_module ->", m)
+ return m
+ if type == imp.PY_SOURCE:
+ co = compile(fp.read()+'\n', pathname, 'exec')
+ elif type == imp.PY_COMPILED:
+ if fp.read(4) != imp.get_magic():
+ self.msgout(2, "raise ImportError: Bad magic number", pathname)
+ raise ImportError, "Bad magic number in %s" % pathname
+ fp.read(4)
+ co = marshal.load(fp)
+ else:
+ co = None
+ m = self.add_module(fqname)
+ m.__file__ = pathname
+ if co:
+ if self.replace_paths:
+ co = self.replace_paths_in_code(co)
+ m.__code__ = co
+ self.scan_code(co, m)
+ self.msgout(2, "load_module ->", m)
+ return m
+
+ def _add_badmodule(self, name, caller):
+ if name not in self.badmodules:
+ self.badmodules[name] = {}
+ if caller:
+ self.badmodules[name][caller.__name__] = 1
+ else:
+ self.badmodules[name]["-"] = 1
+
+ def _safe_import_hook(self, name, caller, fromlist, level=-1):
+ # wrapper for self.import_hook() that won't raise ImportError
+ if name in self.badmodules:
+ self._add_badmodule(name, caller)
+ return
+ try:
+ self.import_hook(name, caller, level=level)
+ except ImportError, msg:
+ self.msg(2, "ImportError:", str(msg))
+ self._add_badmodule(name, caller)
+ else:
+ if fromlist:
+ for sub in fromlist:
+ if sub in self.badmodules:
+ self._add_badmodule(sub, caller)
+ continue
+ try:
+ self.import_hook(name, caller, [sub], level=level)
+ except ImportError, msg:
+ self.msg(2, "ImportError:", str(msg))
+ fullname = name + "." + sub
+ self._add_badmodule(fullname, caller)
+
+ def scan_opcodes(self, co,
+ unpack = struct.unpack):
+ # Scan the code, and yield 'interesting' opcode combinations
+ # Version for Python 2.4 and older
+ code = co.co_code
+ names = co.co_names
+ consts = co.co_consts
+ while code:
+ c = code[0]
+ if c in STORE_OPS:
+ oparg, = unpack('<H', code[1:3])
+ yield "store", (names[oparg],)
+ code = code[3:]
+ continue
+ if c == LOAD_CONST and code[3] == IMPORT_NAME:
+ oparg_1, oparg_2 = unpack('<xHxH', code[:6])
+ yield "import", (consts[oparg_1], names[oparg_2])
+ code = code[6:]
+ continue
+ if c >= HAVE_ARGUMENT:
+ code = code[3:]
+ else:
+ code = code[1:]
+
+ def scan_opcodes_25(self, co,
+ unpack = struct.unpack):
+ # Scan the code, and yield 'interesting' opcode combinations
+ # Python 2.5 version (has absolute and relative imports)
+ code = co.co_code
+ names = co.co_names
+ consts = co.co_consts
+ LOAD_LOAD_AND_IMPORT = LOAD_CONST + LOAD_CONST + IMPORT_NAME
+ while code:
+ c = code[0]
+ if c in STORE_OPS:
+ oparg, = unpack('<H', code[1:3])
+ yield "store", (names[oparg],)
+ code = code[3:]
+ continue
+ if code[:9:3] == LOAD_LOAD_AND_IMPORT:
+ oparg_1, oparg_2, oparg_3 = unpack('<xHxHxH', code[:9])
+ level = consts[oparg_1]
+ if level == -1: # normal import
+ yield "import", (consts[oparg_2], names[oparg_3])
+ elif level == 0: # absolute import
+ yield "absolute_import", (consts[oparg_2], names[oparg_3])
+ else: # relative import
+ yield "relative_import", (level, consts[oparg_2], names[oparg_3])
+ code = code[9:]
+ continue
+ if c >= HAVE_ARGUMENT:
+ code = code[3:]
+ else:
+ code = code[1:]
+
+ def scan_code(self, co, m):
+ code = co.co_code
+ if sys.version_info >= (2, 5):
+ scanner = self.scan_opcodes_25
+ else:
+ scanner = self.scan_opcodes
+ for what, args in scanner(co):
+ if what == "store":
+ name, = args
+ m.globalnames[name] = 1
+ elif what in ("import", "absolute_import"):
+ fromlist, name = args
+ have_star = 0
+ if fromlist is not None:
+ if "*" in fromlist:
+ have_star = 1
+ fromlist = [f for f in fromlist if f != "*"]
+ if what == "absolute_import": level = 0
+ else: level = -1
+ self._safe_import_hook(name, m, fromlist, level=level)
+ if have_star:
+ # We've encountered an "import *". If it is a Python module,
+ # the code has already been parsed and we can suck out the
+ # global names.
+ mm = None
+ if m.__path__:
+ # At this point we don't know whether 'name' is a
+ # submodule of 'm' or a global module. Let's just try
+ # the full name first.
+ mm = self.modules.get(m.__name__ + "." + name)
+ if mm is None:
+ mm = self.modules.get(name)
+ if mm is not None:
+ m.globalnames.update(mm.globalnames)
+ m.starimports.update(mm.starimports)
+ if mm.__code__ is None:
+ m.starimports[name] = 1
+ else:
+ m.starimports[name] = 1
+ elif what == "relative_import":
+ level, fromlist, name = args
+ if name:
+ self._safe_import_hook(name, m, fromlist, level=level)
+ else:
+ parent = self.determine_parent(m, level=level)
+ self._safe_import_hook(parent.__name__, None, fromlist, level=0)
+ else:
+ # We don't expect anything else from the generator.
+ raise RuntimeError(what)
+
+ for c in co.co_consts:
+ if isinstance(c, type(co)):
+ self.scan_code(c, m)
+
+ def load_package(self, fqname, pathname):
+ self.msgin(2, "load_package", fqname, pathname)
+ newname = replacePackageMap.get(fqname)
+ if newname:
+ fqname = newname
+ m = self.add_module(fqname)
+ m.__file__ = pathname
+ m.__path__ = [pathname]
+
+ # As per comment at top of file, simulate runtime __path__ additions.
+ m.__path__ = m.__path__ + packagePathMap.get(fqname, [])
+
+ fp, buf, stuff = self.find_module("__init__", m.__path__)
+ self.load_module(fqname, fp, buf, stuff)
+ self.msgout(2, "load_package ->", m)
+ if fp:
+ fp.close()
+ return m
+
+ def add_module(self, fqname):
+ if fqname in self.modules:
+ return self.modules[fqname]
+ self.modules[fqname] = m = Module(fqname)
+ return m
+
+ def find_module(self, name, path, parent=None):
+ if parent is not None:
+ # assert path is not None
+ fullname = parent.__name__+'.'+name
+ else:
+ fullname = name
+ if fullname in self.excludes:
+ self.msgout(3, "find_module -> Excluded", fullname)
+ raise ImportError, name
+
+ if path is None:
+ if name in sys.builtin_module_names:
+ return (None, None, ("", "", imp.C_BUILTIN))
+
+ path = self.path
+ return imp.find_module(name, path)
+
+ def report(self):
+ """Print a report to stdout, listing the found modules with their
+ paths, as well as modules that are missing, or seem to be missing.
+ """
+ print
+ print " %-25s %s" % ("Name", "File")
+ print " %-25s %s" % ("----", "----")
+ # Print modules found
+ keys = self.modules.keys()
+ keys.sort()
+ for key in keys:
+ m = self.modules[key]
+ if m.__path__:
+ print "P",
+ else:
+ print "m",
+ print "%-25s" % key, m.__file__ or ""
+
+ # Print missing modules
+ missing, maybe = self.any_missing_maybe()
+ if missing:
+ print
+ print "Missing modules:"
+ for name in missing:
+ mods = self.badmodules[name].keys()
+ mods.sort()
+ print "?", name, "imported from", ', '.join(mods)
+ # Print modules that may be missing, but then again, maybe not...
+ if maybe:
+ print
+ print "Submodules that appear to be missing, but could also be",
+ print "global names in the parent package:"
+ for name in maybe:
+ mods = self.badmodules[name].keys()
+ mods.sort()
+ print "?", name, "imported from", ', '.join(mods)
+
+ def any_missing(self):
+ """Return a list of modules that appear to be missing. Use
+ any_missing_maybe() if you want to know which modules are
+ certain to be missing, and which *may* be missing.
+ """
+ missing, maybe = self.any_missing_maybe()
+ return missing + maybe
+
+ def any_missing_maybe(self):
+ """Return two lists, one with modules that are certainly missing
+ and one with modules that *may* be missing. The latter names could
+ either be submodules *or* just global names in the package.
+
+ The reason it can't always be determined is that it's impossible to
+ tell which names are imported when "from module import *" is done
+ with an extension module, short of actually importing it.
+ """
+ missing = []
+ maybe = []
+ for name in self.badmodules:
+ if name in self.excludes:
+ continue
+ i = name.rfind(".")
+ if i < 0:
+ missing.append(name)
+ continue
+ subname = name[i+1:]
+ pkgname = name[:i]
+ pkg = self.modules.get(pkgname)
+ if pkg is not None:
+ if pkgname in self.badmodules[name]:
+ # The package tried to import this module itself and
+ # failed. It's definitely missing.
+ missing.append(name)
+ elif subname in pkg.globalnames:
+ # It's a global in the package: definitely not missing.
+ pass
+ elif pkg.starimports:
+ # It could be missing, but the package did an "import *"
+ # from a non-Python module, so we simply can't be sure.
+ maybe.append(name)
+ else:
+ # It's not a global in the package, the package didn't
+ # do funny star imports, it's very likely to be missing.
+ # The symbol could be inserted into the package from the
+ # outside, but since that's not good style we simply list
+ # it missing.
+ missing.append(name)
+ else:
+ missing.append(name)
+ missing.sort()
+ maybe.sort()
+ return missing, maybe
+
+ def replace_paths_in_code(self, co):
+ new_filename = original_filename = os.path.normpath(co.co_filename)
+ for f, r in self.replace_paths:
+ if original_filename.startswith(f):
+ new_filename = r + original_filename[len(f):]
+ break
+
+ if self.debug and original_filename not in self.processed_paths:
+ if new_filename != original_filename:
+ self.msgout(2, "co_filename %r changed to %r" \
+ % (original_filename,new_filename,))
+ else:
+ self.msgout(2, "co_filename %r remains unchanged" \
+ % (original_filename,))
+ self.processed_paths.append(original_filename)
+
+ consts = list(co.co_consts)
+ for i in range(len(consts)):
+ if isinstance(consts[i], type(co)):
+ consts[i] = self.replace_paths_in_code(consts[i])
+
+ return types.CodeType(co.co_argcount, co.co_nlocals, co.co_stacksize,
+ co.co_flags, co.co_code, tuple(consts), co.co_names,
+ co.co_varnames, new_filename, co.co_name,
+ co.co_firstlineno, co.co_lnotab,
+ co.co_freevars, co.co_cellvars)
+
+
+def test():
+ # Parse command line
+ import getopt
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "dmp:qx:")
+ except getopt.error, msg:
+ print msg
+ return
+
+ # Process options
+ debug = 1
+ domods = 0
+ addpath = []
+ exclude = []
+ for o, a in opts:
+ if o == '-d':
+ debug = debug + 1
+ if o == '-m':
+ domods = 1
+ if o == '-p':
+ addpath = addpath + a.split(os.pathsep)
+ if o == '-q':
+ debug = 0
+ if o == '-x':
+ exclude.append(a)
+
+ # Provide default arguments
+ if not args:
+ script = "hello.py"
+ else:
+ script = args[0]
+
+ # Set the path based on sys.path and the script directory
+ path = sys.path[:]
+ path[0] = os.path.dirname(script)
+ path = addpath + path
+ if debug > 1:
+ print "path:"
+ for item in path:
+ print " ", repr(item)
+
+ # Create the module finder and turn its crank
+ mf = ModuleFinder(path, debug, exclude)
+ for arg in args[1:]:
+ if arg == '-m':
+ domods = 1
+ continue
+ if domods:
+ if arg[-2:] == '.*':
+ mf.import_hook(arg[:-2], None, ["*"])
+ else:
+ mf.import_hook(arg)
+ else:
+ mf.load_file(arg)
+ mf.run_script(script)
+ mf.report()
+ return mf # for -i debugging
+
+
+if __name__ == '__main__':
+ try:
+ mf = test()
+ except KeyboardInterrupt:
+ print "\n[interrupt]"
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
index 0000000000..f41775a3bc
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/numbers.py
@@ -0,0 +1,391 @@
+# Copyright 2007 Google, Inc. All Rights Reserved.
+# Licensed to PSF under a Contributor Agreement.
+
+"""Abstract Base Classes (ABCs) for numbers, according to PEP 3141.
+
+TODO: Fill out more detailed documentation on the operators."""
+
+from __future__ import division
+from abc import ABCMeta, abstractmethod, abstractproperty
+
+__all__ = ["Number", "Complex", "Real", "Rational", "Integral"]
+
+class Number(object):
+ """All numbers inherit from this class.
+
+ If you just want to check if an argument x is a number, without
+ caring what kind, use isinstance(x, Number).
+ """
+ __metaclass__ = ABCMeta
+ __slots__ = ()
+
+ # Concrete numeric types must provide their own hash implementation
+ __hash__ = None
+
+
+## Notes on Decimal
+## ----------------
+## Decimal has all of the methods specified by the Real abc, but it should
+## not be registered as a Real because decimals do not interoperate with
+## binary floats (i.e. Decimal('3.14') + 2.71828 is undefined). But,
+## abstract reals are expected to interoperate (i.e. R1 + R2 should be
+## expected to work if R1 and R2 are both Reals).
+
+class Complex(Number):
+ """Complex defines the operations that work on the builtin complex type.
+
+ In short, those are: a conversion to complex, .real, .imag, +, -,
+ *, /, abs(), .conjugate, ==, and !=.
+
+ If it is given heterogenous arguments, and doesn't have special
+ knowledge about them, it should fall back to the builtin complex
+ type as described below.
+ """
+
+ __slots__ = ()
+
+ @abstractmethod
+ def __complex__(self):
+ """Return a builtin complex instance. Called for complex(self)."""
+
+ # Will be __bool__ in 3.0.
+ def __nonzero__(self):
+ """True if self != 0. Called for bool(self)."""
+ return self != 0
+
+ @abstractproperty
+ def real(self):
+ """Retrieve the real component of this number.
+
+ This should subclass Real.
+ """
+ raise NotImplementedError
+
+ @abstractproperty
+ def imag(self):
+ """Retrieve the imaginary component of this number.
+
+ This should subclass Real.
+ """
+ raise NotImplementedError
+
+ @abstractmethod
+ def __add__(self, other):
+ """self + other"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __radd__(self, other):
+ """other + self"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __neg__(self):
+ """-self"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __pos__(self):
+ """+self"""
+ raise NotImplementedError
+
+ def __sub__(self, other):
+ """self - other"""
+ return self + -other
+
+ def __rsub__(self, other):
+ """other - self"""
+ return -self + other
+
+ @abstractmethod
+ def __mul__(self, other):
+ """self * other"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __rmul__(self, other):
+ """other * self"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __div__(self, other):
+ """self / other without __future__ division
+
+ May promote to float.
+ """
+ raise NotImplementedError
+
+ @abstractmethod
+ def __rdiv__(self, other):
+ """other / self without __future__ division"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __truediv__(self, other):
+ """self / other with __future__ division.
+
+ Should promote to float when necessary.
+ """
+ raise NotImplementedError
+
+ @abstractmethod
+ def __rtruediv__(self, other):
+ """other / self with __future__ division"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __pow__(self, exponent):
+ """self**exponent; should promote to float or complex when necessary."""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __rpow__(self, base):
+ """base ** self"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __abs__(self):
+ """Returns the Real distance from 0. Called for abs(self)."""
+ raise NotImplementedError
+
+ @abstractmethod
+ def conjugate(self):
+ """(x+y*i).conjugate() returns (x-y*i)."""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __eq__(self, other):
+ """self == other"""
+ raise NotImplementedError
+
+ def __ne__(self, other):
+ """self != other"""
+ # The default __ne__ doesn't negate __eq__ until 3.0.
+ return not (self == other)
+
+Complex.register(complex)
+
+
+class Real(Complex):
+ """To Complex, Real adds the operations that work on real numbers.
+
+ In short, those are: a conversion to float, trunc(), divmod,
+ %, <, <=, >, and >=.
+
+ Real also provides defaults for the derived operations.
+ """
+
+ __slots__ = ()
+
+ @abstractmethod
+ def __float__(self):
+ """Any Real can be converted to a native float object.
+
+ Called for float(self)."""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __trunc__(self):
+ """trunc(self): Truncates self to an Integral.
+
+ Returns an Integral i such that:
+ * i>0 iff self>0;
+ * abs(i) <= abs(self);
+ * for any Integral j satisfying the first two conditions,
+ abs(i) >= abs(j) [i.e. i has "maximal" abs among those].
+ i.e. "truncate towards 0".
+ """
+ raise NotImplementedError
+
+ def __divmod__(self, other):
+ """divmod(self, other): The pair (self // other, self % other).
+
+ Sometimes this can be computed faster than the pair of
+ operations.
+ """
+ return (self // other, self % other)
+
+ def __rdivmod__(self, other):
+ """divmod(other, self): The pair (self // other, self % other).
+
+ Sometimes this can be computed faster than the pair of
+ operations.
+ """
+ return (other // self, other % self)
+
+ @abstractmethod
+ def __floordiv__(self, other):
+ """self // other: The floor() of self/other."""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __rfloordiv__(self, other):
+ """other // self: The floor() of other/self."""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __mod__(self, other):
+ """self % other"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __rmod__(self, other):
+ """other % self"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __lt__(self, other):
+ """self < other
+
+ < on Reals defines a total ordering, except perhaps for NaN."""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __le__(self, other):
+ """self <= other"""
+ raise NotImplementedError
+
+ # Concrete implementations of Complex abstract methods.
+ def __complex__(self):
+ """complex(self) == complex(float(self), 0)"""
+ return complex(float(self))
+
+ @property
+ def real(self):
+ """Real numbers are their real component."""
+ return +self
+
+ @property
+ def imag(self):
+ """Real numbers have no imaginary component."""
+ return 0
+
+ def conjugate(self):
+ """Conjugate is a no-op for Reals."""
+ return +self
+
+Real.register(float)
+
+
+class Rational(Real):
+ """.numerator and .denominator should be in lowest terms."""
+
+ __slots__ = ()
+
+ @abstractproperty
+ def numerator(self):
+ raise NotImplementedError
+
+ @abstractproperty
+ def denominator(self):
+ raise NotImplementedError
+
+ # Concrete implementation of Real's conversion to float.
+ def __float__(self):
+ """float(self) = self.numerator / self.denominator
+
+ It's important that this conversion use the integer's "true"
+ division rather than casting one side to float before dividing
+ so that ratios of huge integers convert without overflowing.
+
+ """
+ return self.numerator / self.denominator
+
+
+class Integral(Rational):
+ """Integral adds a conversion to long and the bit-string operations."""
+
+ __slots__ = ()
+
+ @abstractmethod
+ def __long__(self):
+ """long(self)"""
+ raise NotImplementedError
+
+ def __index__(self):
+ """Called whenever an index is needed, such as in slicing"""
+ return long(self)
+
+ @abstractmethod
+ def __pow__(self, exponent, modulus=None):
+ """self ** exponent % modulus, but maybe faster.
+
+ Accept the modulus argument if you want to support the
+ 3-argument version of pow(). Raise a TypeError if exponent < 0
+ or any argument isn't Integral. Otherwise, just implement the
+ 2-argument version described in Complex.
+ """
+ raise NotImplementedError
+
+ @abstractmethod
+ def __lshift__(self, other):
+ """self << other"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __rlshift__(self, other):
+ """other << self"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __rshift__(self, other):
+ """self >> other"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __rrshift__(self, other):
+ """other >> self"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __and__(self, other):
+ """self & other"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __rand__(self, other):
+ """other & self"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __xor__(self, other):
+ """self ^ other"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __rxor__(self, other):
+ """other ^ self"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __or__(self, other):
+ """self | other"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __ror__(self, other):
+ """other | self"""
+ raise NotImplementedError
+
+ @abstractmethod
+ def __invert__(self):
+ """~self"""
+ raise NotImplementedError
+
+ # Concrete implementations of Rational and Real abstract methods.
+ def __float__(self):
+ """float(self) == float(long(self))"""
+ return float(long(self))
+
+ @property
+ def numerator(self):
+ """Integers are their own numerators."""
+ return +self
+
+ @property
+ def denominator(self):
+ """Integers have a denominator of 1."""
+ return 1
+
+Integral.register(int)
+Integral.register(long)
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
index 0000000000..14e8d5c9e5
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/opcode.py
@@ -0,0 +1,192 @@
+
+"""
+opcode module - potentially shared between dis and other modules which
+operate on bytecodes (e.g. peephole optimizers).
+"""
+
+__all__ = ["cmp_op", "hasconst", "hasname", "hasjrel", "hasjabs",
+ "haslocal", "hascompare", "hasfree", "opname", "opmap",
+ "HAVE_ARGUMENT", "EXTENDED_ARG"]
+
+cmp_op = ('<', '<=', '==', '!=', '>', '>=', 'in', 'not in', 'is',
+ 'is not', 'exception match', 'BAD')
+
+hasconst = []
+hasname = []
+hasjrel = []
+hasjabs = []
+haslocal = []
+hascompare = []
+hasfree = []
+
+opmap = {}
+opname = [''] * 256
+for op in range(256): opname[op] = '<%r>' % (op,)
+del op
+
+def def_op(name, op):
+ opname[op] = name
+ opmap[name] = op
+
+def name_op(name, op):
+ def_op(name, op)
+ hasname.append(op)
+
+def jrel_op(name, op):
+ def_op(name, op)
+ hasjrel.append(op)
+
+def jabs_op(name, op):
+ def_op(name, op)
+ hasjabs.append(op)
+
+# Instruction opcodes for compiled code
+# Blank lines correspond to available opcodes
+
+def_op('STOP_CODE', 0)
+def_op('POP_TOP', 1)
+def_op('ROT_TWO', 2)
+def_op('ROT_THREE', 3)
+def_op('DUP_TOP', 4)
+def_op('ROT_FOUR', 5)
+
+def_op('NOP', 9)
+def_op('UNARY_POSITIVE', 10)
+def_op('UNARY_NEGATIVE', 11)
+def_op('UNARY_NOT', 12)
+def_op('UNARY_CONVERT', 13)
+
+def_op('UNARY_INVERT', 15)
+
+def_op('BINARY_POWER', 19)
+def_op('BINARY_MULTIPLY', 20)
+def_op('BINARY_DIVIDE', 21)
+def_op('BINARY_MODULO', 22)
+def_op('BINARY_ADD', 23)
+def_op('BINARY_SUBTRACT', 24)
+def_op('BINARY_SUBSCR', 25)
+def_op('BINARY_FLOOR_DIVIDE', 26)
+def_op('BINARY_TRUE_DIVIDE', 27)
+def_op('INPLACE_FLOOR_DIVIDE', 28)
+def_op('INPLACE_TRUE_DIVIDE', 29)
+def_op('SLICE+0', 30)
+def_op('SLICE+1', 31)
+def_op('SLICE+2', 32)
+def_op('SLICE+3', 33)
+
+def_op('STORE_SLICE+0', 40)
+def_op('STORE_SLICE+1', 41)
+def_op('STORE_SLICE+2', 42)
+def_op('STORE_SLICE+3', 43)
+
+def_op('DELETE_SLICE+0', 50)
+def_op('DELETE_SLICE+1', 51)
+def_op('DELETE_SLICE+2', 52)
+def_op('DELETE_SLICE+3', 53)
+
+def_op('STORE_MAP', 54)
+def_op('INPLACE_ADD', 55)
+def_op('INPLACE_SUBTRACT', 56)
+def_op('INPLACE_MULTIPLY', 57)
+def_op('INPLACE_DIVIDE', 58)
+def_op('INPLACE_MODULO', 59)
+def_op('STORE_SUBSCR', 60)
+def_op('DELETE_SUBSCR', 61)
+def_op('BINARY_LSHIFT', 62)
+def_op('BINARY_RSHIFT', 63)
+def_op('BINARY_AND', 64)
+def_op('BINARY_XOR', 65)
+def_op('BINARY_OR', 66)
+def_op('INPLACE_POWER', 67)
+def_op('GET_ITER', 68)
+
+def_op('PRINT_EXPR', 70)
+def_op('PRINT_ITEM', 71)
+def_op('PRINT_NEWLINE', 72)
+def_op('PRINT_ITEM_TO', 73)
+def_op('PRINT_NEWLINE_TO', 74)
+def_op('INPLACE_LSHIFT', 75)
+def_op('INPLACE_RSHIFT', 76)
+def_op('INPLACE_AND', 77)
+def_op('INPLACE_XOR', 78)
+def_op('INPLACE_OR', 79)
+def_op('BREAK_LOOP', 80)
+def_op('WITH_CLEANUP', 81)
+def_op('LOAD_LOCALS', 82)
+def_op('RETURN_VALUE', 83)
+def_op('IMPORT_STAR', 84)
+def_op('EXEC_STMT', 85)
+def_op('YIELD_VALUE', 86)
+def_op('POP_BLOCK', 87)
+def_op('END_FINALLY', 88)
+def_op('BUILD_CLASS', 89)
+
+HAVE_ARGUMENT = 90 # Opcodes from here have an argument:
+
+name_op('STORE_NAME', 90) # Index in name list
+name_op('DELETE_NAME', 91) # ""
+def_op('UNPACK_SEQUENCE', 92) # Number of tuple items
+jrel_op('FOR_ITER', 93)
+def_op('LIST_APPEND', 94)
+name_op('STORE_ATTR', 95) # Index in name list
+name_op('DELETE_ATTR', 96) # ""
+name_op('STORE_GLOBAL', 97) # ""
+name_op('DELETE_GLOBAL', 98) # ""
+def_op('DUP_TOPX', 99) # number of items to duplicate
+def_op('LOAD_CONST', 100) # Index in const list
+hasconst.append(100)
+name_op('LOAD_NAME', 101) # Index in name list
+def_op('BUILD_TUPLE', 102) # Number of tuple items
+def_op('BUILD_LIST', 103) # Number of list items
+def_op('BUILD_SET', 104) # Number of set items
+def_op('BUILD_MAP', 105) # Number of dict entries (upto 255)
+name_op('LOAD_ATTR', 106) # Index in name list
+def_op('COMPARE_OP', 107) # Comparison operator
+hascompare.append(107)
+name_op('IMPORT_NAME', 108) # Index in name list
+name_op('IMPORT_FROM', 109) # Index in name list
+jrel_op('JUMP_FORWARD', 110) # Number of bytes to skip
+jabs_op('JUMP_IF_FALSE_OR_POP', 111) # Target byte offset from beginning of code
+jabs_op('JUMP_IF_TRUE_OR_POP', 112) # ""
+jabs_op('JUMP_ABSOLUTE', 113) # ""
+jabs_op('POP_JUMP_IF_FALSE', 114) # ""
+jabs_op('POP_JUMP_IF_TRUE', 115) # ""
+
+name_op('LOAD_GLOBAL', 116) # Index in name list
+
+jabs_op('CONTINUE_LOOP', 119) # Target address
+jrel_op('SETUP_LOOP', 120) # Distance to target address
+jrel_op('SETUP_EXCEPT', 121) # ""
+jrel_op('SETUP_FINALLY', 122) # ""
+
+def_op('LOAD_FAST', 124) # Local variable number
+haslocal.append(124)
+def_op('STORE_FAST', 125) # Local variable number
+haslocal.append(125)
+def_op('DELETE_FAST', 126) # Local variable number
+haslocal.append(126)
+
+def_op('RAISE_VARARGS', 130) # Number of raise arguments (1, 2, or 3)
+def_op('CALL_FUNCTION', 131) # #args + (#kwargs << 8)
+def_op('MAKE_FUNCTION', 132) # Number of args with default values
+def_op('BUILD_SLICE', 133) # Number of items
+def_op('MAKE_CLOSURE', 134)
+def_op('LOAD_CLOSURE', 135)
+hasfree.append(135)
+def_op('LOAD_DEREF', 136)
+hasfree.append(136)
+def_op('STORE_DEREF', 137)
+hasfree.append(137)
+
+def_op('CALL_FUNCTION_VAR', 140) # #args + (#kwargs << 8)
+def_op('CALL_FUNCTION_KW', 141) # #args + (#kwargs << 8)
+def_op('CALL_FUNCTION_VAR_KW', 142) # #args + (#kwargs << 8)
+
+jrel_op('SETUP_WITH', 143)
+
+def_op('EXTENDED_ARG', 145)
+EXTENDED_ARG = 145
+def_op('SET_ADD', 146)
+def_op('MAP_ADD', 147)
+
+del def_op, name_op, jrel_op, jabs_op
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
index 0000000000..fee5faec1b
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/optparse.py
@@ -0,0 +1,1704 @@
+"""A powerful, extensible, and easy-to-use option parser.
+
+By Greg Ward <gward@python.net>
+
+Originally distributed as Optik.
+
+For support, use the optik-users@lists.sourceforge.net mailing list
+(http://lists.sourceforge.net/lists/listinfo/optik-users).
+
+Simple usage example:
+
+ from optparse import OptionParser
+
+ parser = OptionParser()
+ parser.add_option("-f", "--file", dest="filename",
+ help="write report to FILE", metavar="FILE")
+ parser.add_option("-q", "--quiet",
+ action="store_false", dest="verbose", default=True,
+ help="don't print status messages to stdout")
+
+ (options, args) = parser.parse_args()
+"""
+
+__version__ = "1.5.3"
+
+__all__ = ['Option',
+ 'make_option',
+ 'SUPPRESS_HELP',
+ 'SUPPRESS_USAGE',
+ 'Values',
+ 'OptionContainer',
+ 'OptionGroup',
+ 'OptionParser',
+ 'HelpFormatter',
+ 'IndentedHelpFormatter',
+ 'TitledHelpFormatter',
+ 'OptParseError',
+ 'OptionError',
+ 'OptionConflictError',
+ 'OptionValueError',
+ 'BadOptionError']
+
+__copyright__ = """
+Copyright (c) 2001-2006 Gregory P. Ward. All rights reserved.
+Copyright (c) 2002-2006 Python Software Foundation. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the author nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+"""
+
+import sys, os
+import types
+import textwrap
+
+def _repr(self):
+ return "<%s at 0x%x: %s>" % (self.__class__.__name__, id(self), self)
+
+
+# This file was generated from:
+# Id: option_parser.py 527 2006-07-23 15:21:30Z greg
+# Id: option.py 522 2006-06-11 16:22:03Z gward
+# Id: help.py 527 2006-07-23 15:21:30Z greg
+# Id: errors.py 509 2006-04-20 00:58:24Z gward
+
+try:
+ from gettext import gettext
+except ImportError:
+ def gettext(message):
+ return message
+_ = gettext
+
+
+class OptParseError (Exception):
+ def __init__(self, msg):
+ self.msg = msg
+
+ def __str__(self):
+ return self.msg
+
+
+class OptionError (OptParseError):
+ """
+ Raised if an Option instance is created with invalid or
+ inconsistent arguments.
+ """
+
+ def __init__(self, msg, option):
+ self.msg = msg
+ self.option_id = str(option)
+
+ def __str__(self):
+ if self.option_id:
+ return "option %s: %s" % (self.option_id, self.msg)
+ else:
+ return self.msg
+
+class OptionConflictError (OptionError):
+ """
+ Raised if conflicting options are added to an OptionParser.
+ """
+
+class OptionValueError (OptParseError):
+ """
+ Raised if an invalid option value is encountered on the command
+ line.
+ """
+
+class BadOptionError (OptParseError):
+ """
+ Raised if an invalid option is seen on the command line.
+ """
+ def __init__(self, opt_str):
+ self.opt_str = opt_str
+
+ def __str__(self):
+ return _("no such option: %s") % self.opt_str
+
+class AmbiguousOptionError (BadOptionError):
+ """
+ Raised if an ambiguous option is seen on the command line.
+ """
+ def __init__(self, opt_str, possibilities):
+ BadOptionError.__init__(self, opt_str)
+ self.possibilities = possibilities
+
+ def __str__(self):
+ return (_("ambiguous option: %s (%s?)")
+ % (self.opt_str, ", ".join(self.possibilities)))
+
+
+class HelpFormatter:
+
+ """
+ Abstract base class for formatting option help. OptionParser
+ instances should use one of the HelpFormatter subclasses for
+ formatting help; by default IndentedHelpFormatter is used.
+
+ Instance attributes:
+ parser : OptionParser
+ the controlling OptionParser instance
+ indent_increment : int
+ the number of columns to indent per nesting level
+ max_help_position : int
+ the maximum starting column for option help text
+ help_position : int
+ the calculated starting column for option help text;
+ initially the same as the maximum
+ width : int
+ total number of columns for output (pass None to constructor for
+ this value to be taken from the $COLUMNS environment variable)
+ level : int
+ current indentation level
+ current_indent : int
+ current indentation level (in columns)
+ help_width : int
+ number of columns available for option help text (calculated)
+ default_tag : str
+ text to replace with each option's default value, "%default"
+ by default. Set to false value to disable default value expansion.
+ option_strings : { Option : str }
+ maps Option instances to the snippet of help text explaining
+ the syntax of that option, e.g. "-h, --help" or
+ "-fFILE, --file=FILE"
+ _short_opt_fmt : str
+ format string controlling how short options with values are
+ printed in help text. Must be either "%s%s" ("-fFILE") or
+ "%s %s" ("-f FILE"), because those are the two syntaxes that
+ Optik supports.
+ _long_opt_fmt : str
+ similar but for long options; must be either "%s %s" ("--file FILE")
+ or "%s=%s" ("--file=FILE").
+ """
+
+ NO_DEFAULT_VALUE = "none"
+
+ def __init__(self,
+ indent_increment,
+ max_help_position,
+ width,
+ short_first):
+ self.parser = None
+ self.indent_increment = indent_increment
+ if width is None:
+ try:
+ width = int(os.environ['COLUMNS'])
+ except (KeyError, ValueError):
+ width = 80
+ width -= 2
+ self.width = width
+ self.help_position = self.max_help_position = \
+ min(max_help_position, max(width - 20, indent_increment * 2))
+ self.current_indent = 0
+ self.level = 0
+ self.help_width = None # computed later
+ self.short_first = short_first
+ self.default_tag = "%default"
+ self.option_strings = {}
+ self._short_opt_fmt = "%s %s"
+ self._long_opt_fmt = "%s=%s"
+
+ def set_parser(self, parser):
+ self.parser = parser
+
+ def set_short_opt_delimiter(self, delim):
+ if delim not in ("", " "):
+ raise ValueError(
+ "invalid metavar delimiter for short options: %r" % delim)
+ self._short_opt_fmt = "%s" + delim + "%s"
+
+ def set_long_opt_delimiter(self, delim):
+ if delim not in ("=", " "):
+ raise ValueError(
+ "invalid metavar delimiter for long options: %r" % delim)
+ self._long_opt_fmt = "%s" + delim + "%s"
+
+ def indent(self):
+ self.current_indent += self.indent_increment
+ self.level += 1
+
+ def dedent(self):
+ self.current_indent -= self.indent_increment
+ assert self.current_indent >= 0, "Indent decreased below 0."
+ self.level -= 1
+
+ def format_usage(self, usage):
+ raise NotImplementedError, "subclasses must implement"
+
+ def format_heading(self, heading):
+ raise NotImplementedError, "subclasses must implement"
+
+ def _format_text(self, text):
+ """
+ Format a paragraph of free-form text for inclusion in the
+ help output at the current indentation level.
+ """
+ text_width = max(self.width - self.current_indent, 11)
+ indent = " "*self.current_indent
+ return textwrap.fill(text,
+ text_width,
+ initial_indent=indent,
+ subsequent_indent=indent)
+
+ def format_description(self, description):
+ if description:
+ return self._format_text(description) + "\n"
+ else:
+ return ""
+
+ def format_epilog(self, epilog):
+ if epilog:
+ return "\n" + self._format_text(epilog) + "\n"
+ else:
+ return ""
+
+
+ def expand_default(self, option):
+ if self.parser is None or not self.default_tag:
+ return option.help
+
+ default_value = self.parser.defaults.get(option.dest)
+ if default_value is NO_DEFAULT or default_value is None:
+ default_value = self.NO_DEFAULT_VALUE
+
+ return option.help.replace(self.default_tag, str(default_value))
+
+ def format_option(self, option):
+ # The help for each option consists of two parts:
+ # * the opt strings and metavars
+ # eg. ("-x", or "-fFILENAME, --file=FILENAME")
+ # * the user-supplied help string
+ # eg. ("turn on expert mode", "read data from FILENAME")
+ #
+ # If possible, we write both of these on the same line:
+ # -x turn on expert mode
+ #
+ # But if the opt string list is too long, we put the help
+ # string on a second line, indented to the same column it would
+ # start in if it fit on the first line.
+ # -fFILENAME, --file=FILENAME
+ # read data from FILENAME
+ result = []
+ opts = self.option_strings[option]
+ opt_width = self.help_position - self.current_indent - 2
+ if len(opts) > opt_width:
+ opts = "%*s%s\n" % (self.current_indent, "", opts)
+ indent_first = self.help_position
+ else: # start help on same line as opts
+ opts = "%*s%-*s " % (self.current_indent, "", opt_width, opts)
+ indent_first = 0
+ result.append(opts)
+ if option.help:
+ help_text = self.expand_default(option)
+ help_lines = textwrap.wrap(help_text, self.help_width)
+ result.append("%*s%s\n" % (indent_first, "", help_lines[0]))
+ result.extend(["%*s%s\n" % (self.help_position, "", line)
+ for line in help_lines[1:]])
+ elif opts[-1] != "\n":
+ result.append("\n")
+ return "".join(result)
+
+ def store_option_strings(self, parser):
+ self.indent()
+ max_len = 0
+ for opt in parser.option_list:
+ strings = self.format_option_strings(opt)
+ self.option_strings[opt] = strings
+ max_len = max(max_len, len(strings) + self.current_indent)
+ self.indent()
+ for group in parser.option_groups:
+ for opt in group.option_list:
+ strings = self.format_option_strings(opt)
+ self.option_strings[opt] = strings
+ max_len = max(max_len, len(strings) + self.current_indent)
+ self.dedent()
+ self.dedent()
+ self.help_position = min(max_len + 2, self.max_help_position)
+ self.help_width = max(self.width - self.help_position, 11)
+
+ def format_option_strings(self, option):
+ """Return a comma-separated list of option strings & metavariables."""
+ if option.takes_value():
+ metavar = option.metavar or option.dest.upper()
+ short_opts = [self._short_opt_fmt % (sopt, metavar)
+ for sopt in option._short_opts]
+ long_opts = [self._long_opt_fmt % (lopt, metavar)
+ for lopt in option._long_opts]
+ else:
+ short_opts = option._short_opts
+ long_opts = option._long_opts
+
+ if self.short_first:
+ opts = short_opts + long_opts
+ else:
+ opts = long_opts + short_opts
+
+ return ", ".join(opts)
+
+class IndentedHelpFormatter (HelpFormatter):
+ """Format help with indented section bodies.
+ """
+
+ def __init__(self,
+ indent_increment=2,
+ max_help_position=24,
+ width=None,
+ short_first=1):
+ HelpFormatter.__init__(
+ self, indent_increment, max_help_position, width, short_first)
+
+ def format_usage(self, usage):
+ return _("Usage: %s\n") % usage
+
+ def format_heading(self, heading):
+ return "%*s%s:\n" % (self.current_indent, "", heading)
+
+
+class TitledHelpFormatter (HelpFormatter):
+ """Format help with underlined section headers.
+ """
+
+ def __init__(self,
+ indent_increment=0,
+ max_help_position=24,
+ width=None,
+ short_first=0):
+ HelpFormatter.__init__ (
+ self, indent_increment, max_help_position, width, short_first)
+
+ def format_usage(self, usage):
+ return "%s %s\n" % (self.format_heading(_("Usage")), usage)
+
+ def format_heading(self, heading):
+ return "%s\n%s\n" % (heading, "=-"[self.level] * len(heading))
+
+
+def _parse_num(val, type):
+ if val[:2].lower() == "0x": # hexadecimal
+ radix = 16
+ elif val[:2].lower() == "0b": # binary
+ radix = 2
+ val = val[2:] or "0" # have to remove "0b" prefix
+ elif val[:1] == "0": # octal
+ radix = 8
+ else: # decimal
+ radix = 10
+
+ return type(val, radix)
+
+def _parse_int(val):
+ return _parse_num(val, int)
+
+def _parse_long(val):
+ return _parse_num(val, long)
+
+_builtin_cvt = { "int" : (_parse_int, _("integer")),
+ "long" : (_parse_long, _("long integer")),
+ "float" : (float, _("floating-point")),
+ "complex" : (complex, _("complex")) }
+
+def check_builtin(option, opt, value):
+ (cvt, what) = _builtin_cvt[option.type]
+ try:
+ return cvt(value)
+ except ValueError:
+ raise OptionValueError(
+ _("option %s: invalid %s value: %r") % (opt, what, value))
+
+def check_choice(option, opt, value):
+ if value in option.choices:
+ return value
+ else:
+ choices = ", ".join(map(repr, option.choices))
+ raise OptionValueError(
+ _("option %s: invalid choice: %r (choose from %s)")
+ % (opt, value, choices))
+
+# Not supplying a default is different from a default of None,
+# so we need an explicit "not supplied" value.
+NO_DEFAULT = ("NO", "DEFAULT")
+
+
+class Option:
+ """
+ Instance attributes:
+ _short_opts : [string]
+ _long_opts : [string]
+
+ action : string
+ type : string
+ dest : string
+ default : any
+ nargs : int
+ const : any
+ choices : [string]
+ callback : function
+ callback_args : (any*)
+ callback_kwargs : { string : any }
+ help : string
+ metavar : string
+ """
+
+ # The list of instance attributes that may be set through
+ # keyword args to the constructor.
+ ATTRS = ['action',
+ 'type',
+ 'dest',
+ 'default',
+ 'nargs',
+ 'const',
+ 'choices',
+ 'callback',
+ 'callback_args',
+ 'callback_kwargs',
+ 'help',
+ 'metavar']
+
+ # The set of actions allowed by option parsers. Explicitly listed
+ # here so the constructor can validate its arguments.
+ ACTIONS = ("store",
+ "store_const",
+ "store_true",
+ "store_false",
+ "append",
+ "append_const",
+ "count",
+ "callback",
+ "help",
+ "version")
+
+ # The set of actions that involve storing a value somewhere;
+ # also listed just for constructor argument validation. (If
+ # the action is one of these, there must be a destination.)
+ STORE_ACTIONS = ("store",
+ "store_const",
+ "store_true",
+ "store_false",
+ "append",
+ "append_const",
+ "count")
+
+ # The set of actions for which it makes sense to supply a value
+ # type, ie. which may consume an argument from the command line.
+ TYPED_ACTIONS = ("store",
+ "append",
+ "callback")
+
+ # The set of actions which *require* a value type, ie. that
+ # always consume an argument from the command line.
+ ALWAYS_TYPED_ACTIONS = ("store",
+ "append")
+
+ # The set of actions which take a 'const' attribute.
+ CONST_ACTIONS = ("store_const",
+ "append_const")
+
+ # The set of known types for option parsers. Again, listed here for
+ # constructor argument validation.
+ TYPES = ("string", "int", "long", "float", "complex", "choice")
+
+ # Dictionary of argument checking functions, which convert and
+ # validate option arguments according to the option type.
+ #
+ # Signature of checking functions is:
+ # check(option : Option, opt : string, value : string) -> any
+ # where
+ # option is the Option instance calling the checker
+ # opt is the actual option seen on the command-line
+ # (eg. "-a", "--file")
+ # value is the option argument seen on the command-line
+ #
+ # The return value should be in the appropriate Python type
+ # for option.type -- eg. an integer if option.type == "int".
+ #
+ # If no checker is defined for a type, arguments will be
+ # unchecked and remain strings.
+ TYPE_CHECKER = { "int" : check_builtin,
+ "long" : check_builtin,
+ "float" : check_builtin,
+ "complex": check_builtin,
+ "choice" : check_choice,
+ }
+
+
+ # CHECK_METHODS is a list of unbound method objects; they are called
+ # by the constructor, in order, after all attributes are
+ # initialized. The list is created and filled in later, after all
+ # the methods are actually defined. (I just put it here because I
+ # like to define and document all class attributes in the same
+ # place.) Subclasses that add another _check_*() method should
+ # define their own CHECK_METHODS list that adds their check method
+ # to those from this class.
+ CHECK_METHODS = None
+
+
+ # -- Constructor/initialization methods ----------------------------
+
+ def __init__(self, *opts, **attrs):
+ # Set _short_opts, _long_opts attrs from 'opts' tuple.
+ # Have to be set now, in case no option strings are supplied.
+ self._short_opts = []
+ self._long_opts = []
+ opts = self._check_opt_strings(opts)
+ self._set_opt_strings(opts)
+
+ # Set all other attrs (action, type, etc.) from 'attrs' dict
+ self._set_attrs(attrs)
+
+ # Check all the attributes we just set. There are lots of
+ # complicated interdependencies, but luckily they can be farmed
+ # out to the _check_*() methods listed in CHECK_METHODS -- which
+ # could be handy for subclasses! The one thing these all share
+ # is that they raise OptionError if they discover a problem.
+ for checker in self.CHECK_METHODS:
+ checker(self)
+
+ def _check_opt_strings(self, opts):
+ # Filter out None because early versions of Optik had exactly
+ # one short option and one long option, either of which
+ # could be None.
+ opts = filter(None, opts)
+ if not opts:
+ raise TypeError("at least one option string must be supplied")
+ return opts
+
+ def _set_opt_strings(self, opts):
+ for opt in opts:
+ if len(opt) < 2:
+ raise OptionError(
+ "invalid option string %r: "
+ "must be at least two characters long" % opt, self)
+ elif len(opt) == 2:
+ if not (opt[0] == "-" and opt[1] != "-"):
+ raise OptionError(
+ "invalid short option string %r: "
+ "must be of the form -x, (x any non-dash char)" % opt,
+ self)
+ self._short_opts.append(opt)
+ else:
+ if not (opt[0:2] == "--" and opt[2] != "-"):
+ raise OptionError(
+ "invalid long option string %r: "
+ "must start with --, followed by non-dash" % opt,
+ self)
+ self._long_opts.append(opt)
+
+ def _set_attrs(self, attrs):
+ for attr in self.ATTRS:
+ if attr in attrs:
+ setattr(self, attr, attrs[attr])
+ del attrs[attr]
+ else:
+ if attr == 'default':
+ setattr(self, attr, NO_DEFAULT)
+ else:
+ setattr(self, attr, None)
+ if attrs:
+ attrs = attrs.keys()
+ attrs.sort()
+ raise OptionError(
+ "invalid keyword arguments: %s" % ", ".join(attrs),
+ self)
+
+
+ # -- Constructor validation methods --------------------------------
+
+ def _check_action(self):
+ if self.action is None:
+ self.action = "store"
+ elif self.action not in self.ACTIONS:
+ raise OptionError("invalid action: %r" % self.action, self)
+
+ def _check_type(self):
+ if self.type is None:
+ if self.action in self.ALWAYS_TYPED_ACTIONS:
+ if self.choices is not None:
+ # The "choices" attribute implies "choice" type.
+ self.type = "choice"
+ else:
+ # No type given? "string" is the most sensible default.
+ self.type = "string"
+ else:
+ # Allow type objects or builtin type conversion functions
+ # (int, str, etc.) as an alternative to their names. (The
+ # complicated check of __builtin__ is only necessary for
+ # Python 2.1 and earlier, and is short-circuited by the
+ # first check on modern Pythons.)
+ import __builtin__
+ if ( type(self.type) is types.TypeType or
+ (hasattr(self.type, "__name__") and
+ getattr(__builtin__, self.type.__name__, None) is self.type) ):
+ self.type = self.type.__name__
+
+ if self.type == "str":
+ self.type = "string"
+
+ if self.type not in self.TYPES:
+ raise OptionError("invalid option type: %r" % self.type, self)
+ if self.action not in self.TYPED_ACTIONS:
+ raise OptionError(
+ "must not supply a type for action %r" % self.action, self)
+
+ def _check_choice(self):
+ if self.type == "choice":
+ if self.choices is None:
+ raise OptionError(
+ "must supply a list of choices for type 'choice'", self)
+ elif type(self.choices) not in (types.TupleType, types.ListType):
+ raise OptionError(
+ "choices must be a list of strings ('%s' supplied)"
+ % str(type(self.choices)).split("'")[1], self)
+ elif self.choices is not None:
+ raise OptionError(
+ "must not supply choices for type %r" % self.type, self)
+
+ def _check_dest(self):
+ # No destination given, and we need one for this action. The
+ # self.type check is for callbacks that take a value.
+ takes_value = (self.action in self.STORE_ACTIONS or
+ self.type is not None)
+ if self.dest is None and takes_value:
+
+ # Glean a destination from the first long option string,
+ # or from the first short option string if no long options.
+ if self._long_opts:
+ # eg. "--foo-bar" -> "foo_bar"
+ self.dest = self._long_opts[0][2:].replace('-', '_')
+ else:
+ self.dest = self._short_opts[0][1]
+
+ def _check_const(self):
+ if self.action not in self.CONST_ACTIONS and self.const is not None:
+ raise OptionError(
+ "'const' must not be supplied for action %r" % self.action,
+ self)
+
+ def _check_nargs(self):
+ if self.action in self.TYPED_ACTIONS:
+ if self.nargs is None:
+ self.nargs = 1
+ elif self.nargs is not None:
+ raise OptionError(
+ "'nargs' must not be supplied for action %r" % self.action,
+ self)
+
+ def _check_callback(self):
+ if self.action == "callback":
+ if not hasattr(self.callback, '__call__'):
+ raise OptionError(
+ "callback not callable: %r" % self.callback, self)
+ if (self.callback_args is not None and
+ type(self.callback_args) is not types.TupleType):
+ raise OptionError(
+ "callback_args, if supplied, must be a tuple: not %r"
+ % self.callback_args, self)
+ if (self.callback_kwargs is not None and
+ type(self.callback_kwargs) is not types.DictType):
+ raise OptionError(
+ "callback_kwargs, if supplied, must be a dict: not %r"
+ % self.callback_kwargs, self)
+ else:
+ if self.callback is not None:
+ raise OptionError(
+ "callback supplied (%r) for non-callback option"
+ % self.callback, self)
+ if self.callback_args is not None:
+ raise OptionError(
+ "callback_args supplied for non-callback option", self)
+ if self.callback_kwargs is not None:
+ raise OptionError(
+ "callback_kwargs supplied for non-callback option", self)
+
+
+ CHECK_METHODS = [_check_action,
+ _check_type,
+ _check_choice,
+ _check_dest,
+ _check_const,
+ _check_nargs,
+ _check_callback]
+
+
+ # -- Miscellaneous methods -----------------------------------------
+
+ def __str__(self):
+ return "/".join(self._short_opts + self._long_opts)
+
+ __repr__ = _repr
+
+ def takes_value(self):
+ return self.type is not None
+
+ def get_opt_string(self):
+ if self._long_opts:
+ return self._long_opts[0]
+ else:
+ return self._short_opts[0]
+
+
+ # -- Processing methods --------------------------------------------
+
+ def check_value(self, opt, value):
+ checker = self.TYPE_CHECKER.get(self.type)
+ if checker is None:
+ return value
+ else:
+ return checker(self, opt, value)
+
+ def convert_value(self, opt, value):
+ if value is not None:
+ if self.nargs == 1:
+ return self.check_value(opt, value)
+ else:
+ return tuple([self.check_value(opt, v) for v in value])
+
+ def process(self, opt, value, values, parser):
+
+ # First, convert the value(s) to the right type. Howl if any
+ # value(s) are bogus.
+ value = self.convert_value(opt, value)
+
+ # And then take whatever action is expected of us.
+ # This is a separate method to make life easier for
+ # subclasses to add new actions.
+ return self.take_action(
+ self.action, self.dest, opt, value, values, parser)
+
+ def take_action(self, action, dest, opt, value, values, parser):
+ if action == "store":
+ setattr(values, dest, value)
+ elif action == "store_const":
+ setattr(values, dest, self.const)
+ elif action == "store_true":
+ setattr(values, dest, True)
+ elif action == "store_false":
+ setattr(values, dest, False)
+ elif action == "append":
+ values.ensure_value(dest, []).append(value)
+ elif action == "append_const":
+ values.ensure_value(dest, []).append(self.const)
+ elif action == "count":
+ setattr(values, dest, values.ensure_value(dest, 0) + 1)
+ elif action == "callback":
+ args = self.callback_args or ()
+ kwargs = self.callback_kwargs or {}
+ self.callback(self, opt, value, parser, *args, **kwargs)
+ elif action == "help":
+ parser.print_help()
+ parser.exit()
+ elif action == "version":
+ parser.print_version()
+ parser.exit()
+ else:
+ raise ValueError("unknown action %r" % self.action)
+
+ return 1
+
+# class Option
+
+
+SUPPRESS_HELP = "SUPPRESS"+"HELP"
+SUPPRESS_USAGE = "SUPPRESS"+"USAGE"
+
+try:
+ basestring
+except NameError:
+ def isbasestring(x):
+ return isinstance(x, (types.StringType, types.UnicodeType))
+else:
+ def isbasestring(x):
+ return isinstance(x, basestring)
+
+class Values:
+
+ def __init__(self, defaults=None):
+ if defaults:
+ for (attr, val) in defaults.items():
+ setattr(self, attr, val)
+
+ def __str__(self):
+ return str(self.__dict__)
+
+ __repr__ = _repr
+
+ def __cmp__(self, other):
+ if isinstance(other, Values):
+ return cmp(self.__dict__, other.__dict__)
+ elif isinstance(other, types.DictType):
+ return cmp(self.__dict__, other)
+ else:
+ return -1
+
+ def _update_careful(self, dict):
+ """
+ Update the option values from an arbitrary dictionary, but only
+ use keys from dict that already have a corresponding attribute
+ in self. Any keys in dict without a corresponding attribute
+ are silently ignored.
+ """
+ for attr in dir(self):
+ if attr in dict:
+ dval = dict[attr]
+ if dval is not None:
+ setattr(self, attr, dval)
+
+ def _update_loose(self, dict):
+ """
+ Update the option values from an arbitrary dictionary,
+ using all keys from the dictionary regardless of whether
+ they have a corresponding attribute in self or not.
+ """
+ self.__dict__.update(dict)
+
+ def _update(self, dict, mode):
+ if mode == "careful":
+ self._update_careful(dict)
+ elif mode == "loose":
+ self._update_loose(dict)
+ else:
+ raise ValueError, "invalid update mode: %r" % mode
+
+ def read_module(self, modname, mode="careful"):
+ __import__(modname)
+ mod = sys.modules[modname]
+ self._update(vars(mod), mode)
+
+ def read_file(self, filename, mode="careful"):
+ vars = {}
+ execfile(filename, vars)
+ self._update(vars, mode)
+
+ def ensure_value(self, attr, value):
+ if not hasattr(self, attr) or getattr(self, attr) is None:
+ setattr(self, attr, value)
+ return getattr(self, attr)
+
+
+class OptionContainer:
+
+ """
+ Abstract base class.
+
+ Class attributes:
+ standard_option_list : [Option]
+ list of standard options that will be accepted by all instances
+ of this parser class (intended to be overridden by subclasses).
+
+ Instance attributes:
+ option_list : [Option]
+ the list of Option objects contained by this OptionContainer
+ _short_opt : { string : Option }
+ dictionary mapping short option strings, eg. "-f" or "-X",
+ to the Option instances that implement them. If an Option
+ has multiple short option strings, it will appears in this
+ dictionary multiple times. [1]
+ _long_opt : { string : Option }
+ dictionary mapping long option strings, eg. "--file" or
+ "--exclude", to the Option instances that implement them.
+ Again, a given Option can occur multiple times in this
+ dictionary. [1]
+ defaults : { string : any }
+ dictionary mapping option destination names to default
+ values for each destination [1]
+
+ [1] These mappings are common to (shared by) all components of the
+ controlling OptionParser, where they are initially created.
+
+ """
+
+ def __init__(self, option_class, conflict_handler, description):
+ # Initialize the option list and related data structures.
+ # This method must be provided by subclasses, and it must
+ # initialize at least the following instance attributes:
+ # option_list, _short_opt, _long_opt, defaults.
+ self._create_option_list()
+
+ self.option_class = option_class
+ self.set_conflict_handler(conflict_handler)
+ self.set_description(description)
+
+ def _create_option_mappings(self):
+ # For use by OptionParser constructor -- create the master
+ # option mappings used by this OptionParser and all
+ # OptionGroups that it owns.
+ self._short_opt = {} # single letter -> Option instance
+ self._long_opt = {} # long option -> Option instance
+ self.defaults = {} # maps option dest -> default value
+
+
+ def _share_option_mappings(self, parser):
+ # For use by OptionGroup constructor -- use shared option
+ # mappings from the OptionParser that owns this OptionGroup.
+ self._short_opt = parser._short_opt
+ self._long_opt = parser._long_opt
+ self.defaults = parser.defaults
+
+ def set_conflict_handler(self, handler):
+ if handler not in ("error", "resolve"):
+ raise ValueError, "invalid conflict_resolution value %r" % handler
+ self.conflict_handler = handler
+
+ def set_description(self, description):
+ self.description = description
+
+ def get_description(self):
+ return self.description
+
+
+ def destroy(self):
+ """see OptionParser.destroy()."""
+ del self._short_opt
+ del self._long_opt
+ del self.defaults
+
+
+ # -- Option-adding methods -----------------------------------------
+
+ def _check_conflict(self, option):
+ conflict_opts = []
+ for opt in option._short_opts:
+ if opt in self._short_opt:
+ conflict_opts.append((opt, self._short_opt[opt]))
+ for opt in option._long_opts:
+ if opt in self._long_opt:
+ conflict_opts.append((opt, self._long_opt[opt]))
+
+ if conflict_opts:
+ handler = self.conflict_handler
+ if handler == "error":
+ raise OptionConflictError(
+ "conflicting option string(s): %s"
+ % ", ".join([co[0] for co in conflict_opts]),
+ option)
+ elif handler == "resolve":
+ for (opt, c_option) in conflict_opts:
+ if opt.startswith("--"):
+ c_option._long_opts.remove(opt)
+ del self._long_opt[opt]
+ else:
+ c_option._short_opts.remove(opt)
+ del self._short_opt[opt]
+ if not (c_option._short_opts or c_option._long_opts):
+ c_option.container.option_list.remove(c_option)
+
+ def add_option(self, *args, **kwargs):
+ """add_option(Option)
+ add_option(opt_str, ..., kwarg=val, ...)
+ """
+ if type(args[0]) in types.StringTypes:
+ option = self.option_class(*args, **kwargs)
+ elif len(args) == 1 and not kwargs:
+ option = args[0]
+ if not isinstance(option, Option):
+ raise TypeError, "not an Option instance: %r" % option
+ else:
+ raise TypeError, "invalid arguments"
+
+ self._check_conflict(option)
+
+ self.option_list.append(option)
+ option.container = self
+ for opt in option._short_opts:
+ self._short_opt[opt] = option
+ for opt in option._long_opts:
+ self._long_opt[opt] = option
+
+ if option.dest is not None: # option has a dest, we need a default
+ if option.default is not NO_DEFAULT:
+ self.defaults[option.dest] = option.default
+ elif option.dest not in self.defaults:
+ self.defaults[option.dest] = None
+
+ return option
+
+ def add_options(self, option_list):
+ for option in option_list:
+ self.add_option(option)
+
+ # -- Option query/removal methods ----------------------------------
+
+ def get_option(self, opt_str):
+ return (self._short_opt.get(opt_str) or
+ self._long_opt.get(opt_str))
+
+ def has_option(self, opt_str):
+ return (opt_str in self._short_opt or
+ opt_str in self._long_opt)
+
+ def remove_option(self, opt_str):
+ option = self._short_opt.get(opt_str)
+ if option is None:
+ option = self._long_opt.get(opt_str)
+ if option is None:
+ raise ValueError("no such option %r" % opt_str)
+
+ for opt in option._short_opts:
+ del self._short_opt[opt]
+ for opt in option._long_opts:
+ del self._long_opt[opt]
+ option.container.option_list.remove(option)
+
+
+ # -- Help-formatting methods ---------------------------------------
+
+ def format_option_help(self, formatter):
+ if not self.option_list:
+ return ""
+ result = []
+ for option in self.option_list:
+ if not option.help is SUPPRESS_HELP:
+ result.append(formatter.format_option(option))
+ return "".join(result)
+
+ def format_description(self, formatter):
+ return formatter.format_description(self.get_description())
+
+ def format_help(self, formatter):
+ result = []
+ if self.description:
+ result.append(self.format_description(formatter))
+ if self.option_list:
+ result.append(self.format_option_help(formatter))
+ return "\n".join(result)
+
+
+class OptionGroup (OptionContainer):
+
+ def __init__(self, parser, title, description=None):
+ self.parser = parser
+ OptionContainer.__init__(
+ self, parser.option_class, parser.conflict_handler, description)
+ self.title = title
+
+ def _create_option_list(self):
+ self.option_list = []
+ self._share_option_mappings(self.parser)
+
+ def set_title(self, title):
+ self.title = title
+
+ def destroy(self):
+ """see OptionParser.destroy()."""
+ OptionContainer.destroy(self)
+ del self.option_list
+
+ # -- Help-formatting methods ---------------------------------------
+
+ def format_help(self, formatter):
+ result = formatter.format_heading(self.title)
+ formatter.indent()
+ result += OptionContainer.format_help(self, formatter)
+ formatter.dedent()
+ return result
+
+
+class OptionParser (OptionContainer):
+
+ """
+ Class attributes:
+ standard_option_list : [Option]
+ list of standard options that will be accepted by all instances
+ of this parser class (intended to be overridden by subclasses).
+
+ Instance attributes:
+ usage : string
+ a usage string for your program. Before it is displayed
+ to the user, "%prog" will be expanded to the name of
+ your program (self.prog or os.path.basename(sys.argv[0])).
+ prog : string
+ the name of the current program (to override
+ os.path.basename(sys.argv[0])).
+ description : string
+ A paragraph of text giving a brief overview of your program.
+ optparse reformats this paragraph to fit the current terminal
+ width and prints it when the user requests help (after usage,
+ but before the list of options).
+ epilog : string
+ paragraph of help text to print after option help
+
+ option_groups : [OptionGroup]
+ list of option groups in this parser (option groups are
+ irrelevant for parsing the command-line, but very useful
+ for generating help)
+
+ allow_interspersed_args : bool = true
+ if true, positional arguments may be interspersed with options.
+ Assuming -a and -b each take a single argument, the command-line
+ -ablah foo bar -bboo baz
+ will be interpreted the same as
+ -ablah -bboo -- foo bar baz
+ If this flag were false, that command line would be interpreted as
+ -ablah -- foo bar -bboo baz
+ -- ie. we stop processing options as soon as we see the first
+ non-option argument. (This is the tradition followed by
+ Python's getopt module, Perl's Getopt::Std, and other argument-
+ parsing libraries, but it is generally annoying to users.)
+
+ process_default_values : bool = true
+ if true, option default values are processed similarly to option
+ values from the command line: that is, they are passed to the
+ type-checking function for the option's type (as long as the
+ default value is a string). (This really only matters if you
+ have defined custom types; see SF bug #955889.) Set it to false
+ to restore the behaviour of Optik 1.4.1 and earlier.
+
+ rargs : [string]
+ the argument list currently being parsed. Only set when
+ parse_args() is active, and continually trimmed down as
+ we consume arguments. Mainly there for the benefit of
+ callback options.
+ largs : [string]
+ the list of leftover arguments that we have skipped while
+ parsing options. If allow_interspersed_args is false, this
+ list is always empty.
+ values : Values
+ the set of option values currently being accumulated. Only
+ set when parse_args() is active. Also mainly for callbacks.
+
+ Because of the 'rargs', 'largs', and 'values' attributes,
+ OptionParser is not thread-safe. If, for some perverse reason, you
+ need to parse command-line arguments simultaneously in different
+ threads, use different OptionParser instances.
+
+ """
+
+ standard_option_list = []
+
+ def __init__(self,
+ usage=None,
+ option_list=None,
+ option_class=Option,
+ version=None,
+ conflict_handler="error",
+ description=None,
+ formatter=None,
+ add_help_option=True,
+ prog=None,
+ epilog=None):
+ OptionContainer.__init__(
+ self, option_class, conflict_handler, description)
+ self.set_usage(usage)
+ self.prog = prog
+ self.version = version
+ self.allow_interspersed_args = True
+ self.process_default_values = True
+ if formatter is None:
+ formatter = IndentedHelpFormatter()
+ self.formatter = formatter
+ self.formatter.set_parser(self)
+ self.epilog = epilog
+
+ # Populate the option list; initial sources are the
+ # standard_option_list class attribute, the 'option_list'
+ # argument, and (if applicable) the _add_version_option() and
+ # _add_help_option() methods.
+ self._populate_option_list(option_list,
+ add_help=add_help_option)
+
+ self._init_parsing_state()
+
+
+ def destroy(self):
+ """
+ Declare that you are done with this OptionParser. This cleans up
+ reference cycles so the OptionParser (and all objects referenced by
+ it) can be garbage-collected promptly. After calling destroy(), the
+ OptionParser is unusable.
+ """
+ OptionContainer.destroy(self)
+ for group in self.option_groups:
+ group.destroy()
+ del self.option_list
+ del self.option_groups
+ del self.formatter
+
+
+ # -- Private methods -----------------------------------------------
+ # (used by our or OptionContainer's constructor)
+
+ def _create_option_list(self):
+ self.option_list = []
+ self.option_groups = []
+ self._create_option_mappings()
+
+ def _add_help_option(self):
+ self.add_option("-h", "--help",
+ action="help",
+ help=_("show this help message and exit"))
+
+ def _add_version_option(self):
+ self.add_option("--version",
+ action="version",
+ help=_("show program's version number and exit"))
+
+ def _populate_option_list(self, option_list, add_help=True):
+ if self.standard_option_list:
+ self.add_options(self.standard_option_list)
+ if option_list:
+ self.add_options(option_list)
+ if self.version:
+ self._add_version_option()
+ if add_help:
+ self._add_help_option()
+
+ def _init_parsing_state(self):
+ # These are set in parse_args() for the convenience of callbacks.
+ self.rargs = None
+ self.largs = None
+ self.values = None
+
+
+ # -- Simple modifier methods ---------------------------------------
+
+ def set_usage(self, usage):
+ if usage is None:
+ self.usage = _("%prog [options]")
+ elif usage is SUPPRESS_USAGE:
+ self.usage = None
+ # For backwards compatibility with Optik 1.3 and earlier.
+ elif usage.lower().startswith("usage: "):
+ self.usage = usage[7:]
+ else:
+ self.usage = usage
+
+ def enable_interspersed_args(self):
+ """Set parsing to not stop on the first non-option, allowing
+ interspersing switches with command arguments. This is the
+ default behavior. See also disable_interspersed_args() and the
+ class documentation description of the attribute
+ allow_interspersed_args."""
+ self.allow_interspersed_args = True
+
+ def disable_interspersed_args(self):
+ """Set parsing to stop on the first non-option. Use this if
+ you have a command processor which runs another command that
+ has options of its own and you want to make sure these options
+ don't get confused.
+ """
+ self.allow_interspersed_args = False
+
+ def set_process_default_values(self, process):
+ self.process_default_values = process
+
+ def set_default(self, dest, value):
+ self.defaults[dest] = value
+
+ def set_defaults(self, **kwargs):
+ self.defaults.update(kwargs)
+
+ def _get_all_options(self):
+ options = self.option_list[:]
+ for group in self.option_groups:
+ options.extend(group.option_list)
+ return options
+
+ def get_default_values(self):
+ if not self.process_default_values:
+ # Old, pre-Optik 1.5 behaviour.
+ return Values(self.defaults)
+
+ defaults = self.defaults.copy()
+ for option in self._get_all_options():
+ default = defaults.get(option.dest)
+ if isbasestring(default):
+ opt_str = option.get_opt_string()
+ defaults[option.dest] = option.check_value(opt_str, default)
+
+ return Values(defaults)
+
+
+ # -- OptionGroup methods -------------------------------------------
+
+ def add_option_group(self, *args, **kwargs):
+ # XXX lots of overlap with OptionContainer.add_option()
+ if type(args[0]) is types.StringType:
+ group = OptionGroup(self, *args, **kwargs)
+ elif len(args) == 1 and not kwargs:
+ group = args[0]
+ if not isinstance(group, OptionGroup):
+ raise TypeError, "not an OptionGroup instance: %r" % group
+ if group.parser is not self:
+ raise ValueError, "invalid OptionGroup (wrong parser)"
+ else:
+ raise TypeError, "invalid arguments"
+
+ self.option_groups.append(group)
+ return group
+
+ def get_option_group(self, opt_str):
+ option = (self._short_opt.get(opt_str) or
+ self._long_opt.get(opt_str))
+ if option and option.container is not self:
+ return option.container
+ return None
+
+
+ # -- Option-parsing methods ----------------------------------------
+
+ def _get_args(self, args):
+ if args is None:
+ return sys.argv[1:]
+ else:
+ return args[:] # don't modify caller's list
+
+ def parse_args(self, args=None, values=None):
+ """
+ parse_args(args : [string] = sys.argv[1:],
+ values : Values = None)
+ -> (values : Values, args : [string])
+
+ Parse the command-line options found in 'args' (default:
+ sys.argv[1:]). Any errors result in a call to 'error()', which
+ by default prints the usage message to stderr and calls
+ sys.exit() with an error message. On success returns a pair
+ (values, args) where 'values' is an Values instance (with all
+ your option values) and 'args' is the list of arguments left
+ over after parsing options.
+ """
+ rargs = self._get_args(args)
+ if values is None:
+ values = self.get_default_values()
+
+ # Store the halves of the argument list as attributes for the
+ # convenience of callbacks:
+ # rargs
+ # the rest of the command-line (the "r" stands for
+ # "remaining" or "right-hand")
+ # largs
+ # the leftover arguments -- ie. what's left after removing
+ # options and their arguments (the "l" stands for "leftover"
+ # or "left-hand")
+ self.rargs = rargs
+ self.largs = largs = []
+ self.values = values
+
+ try:
+ stop = self._process_args(largs, rargs, values)
+ except (BadOptionError, OptionValueError), err:
+ self.error(str(err))
+
+ args = largs + rargs
+ return self.check_values(values, args)
+
+ def check_values(self, values, args):
+ """
+ check_values(values : Values, args : [string])
+ -> (values : Values, args : [string])
+
+ Check that the supplied option values and leftover arguments are
+ valid. Returns the option values and leftover arguments
+ (possibly adjusted, possibly completely new -- whatever you
+ like). Default implementation just returns the passed-in
+ values; subclasses may override as desired.
+ """
+ return (values, args)
+
+ def _process_args(self, largs, rargs, values):
+ """_process_args(largs : [string],
+ rargs : [string],
+ values : Values)
+
+ Process command-line arguments and populate 'values', consuming
+ options and arguments from 'rargs'. If 'allow_interspersed_args' is
+ false, stop at the first non-option argument. If true, accumulate any
+ interspersed non-option arguments in 'largs'.
+ """
+ while rargs:
+ arg = rargs[0]
+ # We handle bare "--" explicitly, and bare "-" is handled by the
+ # standard arg handler since the short arg case ensures that the
+ # len of the opt string is greater than 1.
+ if arg == "--":
+ del rargs[0]
+ return
+ elif arg[0:2] == "--":
+ # process a single long option (possibly with value(s))
+ self._process_long_opt(rargs, values)
+ elif arg[:1] == "-" and len(arg) > 1:
+ # process a cluster of short options (possibly with
+ # value(s) for the last one only)
+ self._process_short_opts(rargs, values)
+ elif self.allow_interspersed_args:
+ largs.append(arg)
+ del rargs[0]
+ else:
+ return # stop now, leave this arg in rargs
+
+ # Say this is the original argument list:
+ # [arg0, arg1, ..., arg(i-1), arg(i), arg(i+1), ..., arg(N-1)]
+ # ^
+ # (we are about to process arg(i)).
+ #
+ # Then rargs is [arg(i), ..., arg(N-1)] and largs is a *subset* of
+ # [arg0, ..., arg(i-1)] (any options and their arguments will have
+ # been removed from largs).
+ #
+ # The while loop will usually consume 1 or more arguments per pass.
+ # If it consumes 1 (eg. arg is an option that takes no arguments),
+ # then after _process_arg() is done the situation is:
+ #
+ # largs = subset of [arg0, ..., arg(i)]
+ # rargs = [arg(i+1), ..., arg(N-1)]
+ #
+ # If allow_interspersed_args is false, largs will always be
+ # *empty* -- still a subset of [arg0, ..., arg(i-1)], but
+ # not a very interesting subset!
+
+ def _match_long_opt(self, opt):
+ """_match_long_opt(opt : string) -> string
+
+ Determine which long option string 'opt' matches, ie. which one
+ it is an unambiguous abbreviation for. Raises BadOptionError if
+ 'opt' doesn't unambiguously match any long option string.
+ """
+ return _match_abbrev(opt, self._long_opt)
+
+ def _process_long_opt(self, rargs, values):
+ arg = rargs.pop(0)
+
+ # Value explicitly attached to arg? Pretend it's the next
+ # argument.
+ if "=" in arg:
+ (opt, next_arg) = arg.split("=", 1)
+ rargs.insert(0, next_arg)
+ had_explicit_value = True
+ else:
+ opt = arg
+ had_explicit_value = False
+
+ opt = self._match_long_opt(opt)
+ option = self._long_opt[opt]
+ if option.takes_value():
+ nargs = option.nargs
+ if len(rargs) < nargs:
+ if nargs == 1:
+ self.error(_("%s option requires an argument") % opt)
+ else:
+ self.error(_("%s option requires %d arguments")
+ % (opt, nargs))
+ elif nargs == 1:
+ value = rargs.pop(0)
+ else:
+ value = tuple(rargs[0:nargs])
+ del rargs[0:nargs]
+
+ elif had_explicit_value:
+ self.error(_("%s option does not take a value") % opt)
+
+ else:
+ value = None
+
+ option.process(opt, value, values, self)
+
+ def _process_short_opts(self, rargs, values):
+ arg = rargs.pop(0)
+ stop = False
+ i = 1
+ for ch in arg[1:]:
+ opt = "-" + ch
+ option = self._short_opt.get(opt)
+ i += 1 # we have consumed a character
+
+ if not option:
+ raise BadOptionError(opt)
+ if option.takes_value():
+ # Any characters left in arg? Pretend they're the
+ # next arg, and stop consuming characters of arg.
+ if i < len(arg):
+ rargs.insert(0, arg[i:])
+ stop = True
+
+ nargs = option.nargs
+ if len(rargs) < nargs:
+ if nargs == 1:
+ self.error(_("%s option requires an argument") % opt)
+ else:
+ self.error(_("%s option requires %d arguments")
+ % (opt, nargs))
+ elif nargs == 1:
+ value = rargs.pop(0)
+ else:
+ value = tuple(rargs[0:nargs])
+ del rargs[0:nargs]
+
+ else: # option doesn't take a value
+ value = None
+
+ option.process(opt, value, values, self)
+
+ if stop:
+ break
+
+
+ # -- Feedback methods ----------------------------------------------
+
+ def get_prog_name(self):
+ if self.prog is None:
+ return os.path.basename(sys.argv[0])
+ else:
+ return self.prog
+
+ def expand_prog_name(self, s):
+ return s.replace("%prog", self.get_prog_name())
+
+ def get_description(self):
+ return self.expand_prog_name(self.description)
+
+ def exit(self, status=0, msg=None):
+ if msg:
+ sys.stderr.write(msg)
+ sys.exit(status)
+
+ def error(self, msg):
+ """error(msg : string)
+
+ Print a usage message incorporating 'msg' to stderr and exit.
+ If you override this in a subclass, it should not return -- it
+ should either exit or raise an exception.
+ """
+ self.print_usage(sys.stderr)
+ self.exit(2, "%s: error: %s\n" % (self.get_prog_name(), msg))
+
+ def get_usage(self):
+ if self.usage:
+ return self.formatter.format_usage(
+ self.expand_prog_name(self.usage))
+ else:
+ return ""
+
+ def print_usage(self, file=None):
+ """print_usage(file : file = stdout)
+
+ Print the usage message for the current program (self.usage) to
+ 'file' (default stdout). Any occurrence of the string "%prog" in
+ self.usage is replaced with the name of the current program
+ (basename of sys.argv[0]). Does nothing if self.usage is empty
+ or not defined.
+ """
+ if self.usage:
+ print >>file, self.get_usage()
+
+ def get_version(self):
+ if self.version:
+ return self.expand_prog_name(self.version)
+ else:
+ return ""
+
+ def print_version(self, file=None):
+ """print_version(file : file = stdout)
+
+ Print the version message for this program (self.version) to
+ 'file' (default stdout). As with print_usage(), any occurrence
+ of "%prog" in self.version is replaced by the current program's
+ name. Does nothing if self.version is empty or undefined.
+ """
+ if self.version:
+ print >>file, self.get_version()
+
+ def format_option_help(self, formatter=None):
+ if formatter is None:
+ formatter = self.formatter
+ formatter.store_option_strings(self)
+ result = []
+ result.append(formatter.format_heading(_("Options")))
+ formatter.indent()
+ if self.option_list:
+ result.append(OptionContainer.format_option_help(self, formatter))
+ result.append("\n")
+ for group in self.option_groups:
+ result.append(group.format_help(formatter))
+ result.append("\n")
+ formatter.dedent()
+ # Drop the last "\n", or the header if no options or option groups:
+ return "".join(result[:-1])
+
+ def format_epilog(self, formatter):
+ return formatter.format_epilog(self.epilog)
+
+ def format_help(self, formatter=None):
+ if formatter is None:
+ formatter = self.formatter
+ result = []
+ if self.usage:
+ result.append(self.get_usage() + "\n")
+ if self.description:
+ result.append(self.format_description(formatter) + "\n")
+ result.append(self.format_option_help(formatter))
+ result.append(self.format_epilog(formatter))
+ return "".join(result)
+
+ # used by test suite
+ def _get_encoding(self, file):
+ encoding = getattr(file, "encoding", None)
+ if not encoding:
+ encoding = sys.getdefaultencoding()
+ return encoding
+
+ def print_help(self, file=None):
+ """print_help(file : file = stdout)
+
+ Print an extended help message, listing all options and any
+ help text provided with them, to 'file' (default stdout).
+ """
+ if file is None:
+ file = sys.stdout
+ encoding = self._get_encoding(file)
+ file.write(self.format_help().encode(encoding, "replace"))
+
+# class OptionParser
+
+
+def _match_abbrev(s, wordmap):
+ """_match_abbrev(s : string, wordmap : {string : Option}) -> string
+
+ Return the string key in 'wordmap' for which 's' is an unambiguous
+ abbreviation. If 's' is found to be ambiguous or doesn't match any of
+ 'words', raise BadOptionError.
+ """
+ # Is there an exact match?
+ if s in wordmap:
+ return s
+ else:
+ # Isolate all words with s as a prefix.
+ possibilities = [word for word in wordmap.keys()
+ if word.startswith(s)]
+ # No exact match, so there had better be just one possibility.
+ if len(possibilities) == 1:
+ return possibilities[0]
+ elif not possibilities:
+ raise BadOptionError(s)
+ else:
+ # More than one possible completion: ambiguous prefix.
+ possibilities.sort()
+ raise AmbiguousOptionError(s, possibilities)
+
+
+# Some day, there might be many Option classes. As of Optik 1.3, the
+# preferred way to instantiate Options is indirectly, via make_option(),
+# which will become a factory function when there are many Option
+# classes.
+make_option = Option
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
index 0000000000..3a582421ff
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/pkgutil.py
@@ -0,0 +1,591 @@
+"""Utilities to support packages."""
+
+# NOTE: This module must remain compatible with Python 2.3, as it is shared
+# by setuptools for distribution with Python 2.3 and up.
+
+import os
+import sys
+import imp
+import os.path
+from types import ModuleType
+
+__all__ = [
+ 'get_importer', 'iter_importers', 'get_loader', 'find_loader',
+ 'walk_packages', 'iter_modules', 'get_data',
+ 'ImpImporter', 'ImpLoader', 'read_code', 'extend_path',
+]
+
+def read_code(stream):
+ # This helper is needed in order for the PEP 302 emulation to
+ # correctly handle compiled files
+ import marshal
+
+ magic = stream.read(4)
+ if magic != imp.get_magic():
+ return None
+
+ stream.read(4) # Skip timestamp
+ return marshal.load(stream)
+
+
+def simplegeneric(func):
+ """Make a trivial single-dispatch generic function"""
+ registry = {}
+ def wrapper(*args, **kw):
+ ob = args[0]
+ try:
+ cls = ob.__class__
+ except AttributeError:
+ cls = type(ob)
+ try:
+ mro = cls.__mro__
+ except AttributeError:
+ try:
+ class cls(cls, object):
+ pass
+ mro = cls.__mro__[1:]
+ except TypeError:
+ mro = object, # must be an ExtensionClass or some such :(
+ for t in mro:
+ if t in registry:
+ return registry[t](*args, **kw)
+ else:
+ return func(*args, **kw)
+ try:
+ wrapper.__name__ = func.__name__
+ except (TypeError, AttributeError):
+ pass # Python 2.3 doesn't allow functions to be renamed
+
+ def register(typ, func=None):
+ if func is None:
+ return lambda f: register(typ, f)
+ registry[typ] = func
+ return func
+
+ wrapper.__dict__ = func.__dict__
+ wrapper.__doc__ = func.__doc__
+ wrapper.register = register
+ return wrapper
+
+
+def walk_packages(path=None, prefix='', onerror=None):
+ """Yields (module_loader, name, ispkg) for all modules recursively
+ on path, or, if path is None, all accessible modules.
+
+ 'path' should be either None or a list of paths to look for
+ modules in.
+
+ 'prefix' is a string to output on the front of every module name
+ on output.
+
+ Note that this function must import all *packages* (NOT all
+ modules!) on the given path, in order to access the __path__
+ attribute to find submodules.
+
+ 'onerror' is a function which gets called with one argument (the
+ name of the package which was being imported) if any exception
+ occurs while trying to import a package. If no onerror function is
+ supplied, ImportErrors are caught and ignored, while all other
+ exceptions are propagated, terminating the search.
+
+ Examples:
+
+ # list all modules python can access
+ walk_packages()
+
+ # list all submodules of ctypes
+ walk_packages(ctypes.__path__, ctypes.__name__+'.')
+ """
+
+ def seen(p, m={}):
+ if p in m:
+ return True
+ m[p] = True
+
+ for importer, name, ispkg in iter_modules(path, prefix):
+ yield importer, name, ispkg
+
+ if ispkg:
+ try:
+ __import__(name)
+ except ImportError:
+ if onerror is not None:
+ onerror(name)
+ except Exception:
+ if onerror is not None:
+ onerror(name)
+ else:
+ raise
+ else:
+ path = getattr(sys.modules[name], '__path__', None) or []
+
+ # don't traverse path items we've seen before
+ path = [p for p in path if not seen(p)]
+
+ for item in walk_packages(path, name+'.', onerror):
+ yield item
+
+
+def iter_modules(path=None, prefix=''):
+ """Yields (module_loader, name, ispkg) for all submodules on path,
+ or, if path is None, all top-level modules on sys.path.
+
+ 'path' should be either None or a list of paths to look for
+ modules in.
+
+ 'prefix' is a string to output on the front of every module name
+ on output.
+ """
+
+ if path is None:
+ importers = iter_importers()
+ else:
+ importers = map(get_importer, path)
+
+ yielded = {}
+ for i in importers:
+ for name, ispkg in iter_importer_modules(i, prefix):
+ if name not in yielded:
+ yielded[name] = 1
+ yield i, name, ispkg
+
+
+#@simplegeneric
+def iter_importer_modules(importer, prefix=''):
+ if not hasattr(importer, 'iter_modules'):
+ return []
+ return importer.iter_modules(prefix)
+
+iter_importer_modules = simplegeneric(iter_importer_modules)
+
+
+class ImpImporter:
+ """PEP 302 Importer that wraps Python's "classic" import algorithm
+
+ ImpImporter(dirname) produces a PEP 302 importer that searches that
+ directory. ImpImporter(None) produces a PEP 302 importer that searches
+ the current sys.path, plus any modules that are frozen or built-in.
+
+ Note that ImpImporter does not currently support being used by placement
+ on sys.meta_path.
+ """
+
+ def __init__(self, path=None):
+ self.path = path
+
+ def find_module(self, fullname, path=None):
+ # Note: we ignore 'path' argument since it is only used via meta_path
+ subname = fullname.split(".")[-1]
+ if subname != fullname and self.path is None:
+ return None
+ if self.path is None:
+ path = None
+ else:
+ path = [os.path.realpath(self.path)]
+ try:
+ file, filename, etc = imp.find_module(subname, path)
+ except ImportError:
+ return None
+ return ImpLoader(fullname, file, filename, etc)
+
+ def iter_modules(self, prefix=''):
+ if self.path is None or not os.path.isdir(self.path):
+ return
+
+ yielded = {}
+ import inspect
+ try:
+ filenames = os.listdir(self.path)
+ except OSError:
+ # ignore unreadable directories like import does
+ filenames = []
+ filenames.sort() # handle packages before same-named modules
+
+ for fn in filenames:
+ modname = inspect.getmodulename(fn)
+ if modname=='__init__' or modname in yielded:
+ continue
+
+ path = os.path.join(self.path, fn)
+ ispkg = False
+
+ if not modname and os.path.isdir(path) and '.' not in fn:
+ modname = fn
+ try:
+ dircontents = os.listdir(path)
+ except OSError:
+ # ignore unreadable directories like import does
+ dircontents = []
+ for fn in dircontents:
+ subname = inspect.getmodulename(fn)
+ if subname=='__init__':
+ ispkg = True
+ break
+ else:
+ continue # not a package
+
+ if modname and '.' not in modname:
+ yielded[modname] = 1
+ yield prefix + modname, ispkg
+
+
+class ImpLoader:
+ """PEP 302 Loader that wraps Python's "classic" import algorithm
+ """
+ code = source = None
+
+ def __init__(self, fullname, file, filename, etc):
+ self.file = file
+ self.filename = filename
+ self.fullname = fullname
+ self.etc = etc
+
+ def load_module(self, fullname):
+ self._reopen()
+ try:
+ mod = imp.load_module(fullname, self.file, self.filename, self.etc)
+ finally:
+ if self.file:
+ self.file.close()
+ # Note: we don't set __loader__ because we want the module to look
+ # normal; i.e. this is just a wrapper for standard import machinery
+ return mod
+
+ def get_data(self, pathname):
+ return open(pathname, "rb").read()
+
+ def _reopen(self):
+ if self.file and self.file.closed:
+ mod_type = self.etc[2]
+ if mod_type==imp.PY_SOURCE:
+ self.file = open(self.filename, 'rU')
+ elif mod_type in (imp.PY_COMPILED, imp.C_EXTENSION):
+ self.file = open(self.filename, 'rb')
+
+ def _fix_name(self, fullname):
+ if fullname is None:
+ fullname = self.fullname
+ elif fullname != self.fullname:
+ raise ImportError("Loader for module %s cannot handle "
+ "module %s" % (self.fullname, fullname))
+ return fullname
+
+ def is_package(self, fullname):
+ fullname = self._fix_name(fullname)
+ return self.etc[2]==imp.PKG_DIRECTORY
+
+ def get_code(self, fullname=None):
+ fullname = self._fix_name(fullname)
+ if self.code is None:
+ mod_type = self.etc[2]
+ if mod_type==imp.PY_SOURCE:
+ source = self.get_source(fullname)
+ self.code = compile(source, self.filename, 'exec')
+ elif mod_type==imp.PY_COMPILED:
+ self._reopen()
+ try:
+ self.code = read_code(self.file)
+ finally:
+ self.file.close()
+ elif mod_type==imp.PKG_DIRECTORY:
+ self.code = self._get_delegate().get_code()
+ return self.code
+
+ def get_source(self, fullname=None):
+ fullname = self._fix_name(fullname)
+ if self.source is None:
+ mod_type = self.etc[2]
+ if mod_type==imp.PY_SOURCE:
+ self._reopen()
+ try:
+ self.source = self.file.read()
+ finally:
+ self.file.close()
+ elif mod_type==imp.PY_COMPILED:
+ if os.path.exists(self.filename[:-1]):
+ f = open(self.filename[:-1], 'rU')
+ self.source = f.read()
+ f.close()
+ elif mod_type==imp.PKG_DIRECTORY:
+ self.source = self._get_delegate().get_source()
+ return self.source
+
+
+ def _get_delegate(self):
+ return ImpImporter(self.filename).find_module('__init__')
+
+ def get_filename(self, fullname=None):
+ fullname = self._fix_name(fullname)
+ mod_type = self.etc[2]
+ if self.etc[2]==imp.PKG_DIRECTORY:
+ return self._get_delegate().get_filename()
+ elif self.etc[2] in (imp.PY_SOURCE, imp.PY_COMPILED, imp.C_EXTENSION):
+ return self.filename
+ return None
+
+
+try:
+ import zipimport
+ from zipimport import zipimporter
+
+ def iter_zipimport_modules(importer, prefix=''):
+ dirlist = zipimport._zip_directory_cache[importer.archive].keys()
+ dirlist.sort()
+ _prefix = importer.prefix
+ plen = len(_prefix)
+ yielded = {}
+ import inspect
+ for fn in dirlist:
+ if not fn.startswith(_prefix):
+ continue
+
+ fn = fn[plen:].split(os.sep)
+
+ if len(fn)==2 and fn[1].startswith('__init__.py'):
+ if fn[0] not in yielded:
+ yielded[fn[0]] = 1
+ yield fn[0], True
+
+ if len(fn)!=1:
+ continue
+
+ modname = inspect.getmodulename(fn[0])
+ if modname=='__init__':
+ continue
+
+ if modname and '.' not in modname and modname not in yielded:
+ yielded[modname] = 1
+ yield prefix + modname, False
+
+ iter_importer_modules.register(zipimporter, iter_zipimport_modules)
+
+except ImportError:
+ pass
+
+
+def get_importer(path_item):
+ """Retrieve a PEP 302 importer for the given path item
+
+ The returned importer is cached in sys.path_importer_cache
+ if it was newly created by a path hook.
+
+ If there is no importer, a wrapper around the basic import
+ machinery is returned. This wrapper is never inserted into
+ the importer cache (None is inserted instead).
+
+ The cache (or part of it) can be cleared manually if a
+ rescan of sys.path_hooks is necessary.
+ """
+ try:
+ importer = sys.path_importer_cache[path_item]
+ except KeyError:
+ for path_hook in sys.path_hooks:
+ try:
+ importer = path_hook(path_item)
+ break
+ except ImportError:
+ pass
+ else:
+ importer = None
+ sys.path_importer_cache.setdefault(path_item, importer)
+
+ if importer is None:
+ try:
+ importer = ImpImporter(path_item)
+ except ImportError:
+ importer = None
+ return importer
+
+
+def iter_importers(fullname=""):
+ """Yield PEP 302 importers for the given module name
+
+ If fullname contains a '.', the importers will be for the package
+ containing fullname, otherwise they will be importers for sys.meta_path,
+ sys.path, and Python's "classic" import machinery, in that order. If
+ the named module is in a package, that package is imported as a side
+ effect of invoking this function.
+
+ Non PEP 302 mechanisms (e.g. the Windows registry) used by the
+ standard import machinery to find files in alternative locations
+ are partially supported, but are searched AFTER sys.path. Normally,
+ these locations are searched BEFORE sys.path, preventing sys.path
+ entries from shadowing them.
+
+ For this to cause a visible difference in behaviour, there must
+ be a module or package name that is accessible via both sys.path
+ and one of the non PEP 302 file system mechanisms. In this case,
+ the emulation will find the former version, while the builtin
+ import mechanism will find the latter.
+
+ Items of the following types can be affected by this discrepancy:
+ imp.C_EXTENSION, imp.PY_SOURCE, imp.PY_COMPILED, imp.PKG_DIRECTORY
+ """
+ if fullname.startswith('.'):
+ raise ImportError("Relative module names not supported")
+ if '.' in fullname:
+ # Get the containing package's __path__
+ pkg = '.'.join(fullname.split('.')[:-1])
+ if pkg not in sys.modules:
+ __import__(pkg)
+ path = getattr(sys.modules[pkg], '__path__', None) or []
+ else:
+ for importer in sys.meta_path:
+ yield importer
+ path = sys.path
+ for item in path:
+ yield get_importer(item)
+ if '.' not in fullname:
+ yield ImpImporter()
+
+def get_loader(module_or_name):
+ """Get a PEP 302 "loader" object for module_or_name
+
+ If the module or package is accessible via the normal import
+ mechanism, a wrapper around the relevant part of that machinery
+ is returned. Returns None if the module cannot be found or imported.
+ If the named module is not already imported, its containing package
+ (if any) is imported, in order to establish the package __path__.
+
+ This function uses iter_importers(), and is thus subject to the same
+ limitations regarding platform-specific special import locations such
+ as the Windows registry.
+ """
+ if module_or_name in sys.modules:
+ module_or_name = sys.modules[module_or_name]
+ if isinstance(module_or_name, ModuleType):
+ module = module_or_name
+ loader = getattr(module, '__loader__', None)
+ if loader is not None:
+ return loader
+ fullname = module.__name__
+ else:
+ fullname = module_or_name
+ return find_loader(fullname)
+
+def find_loader(fullname):
+ """Find a PEP 302 "loader" object for fullname
+
+ If fullname contains dots, path must be the containing package's __path__.
+ Returns None if the module cannot be found or imported. This function uses
+ iter_importers(), and is thus subject to the same limitations regarding
+ platform-specific special import locations such as the Windows registry.
+ """
+ for importer in iter_importers(fullname):
+ loader = importer.find_module(fullname)
+ if loader is not None:
+ return loader
+
+ return None
+
+
+def extend_path(path, name):
+ """Extend a package's path.
+
+ Intended use is to place the following code in a package's __init__.py:
+
+ from pkgutil import extend_path
+ __path__ = extend_path(__path__, __name__)
+
+ This will add to the package's __path__ all subdirectories of
+ directories on sys.path named after the package. This is useful
+ if one wants to distribute different parts of a single logical
+ package as multiple directories.
+
+ It also looks for *.pkg files beginning where * matches the name
+ argument. This feature is similar to *.pth files (see site.py),
+ except that it doesn't special-case lines starting with 'import'.
+ A *.pkg file is trusted at face value: apart from checking for
+ duplicates, all entries found in a *.pkg file are added to the
+ path, regardless of whether they are exist the filesystem. (This
+ is a feature.)
+
+ If the input path is not a list (as is the case for frozen
+ packages) it is returned unchanged. The input path is not
+ modified; an extended copy is returned. Items are only appended
+ to the copy at the end.
+
+ It is assumed that sys.path is a sequence. Items of sys.path that
+ are not (unicode or 8-bit) strings referring to existing
+ directories are ignored. Unicode items of sys.path that cause
+ errors when used as filenames may cause this function to raise an
+ exception (in line with os.path.isdir() behavior).
+ """
+
+ if not isinstance(path, list):
+ # This could happen e.g. when this is called from inside a
+ # frozen package. Return the path unchanged in that case.
+ return path
+
+ pname = os.path.join(*name.split('.')) # Reconstitute as relative path
+ # Just in case os.extsep != '.'
+ sname = os.extsep.join(name.split('.'))
+ sname_pkg = sname + os.extsep + "pkg"
+ init_py = "__init__" + os.extsep + "py"
+
+ path = path[:] # Start with a copy of the existing path
+
+ for dir in sys.path:
+ if not isinstance(dir, basestring) or not os.path.isdir(dir):
+ continue
+ subdir = os.path.join(dir, pname)
+ # XXX This may still add duplicate entries to path on
+ # case-insensitive filesystems
+ initfile = os.path.join(subdir, init_py)
+ if subdir not in path and os.path.isfile(initfile):
+ path.append(subdir)
+ # XXX Is this the right thing for subpackages like zope.app?
+ # It looks for a file named "zope.app.pkg"
+ pkgfile = os.path.join(dir, sname_pkg)
+ if os.path.isfile(pkgfile):
+ try:
+ f = open(pkgfile)
+ except IOError, msg:
+ sys.stderr.write("Can't open %s: %s\n" %
+ (pkgfile, msg))
+ else:
+ for line in f:
+ line = line.rstrip('\n')
+ if not line or line.startswith('#'):
+ continue
+ path.append(line) # Don't check for existence!
+ f.close()
+
+ return path
+
+def get_data(package, resource):
+ """Get a resource from a package.
+
+ This is a wrapper round the PEP 302 loader get_data API. The package
+ argument should be the name of a package, in standard module format
+ (foo.bar). The resource argument should be in the form of a relative
+ filename, using '/' as the path separator. The parent directory name '..'
+ is not allowed, and nor is a rooted name (starting with a '/').
+
+ The function returns a binary string, which is the contents of the
+ specified resource.
+
+ For packages located in the filesystem, which have already been imported,
+ this is the rough equivalent of
+
+ d = os.path.dirname(sys.modules[package].__file__)
+ data = open(os.path.join(d, resource), 'rb').read()
+
+ If the package cannot be located or loaded, or it uses a PEP 302 loader
+ which does not support get_data(), then None is returned.
+ """
+
+ loader = get_loader(package)
+ if loader is None or not hasattr(loader, 'get_data'):
+ return None
+ mod = sys.modules.get(package) or loader.load_module(package)
+ if mod is None or not hasattr(mod, '__file__'):
+ return None
+
+ # Modify the resource name to be compatible with the loader.get_data
+ # signature - an os.path format "filename" starting with the dirname of
+ # the package's __file__
+ parts = resource.split('/')
+ parts.insert(0, os.path.dirname(mod.__file__))
+ resource_name = os.path.join(*parts)
+ return loader.get_data(resource_name)
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
index 0000000000..8d7f1e7b5f
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/platform.py
@@ -0,0 +1,1655 @@
+#!/usr/bin/env python
+
+""" This module tries to retrieve as much platform-identifying data as
+ possible. It makes this information available via function APIs.
+
+ If called from the command line, it prints the platform
+ information concatenated as single string to stdout. The output
+ format is useable as part of a filename.
+
+"""
+# This module is maintained by Marc-Andre Lemburg <mal@egenix.com>.
+# If you find problems, please submit bug reports/patches via the
+# Python bug tracker (http://bugs.python.org) and assign them to "lemburg".
+#
+# Note: Please keep this module compatible to Python 1.5.2.
+#
+# Still needed:
+# * more support for WinCE
+# * support for MS-DOS (PythonDX ?)
+# * support for Amiga and other still unsupported platforms running Python
+# * support for additional Linux distributions
+#
+# Many thanks to all those who helped adding platform-specific
+# checks (in no particular order):
+#
+# Charles G Waldman, David Arnold, Gordon McMillan, Ben Darnell,
+# Jeff Bauer, Cliff Crawford, Ivan Van Laningham, Josef
+# Betancourt, Randall Hopper, Karl Putland, John Farrell, Greg
+# Andruk, Just van Rossum, Thomas Heller, Mark R. Levinson, Mark
+# Hammond, Bill Tutt, Hans Nowak, Uwe Zessin (OpenVMS support),
+# Colin Kong, Trent Mick, Guido van Rossum, Anthony Baxter
+#
+# History:
+#
+# <see CVS and SVN checkin messages for history>
+#
+# 1.0.7 - added DEV_NULL
+# 1.0.6 - added linux_distribution()
+# 1.0.5 - fixed Java support to allow running the module on Jython
+# 1.0.4 - added IronPython support
+# 1.0.3 - added normalization of Windows system name
+# 1.0.2 - added more Windows support
+# 1.0.1 - reformatted to make doc.py happy
+# 1.0.0 - reformatted a bit and checked into Python CVS
+# 0.8.0 - added sys.version parser and various new access
+# APIs (python_version(), python_compiler(), etc.)
+# 0.7.2 - fixed architecture() to use sizeof(pointer) where available
+# 0.7.1 - added support for Caldera OpenLinux
+# 0.7.0 - some fixes for WinCE; untabified the source file
+# 0.6.2 - support for OpenVMS - requires version 1.5.2-V006 or higher and
+# vms_lib.getsyi() configured
+# 0.6.1 - added code to prevent 'uname -p' on platforms which are
+# known not to support it
+# 0.6.0 - fixed win32_ver() to hopefully work on Win95,98,NT and Win2k;
+# did some cleanup of the interfaces - some APIs have changed
+# 0.5.5 - fixed another type in the MacOS code... should have
+# used more coffee today ;-)
+# 0.5.4 - fixed a few typos in the MacOS code
+# 0.5.3 - added experimental MacOS support; added better popen()
+# workarounds in _syscmd_ver() -- still not 100% elegant
+# though
+# 0.5.2 - fixed uname() to return '' instead of 'unknown' in all
+# return values (the system uname command tends to return
+# 'unknown' instead of just leaving the field emtpy)
+# 0.5.1 - included code for slackware dist; added exception handlers
+# to cover up situations where platforms don't have os.popen
+# (e.g. Mac) or fail on socket.gethostname(); fixed libc
+# detection RE
+# 0.5.0 - changed the API names referring to system commands to *syscmd*;
+# added java_ver(); made syscmd_ver() a private
+# API (was system_ver() in previous versions) -- use uname()
+# instead; extended the win32_ver() to also return processor
+# type information
+# 0.4.0 - added win32_ver() and modified the platform() output for WinXX
+# 0.3.4 - fixed a bug in _follow_symlinks()
+# 0.3.3 - fixed popen() and "file" command invokation bugs
+# 0.3.2 - added architecture() API and support for it in platform()
+# 0.3.1 - fixed syscmd_ver() RE to support Windows NT
+# 0.3.0 - added system alias support
+# 0.2.3 - removed 'wince' again... oh well.
+# 0.2.2 - added 'wince' to syscmd_ver() supported platforms
+# 0.2.1 - added cache logic and changed the platform string format
+# 0.2.0 - changed the API to use functions instead of module globals
+# since some action take too long to be run on module import
+# 0.1.0 - first release
+#
+# You can always get the latest version of this module at:
+#
+# http://www.egenix.com/files/python/platform.py
+#
+# If that URL should fail, try contacting the author.
+
+__copyright__ = """
+ Copyright (c) 1999-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com
+ Copyright (c) 2000-2010, eGenix.com Software GmbH; mailto:info@egenix.com
+
+ Permission to use, copy, modify, and distribute this software and its
+ documentation for any purpose and without fee or royalty is hereby granted,
+ provided that the above copyright notice appear in all copies and that
+ both that copyright notice and this permission notice appear in
+ supporting documentation or portions thereof, including modifications,
+ that you make.
+
+ EGENIX.COM SOFTWARE GMBH DISCLAIMS ALL WARRANTIES WITH REGARD TO
+ THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
+ INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
+ FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
+ NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
+ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE !
+
+"""
+
+__version__ = '1.0.7'
+
+import sys,string,os,re
+
+### Globals & Constants
+
+# Determine the platform's /dev/null device
+try:
+ DEV_NULL = os.devnull
+except AttributeError:
+ # os.devnull was added in Python 2.4, so emulate it for earlier
+ # Python versions
+ if sys.platform in ('dos','win32','win16','os2'):
+ # Use the old CP/M NUL as device name
+ DEV_NULL = 'NUL'
+ else:
+ # Standard Unix uses /dev/null
+ DEV_NULL = '/dev/null'
+
+### Platform specific APIs
+
+_libc_search = re.compile(r'(__libc_init)'
+ '|'
+ '(GLIBC_([0-9.]+))'
+ '|'
+ '(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)')
+
+def libc_ver(executable=sys.executable,lib='',version='',
+
+ chunksize=2048):
+
+ """ Tries to determine the libc version that the file executable
+ (which defaults to the Python interpreter) is linked against.
+
+ Returns a tuple of strings (lib,version) which default to the
+ given parameters in case the lookup fails.
+
+ Note that the function has intimate knowledge of how different
+ libc versions add symbols to the executable and thus is probably
+ only useable for executables compiled using gcc.
+
+ The file is read and scanned in chunks of chunksize bytes.
+
+ """
+ if hasattr(os.path, 'realpath'):
+ # Python 2.2 introduced os.path.realpath(); it is used
+ # here to work around problems with Cygwin not being
+ # able to open symlinks for reading
+ executable = os.path.realpath(executable)
+ f = open(executable,'rb')
+ binary = f.read(chunksize)
+ pos = 0
+ while 1:
+ m = _libc_search.search(binary,pos)
+ if not m:
+ binary = f.read(chunksize)
+ if not binary:
+ break
+ pos = 0
+ continue
+ libcinit,glibc,glibcversion,so,threads,soversion = m.groups()
+ if libcinit and not lib:
+ lib = 'libc'
+ elif glibc:
+ if lib != 'glibc':
+ lib = 'glibc'
+ version = glibcversion
+ elif glibcversion > version:
+ version = glibcversion
+ elif so:
+ if lib != 'glibc':
+ lib = 'libc'
+ if soversion and soversion > version:
+ version = soversion
+ if threads and version[-len(threads):] != threads:
+ version = version + threads
+ pos = m.end()
+ f.close()
+ return lib,version
+
+def _dist_try_harder(distname,version,id):
+
+ """ Tries some special tricks to get the distribution
+ information in case the default method fails.
+
+ Currently supports older SuSE Linux, Caldera OpenLinux and
+ Slackware Linux distributions.
+
+ """
+ if os.path.exists('/var/adm/inst-log/info'):
+ # SuSE Linux stores distribution information in that file
+ info = open('/var/adm/inst-log/info').readlines()
+ distname = 'SuSE'
+ for line in info:
+ tv = string.split(line)
+ if len(tv) == 2:
+ tag,value = tv
+ else:
+ continue
+ if tag == 'MIN_DIST_VERSION':
+ version = string.strip(value)
+ elif tag == 'DIST_IDENT':
+ values = string.split(value,'-')
+ id = values[2]
+ return distname,version,id
+
+ if os.path.exists('/etc/.installed'):
+ # Caldera OpenLinux has some infos in that file (thanks to Colin Kong)
+ info = open('/etc/.installed').readlines()
+ for line in info:
+ pkg = string.split(line,'-')
+ if len(pkg) >= 2 and pkg[0] == 'OpenLinux':
+ # XXX does Caldera support non Intel platforms ? If yes,
+ # where can we find the needed id ?
+ return 'OpenLinux',pkg[1],id
+
+ if os.path.isdir('/usr/lib/setup'):
+ # Check for slackware version tag file (thanks to Greg Andruk)
+ verfiles = os.listdir('/usr/lib/setup')
+ for n in range(len(verfiles)-1, -1, -1):
+ if verfiles[n][:14] != 'slack-version-':
+ del verfiles[n]
+ if verfiles:
+ verfiles.sort()
+ distname = 'slackware'
+ version = verfiles[-1][14:]
+ return distname,version,id
+
+ return distname,version,id
+
+_release_filename = re.compile(r'(\w+)[-_](release|version)')
+_lsb_release_version = re.compile(r'(.+)'
+ ' release '
+ '([\d.]+)'
+ '[^(]*(?:\((.+)\))?')
+_release_version = re.compile(r'([^0-9]+)'
+ '(?: release )?'
+ '([\d.]+)'
+ '[^(]*(?:\((.+)\))?')
+
+# See also http://www.novell.com/coolsolutions/feature/11251.html
+# and http://linuxmafia.com/faq/Admin/release-files.html
+# and http://data.linux-ntfs.org/rpm/whichrpm
+# and http://www.die.net/doc/linux/man/man1/lsb_release.1.html
+
+_supported_dists = (
+ 'SuSE', 'debian', 'fedora', 'redhat', 'centos',
+ 'mandrake', 'mandriva', 'rocks', 'slackware', 'yellowdog', 'gentoo',
+ 'UnitedLinux', 'turbolinux')
+
+def _parse_release_file(firstline):
+
+ # Default to empty 'version' and 'id' strings. Both defaults are used
+ # when 'firstline' is empty. 'id' defaults to empty when an id can not
+ # be deduced.
+ version = ''
+ id = ''
+
+ # Parse the first line
+ m = _lsb_release_version.match(firstline)
+ if m is not None:
+ # LSB format: "distro release x.x (codename)"
+ return tuple(m.groups())
+
+ # Pre-LSB format: "distro x.x (codename)"
+ m = _release_version.match(firstline)
+ if m is not None:
+ return tuple(m.groups())
+
+ # Unknown format... take the first two words
+ l = string.split(string.strip(firstline))
+ if l:
+ version = l[0]
+ if len(l) > 1:
+ id = l[1]
+ return '', version, id
+
+def linux_distribution(distname='', version='', id='',
+
+ supported_dists=_supported_dists,
+ full_distribution_name=1):
+
+ """ Tries to determine the name of the Linux OS distribution name.
+
+ The function first looks for a distribution release file in
+ /etc and then reverts to _dist_try_harder() in case no
+ suitable files are found.
+
+ supported_dists may be given to define the set of Linux
+ distributions to look for. It defaults to a list of currently
+ supported Linux distributions identified by their release file
+ name.
+
+ If full_distribution_name is true (default), the full
+ distribution read from the OS is returned. Otherwise the short
+ name taken from supported_dists is used.
+
+ Returns a tuple (distname,version,id) which default to the
+ args given as parameters.
+
+ """
+ try:
+ etc = os.listdir('/etc')
+ except os.error:
+ # Probably not a Unix system
+ return distname,version,id
+ etc.sort()
+ for file in etc:
+ m = _release_filename.match(file)
+ if m is not None:
+ _distname,dummy = m.groups()
+ if _distname in supported_dists:
+ distname = _distname
+ break
+ else:
+ return _dist_try_harder(distname,version,id)
+
+ # Read the first line
+ f = open('/etc/'+file, 'r')
+ firstline = f.readline()
+ f.close()
+ _distname, _version, _id = _parse_release_file(firstline)
+
+ if _distname and full_distribution_name:
+ distname = _distname
+ if _version:
+ version = _version
+ if _id:
+ id = _id
+ return distname, version, id
+
+# To maintain backwards compatibility:
+
+def dist(distname='',version='',id='',
+
+ supported_dists=_supported_dists):
+
+ """ Tries to determine the name of the Linux OS distribution name.
+
+ The function first looks for a distribution release file in
+ /etc and then reverts to _dist_try_harder() in case no
+ suitable files are found.
+
+ Returns a tuple (distname,version,id) which default to the
+ args given as parameters.
+
+ """
+ return linux_distribution(distname, version, id,
+ supported_dists=supported_dists,
+ full_distribution_name=0)
+
+class _popen:
+
+ """ Fairly portable (alternative) popen implementation.
+
+ This is mostly needed in case os.popen() is not available, or
+ doesn't work as advertised, e.g. in Win9X GUI programs like
+ PythonWin or IDLE.
+
+ Writing to the pipe is currently not supported.
+
+ """
+ tmpfile = ''
+ pipe = None
+ bufsize = None
+ mode = 'r'
+
+ def __init__(self,cmd,mode='r',bufsize=None):
+
+ if mode != 'r':
+ raise ValueError,'popen()-emulation only supports read mode'
+ import tempfile
+ self.tmpfile = tmpfile = tempfile.mktemp()
+ os.system(cmd + ' > %s' % tmpfile)
+ self.pipe = open(tmpfile,'rb')
+ self.bufsize = bufsize
+ self.mode = mode
+
+ def read(self):
+
+ return self.pipe.read()
+
+ def readlines(self):
+
+ if self.bufsize is not None:
+ return self.pipe.readlines()
+
+ def close(self,
+
+ remove=os.unlink,error=os.error):
+
+ if self.pipe:
+ rc = self.pipe.close()
+ else:
+ rc = 255
+ if self.tmpfile:
+ try:
+ remove(self.tmpfile)
+ except error:
+ pass
+ return rc
+
+ # Alias
+ __del__ = close
+
+def popen(cmd, mode='r', bufsize=None):
+
+ """ Portable popen() interface.
+ """
+ # Find a working popen implementation preferring win32pipe.popen
+ # over os.popen over _popen
+ popen = None
+ if os.environ.get('OS','') == 'Windows_NT':
+ # On NT win32pipe should work; on Win9x it hangs due to bugs
+ # in the MS C lib (see MS KnowledgeBase article Q150956)
+ try:
+ import win32pipe
+ except ImportError:
+ pass
+ else:
+ popen = win32pipe.popen
+ if popen is None:
+ if hasattr(os,'popen'):
+ popen = os.popen
+ # Check whether it works... it doesn't in GUI programs
+ # on Windows platforms
+ if sys.platform == 'win32': # XXX Others too ?
+ try:
+ popen('')
+ except os.error:
+ popen = _popen
+ else:
+ popen = _popen
+ if bufsize is None:
+ return popen(cmd,mode)
+ else:
+ return popen(cmd,mode,bufsize)
+
+def _norm_version(version, build=''):
+
+ """ Normalize the version and build strings and return a single
+ version string using the format major.minor.build (or patchlevel).
+ """
+ l = string.split(version,'.')
+ if build:
+ l.append(build)
+ try:
+ ints = map(int,l)
+ except ValueError:
+ strings = l
+ else:
+ strings = map(str,ints)
+ version = string.join(strings[:3],'.')
+ return version
+
+_ver_output = re.compile(r'(?:([\w ]+) ([\w.]+) '
+ '.*'
+ '\[.* ([\d.]+)\])')
+
+# Examples of VER command output:
+#
+# Windows 2000: Microsoft Windows 2000 [Version 5.00.2195]
+# Windows XP: Microsoft Windows XP [Version 5.1.2600]
+# Windows Vista: Microsoft Windows [Version 6.0.6002]
+#
+# Note that the "Version" string gets localized on different
+# Windows versions.
+
+def _syscmd_ver(system='', release='', version='',
+
+ supported_platforms=('win32','win16','dos','os2')):
+
+ """ Tries to figure out the OS version used and returns
+ a tuple (system,release,version).
+
+ It uses the "ver" shell command for this which is known
+ to exists on Windows, DOS and OS/2. XXX Others too ?
+
+ In case this fails, the given parameters are used as
+ defaults.
+
+ """
+ if sys.platform not in supported_platforms:
+ return system,release,version
+
+ # Try some common cmd strings
+ for cmd in ('ver','command /c ver','cmd /c ver'):
+ try:
+ pipe = popen(cmd)
+ info = pipe.read()
+ if pipe.close():
+ raise os.error,'command failed'
+ # XXX How can I suppress shell errors from being written
+ # to stderr ?
+ except os.error,why:
+ #print 'Command %s failed: %s' % (cmd,why)
+ continue
+ except IOError,why:
+ #print 'Command %s failed: %s' % (cmd,why)
+ continue
+ else:
+ break
+ else:
+ return system,release,version
+
+ # Parse the output
+ info = string.strip(info)
+ m = _ver_output.match(info)
+ if m is not None:
+ system,release,version = m.groups()
+ # Strip trailing dots from version and release
+ if release[-1] == '.':
+ release = release[:-1]
+ if version[-1] == '.':
+ version = version[:-1]
+ # Normalize the version and build strings (eliminating additional
+ # zeros)
+ version = _norm_version(version)
+ return system,release,version
+
+def _win32_getvalue(key,name,default=''):
+
+ """ Read a value for name from the registry key.
+
+ In case this fails, default is returned.
+
+ """
+ try:
+ # Use win32api if available
+ from win32api import RegQueryValueEx
+ except ImportError:
+ # On Python 2.0 and later, emulate using _winreg
+ import _winreg
+ RegQueryValueEx = _winreg.QueryValueEx
+ try:
+ return RegQueryValueEx(key,name)
+ except:
+ return default
+
+def win32_ver(release='',version='',csd='',ptype=''):
+
+ """ Get additional version information from the Windows Registry
+ and return a tuple (version,csd,ptype) referring to version
+ number, CSD level (service pack), and OS type (multi/single
+ processor).
+
+ As a hint: ptype returns 'Uniprocessor Free' on single
+ processor NT machines and 'Multiprocessor Free' on multi
+ processor machines. The 'Free' refers to the OS version being
+ free of debugging code. It could also state 'Checked' which
+ means the OS version uses debugging code, i.e. code that
+ checks arguments, ranges, etc. (Thomas Heller).
+
+ Note: this function works best with Mark Hammond's win32
+ package installed, but also on Python 2.3 and later. It
+ obviously only runs on Win32 compatible platforms.
+
+ """
+ # XXX Is there any way to find out the processor type on WinXX ?
+ # XXX Is win32 available on Windows CE ?
+ #
+ # Adapted from code posted by Karl Putland to comp.lang.python.
+ #
+ # The mappings between reg. values and release names can be found
+ # here: http://msdn.microsoft.com/library/en-us/sysinfo/base/osversioninfo_str.asp
+
+ # Import the needed APIs
+ try:
+ import win32api
+ from win32api import RegQueryValueEx, RegOpenKeyEx, \
+ RegCloseKey, GetVersionEx
+ from win32con import HKEY_LOCAL_MACHINE, VER_PLATFORM_WIN32_NT, \
+ VER_PLATFORM_WIN32_WINDOWS, VER_NT_WORKSTATION
+ except ImportError:
+ # Emulate the win32api module using Python APIs
+ try:
+ sys.getwindowsversion
+ except AttributeError:
+ # No emulation possible, so return the defaults...
+ return release,version,csd,ptype
+ else:
+ # Emulation using _winreg (added in Python 2.0) and
+ # sys.getwindowsversion() (added in Python 2.3)
+ import _winreg
+ GetVersionEx = sys.getwindowsversion
+ RegQueryValueEx = _winreg.QueryValueEx
+ RegOpenKeyEx = _winreg.OpenKeyEx
+ RegCloseKey = _winreg.CloseKey
+ HKEY_LOCAL_MACHINE = _winreg.HKEY_LOCAL_MACHINE
+ VER_PLATFORM_WIN32_WINDOWS = 1
+ VER_PLATFORM_WIN32_NT = 2
+ VER_NT_WORKSTATION = 1
+ VER_NT_SERVER = 3
+ REG_SZ = 1
+
+ # Find out the registry key and some general version infos
+ winver = GetVersionEx()
+ maj,min,buildno,plat,csd = winver
+ version = '%i.%i.%i' % (maj,min,buildno & 0xFFFF)
+ if hasattr(winver, "service_pack"):
+ if winver.service_pack != "":
+ csd = 'SP%s' % winver.service_pack_major
+ else:
+ if csd[:13] == 'Service Pack ':
+ csd = 'SP' + csd[13:]
+
+ if plat == VER_PLATFORM_WIN32_WINDOWS:
+ regkey = 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion'
+ # Try to guess the release name
+ if maj == 4:
+ if min == 0:
+ release = '95'
+ elif min == 10:
+ release = '98'
+ elif min == 90:
+ release = 'Me'
+ else:
+ release = 'postMe'
+ elif maj == 5:
+ release = '2000'
+
+ elif plat == VER_PLATFORM_WIN32_NT:
+ regkey = 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion'
+ if maj <= 4:
+ release = 'NT'
+ elif maj == 5:
+ if min == 0:
+ release = '2000'
+ elif min == 1:
+ release = 'XP'
+ elif min == 2:
+ release = '2003Server'
+ else:
+ release = 'post2003'
+ elif maj == 6:
+ if hasattr(winver, "product_type"):
+ product_type = winver.product_type
+ else:
+ product_type = VER_NT_WORKSTATION
+ # Without an OSVERSIONINFOEX capable sys.getwindowsversion(),
+ # or help from the registry, we cannot properly identify
+ # non-workstation versions.
+ try:
+ key = RegOpenKeyEx(HKEY_LOCAL_MACHINE, regkey)
+ name, type = RegQueryValueEx(key, "ProductName")
+ # Discard any type that isn't REG_SZ
+ if type == REG_SZ and name.find("Server") != -1:
+ product_type = VER_NT_SERVER
+ except WindowsError:
+ # Use default of VER_NT_WORKSTATION
+ pass
+
+ if min == 0:
+ if product_type == VER_NT_WORKSTATION:
+ release = 'Vista'
+ else:
+ release = '2008Server'
+ elif min == 1:
+ if product_type == VER_NT_WORKSTATION:
+ release = '7'
+ else:
+ release = '2008ServerR2'
+ elif min == 2:
+ if product_type == VER_NT_WORKSTATION:
+ release = '8'
+ else:
+ release = '2012Server'
+ else:
+ release = 'post2012Server'
+
+ else:
+ if not release:
+ # E.g. Win3.1 with win32s
+ release = '%i.%i' % (maj,min)
+ return release,version,csd,ptype
+
+ # Open the registry key
+ try:
+ keyCurVer = RegOpenKeyEx(HKEY_LOCAL_MACHINE, regkey)
+ # Get a value to make sure the key exists...
+ RegQueryValueEx(keyCurVer, 'SystemRoot')
+ except:
+ return release,version,csd,ptype
+
+ # Parse values
+ #subversion = _win32_getvalue(keyCurVer,
+ # 'SubVersionNumber',
+ # ('',1))[0]
+ #if subversion:
+ # release = release + subversion # 95a, 95b, etc.
+ build = _win32_getvalue(keyCurVer,
+ 'CurrentBuildNumber',
+ ('',1))[0]
+ ptype = _win32_getvalue(keyCurVer,
+ 'CurrentType',
+ (ptype,1))[0]
+
+ # Normalize version
+ version = _norm_version(version,build)
+
+ # Close key
+ RegCloseKey(keyCurVer)
+ return release,version,csd,ptype
+
+def _mac_ver_lookup(selectors,default=None):
+
+ from gestalt import gestalt
+ import MacOS
+ l = []
+ append = l.append
+ for selector in selectors:
+ try:
+ append(gestalt(selector))
+ except (RuntimeError, MacOS.Error):
+ append(default)
+ return l
+
+def _bcd2str(bcd):
+
+ return hex(bcd)[2:]
+
+def _mac_ver_gestalt():
+ """
+ Thanks to Mark R. Levinson for mailing documentation links and
+ code examples for this function. Documentation for the
+ gestalt() API is available online at:
+
+ http://www.rgaros.nl/gestalt/
+ """
+ # Check whether the version info module is available
+ try:
+ import gestalt
+ import MacOS
+ except ImportError:
+ return None
+ # Get the infos
+ sysv,sysa = _mac_ver_lookup(('sysv','sysa'))
+ # Decode the infos
+ if sysv:
+ major = (sysv & 0xFF00) >> 8
+ minor = (sysv & 0x00F0) >> 4
+ patch = (sysv & 0x000F)
+
+ if (major, minor) >= (10, 4):
+ # the 'sysv' gestald cannot return patchlevels
+ # higher than 9. Apple introduced 3 new
+ # gestalt codes in 10.4 to deal with this
+ # issue (needed because patch levels can
+ # run higher than 9, such as 10.4.11)
+ major,minor,patch = _mac_ver_lookup(('sys1','sys2','sys3'))
+ release = '%i.%i.%i' %(major, minor, patch)
+ else:
+ release = '%s.%i.%i' % (_bcd2str(major),minor,patch)
+
+ if sysa:
+ machine = {0x1: '68k',
+ 0x2: 'PowerPC',
+ 0xa: 'i386'}.get(sysa,'')
+
+ versioninfo=('', '', '')
+ return release,versioninfo,machine
+
+def _mac_ver_xml():
+ fn = '/System/Library/CoreServices/SystemVersion.plist'
+ if not os.path.exists(fn):
+ return None
+
+ try:
+ import plistlib
+ except ImportError:
+ return None
+
+ pl = plistlib.readPlist(fn)
+ release = pl['ProductVersion']
+ versioninfo=('', '', '')
+ machine = os.uname()[4]
+ if machine in ('ppc', 'Power Macintosh'):
+ # for compatibility with the gestalt based code
+ machine = 'PowerPC'
+
+ return release,versioninfo,machine
+
+
+def mac_ver(release='',versioninfo=('','',''),machine=''):
+
+ """ Get MacOS version information and return it as tuple (release,
+ versioninfo, machine) with versioninfo being a tuple (version,
+ dev_stage, non_release_version).
+
+ Entries which cannot be determined are set to the parameter values
+ which default to ''. All tuple entries are strings.
+ """
+
+ # First try reading the information from an XML file which should
+ # always be present
+ info = _mac_ver_xml()
+ if info is not None:
+ return info
+
+ # If that doesn't work for some reason fall back to reading the
+ # information using gestalt calls.
+ info = _mac_ver_gestalt()
+ if info is not None:
+ return info
+
+ # If that also doesn't work return the default values
+ return release,versioninfo,machine
+
+def _java_getprop(name,default):
+
+ from java.lang import System
+ try:
+ value = System.getProperty(name)
+ if value is None:
+ return default
+ return value
+ except AttributeError:
+ return default
+
+def java_ver(release='',vendor='',vminfo=('','',''),osinfo=('','','')):
+
+ """ Version interface for Jython.
+
+ Returns a tuple (release,vendor,vminfo,osinfo) with vminfo being
+ a tuple (vm_name,vm_release,vm_vendor) and osinfo being a
+ tuple (os_name,os_version,os_arch).
+
+ Values which cannot be determined are set to the defaults
+ given as parameters (which all default to '').
+
+ """
+ # Import the needed APIs
+ try:
+ import java.lang
+ except ImportError:
+ return release,vendor,vminfo,osinfo
+
+ vendor = _java_getprop('java.vendor', vendor)
+ release = _java_getprop('java.version', release)
+ vm_name, vm_release, vm_vendor = vminfo
+ vm_name = _java_getprop('java.vm.name', vm_name)
+ vm_vendor = _java_getprop('java.vm.vendor', vm_vendor)
+ vm_release = _java_getprop('java.vm.version', vm_release)
+ vminfo = vm_name, vm_release, vm_vendor
+ os_name, os_version, os_arch = osinfo
+ os_arch = _java_getprop('java.os.arch', os_arch)
+ os_name = _java_getprop('java.os.name', os_name)
+ os_version = _java_getprop('java.os.version', os_version)
+ osinfo = os_name, os_version, os_arch
+
+ return release, vendor, vminfo, osinfo
+
+### System name aliasing
+
+def system_alias(system,release,version):
+
+ """ Returns (system,release,version) aliased to common
+ marketing names used for some systems.
+
+ It also does some reordering of the information in some cases
+ where it would otherwise cause confusion.
+
+ """
+ if system == 'Rhapsody':
+ # Apple's BSD derivative
+ # XXX How can we determine the marketing release number ?
+ return 'MacOS X Server',system+release,version
+
+ elif system == 'SunOS':
+ # Sun's OS
+ if release < '5':
+ # These releases use the old name SunOS
+ return system,release,version
+ # Modify release (marketing release = SunOS release - 3)
+ l = string.split(release,'.')
+ if l:
+ try:
+ major = int(l[0])
+ except ValueError:
+ pass
+ else:
+ major = major - 3
+ l[0] = str(major)
+ release = string.join(l,'.')
+ if release < '6':
+ system = 'Solaris'
+ else:
+ # XXX Whatever the new SunOS marketing name is...
+ system = 'Solaris'
+
+ elif system == 'IRIX64':
+ # IRIX reports IRIX64 on platforms with 64-bit support; yet it
+ # is really a version and not a different platform, since 32-bit
+ # apps are also supported..
+ system = 'IRIX'
+ if version:
+ version = version + ' (64bit)'
+ else:
+ version = '64bit'
+
+ elif system in ('win32','win16'):
+ # In case one of the other tricks
+ system = 'Windows'
+
+ return system,release,version
+
+### Various internal helpers
+
+def _platform(*args):
+
+ """ Helper to format the platform string in a filename
+ compatible format e.g. "system-version-machine".
+ """
+ # Format the platform string
+ platform = string.join(
+ map(string.strip,
+ filter(len, args)),
+ '-')
+
+ # Cleanup some possible filename obstacles...
+ replace = string.replace
+ platform = replace(platform,' ','_')
+ platform = replace(platform,'/','-')
+ platform = replace(platform,'\\','-')
+ platform = replace(platform,':','-')
+ platform = replace(platform,';','-')
+ platform = replace(platform,'"','-')
+ platform = replace(platform,'(','-')
+ platform = replace(platform,')','-')
+
+ # No need to report 'unknown' information...
+ platform = replace(platform,'unknown','')
+
+ # Fold '--'s and remove trailing '-'
+ while 1:
+ cleaned = replace(platform,'--','-')
+ if cleaned == platform:
+ break
+ platform = cleaned
+ while platform[-1] == '-':
+ platform = platform[:-1]
+
+ return platform
+
+def _node(default=''):
+
+ """ Helper to determine the node name of this machine.
+ """
+ try:
+ import socket
+ except ImportError:
+ # No sockets...
+ return default
+ try:
+ return socket.gethostname()
+ except socket.error:
+ # Still not working...
+ return default
+
+# os.path.abspath is new in Python 1.5.2:
+if not hasattr(os.path,'abspath'):
+
+ def _abspath(path,
+
+ isabs=os.path.isabs,join=os.path.join,getcwd=os.getcwd,
+ normpath=os.path.normpath):
+
+ if not isabs(path):
+ path = join(getcwd(), path)
+ return normpath(path)
+
+else:
+
+ _abspath = os.path.abspath
+
+def _follow_symlinks(filepath):
+
+ """ In case filepath is a symlink, follow it until a
+ real file is reached.
+ """
+ filepath = _abspath(filepath)
+ while os.path.islink(filepath):
+ filepath = os.path.normpath(
+ os.path.join(os.path.dirname(filepath),os.readlink(filepath)))
+ return filepath
+
+def _syscmd_uname(option,default=''):
+
+ """ Interface to the system's uname command.
+ """
+ if sys.platform in ('dos','win32','win16','os2'):
+ # XXX Others too ?
+ return default
+ try:
+ f = os.popen('uname %s 2> %s' % (option, DEV_NULL))
+ except (AttributeError,os.error):
+ return default
+ output = string.strip(f.read())
+ rc = f.close()
+ if not output or rc:
+ return default
+ else:
+ return output
+
+def _syscmd_file(target,default=''):
+
+ """ Interface to the system's file command.
+
+ The function uses the -b option of the file command to have it
+ ommit the filename in its output and if possible the -L option
+ to have the command follow symlinks. It returns default in
+ case the command should fail.
+
+ """
+
+ # We do the import here to avoid a bootstrap issue.
+ # See c73b90b6dadd changeset.
+ #
+ # [..]
+ # ranlib libpython2.7.a
+ # gcc -o python \
+ # Modules/python.o \
+ # libpython2.7.a -lsocket -lnsl -ldl -lm
+ # Traceback (most recent call last):
+ # File "./setup.py", line 8, in <module>
+ # from platform import machine as platform_machine
+ # File "[..]/build/Lib/platform.py", line 116, in <module>
+ # import sys,string,os,re,subprocess
+ # File "[..]/build/Lib/subprocess.py", line 429, in <module>
+ # import select
+ # ImportError: No module named select
+
+ import subprocess
+
+ if sys.platform in ('dos','win32','win16','os2'):
+ # XXX Others too ?
+ return default
+ target = _follow_symlinks(target)
+ try:
+ proc = subprocess.Popen(['file', target],
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+
+ except (AttributeError,os.error):
+ return default
+ output = proc.communicate()[0]
+ rc = proc.wait()
+ if not output or rc:
+ return default
+ else:
+ return output
+
+### Information about the used architecture
+
+# Default values for architecture; non-empty strings override the
+# defaults given as parameters
+_default_architecture = {
+ 'win32': ('','WindowsPE'),
+ 'win16': ('','Windows'),
+ 'dos': ('','MSDOS'),
+}
+
+_architecture_split = re.compile(r'[\s,]').split
+
+def architecture(executable=sys.executable,bits='',linkage=''):
+
+ """ Queries the given executable (defaults to the Python interpreter
+ binary) for various architecture information.
+
+ Returns a tuple (bits,linkage) which contains information about
+ the bit architecture and the linkage format used for the
+ executable. Both values are returned as strings.
+
+ Values that cannot be determined are returned as given by the
+ parameter presets. If bits is given as '', the sizeof(pointer)
+ (or sizeof(long) on Python version < 1.5.2) is used as
+ indicator for the supported pointer size.
+
+ The function relies on the system's "file" command to do the
+ actual work. This is available on most if not all Unix
+ platforms. On some non-Unix platforms where the "file" command
+ does not exist and the executable is set to the Python interpreter
+ binary defaults from _default_architecture are used.
+
+ """
+ # Use the sizeof(pointer) as default number of bits if nothing
+ # else is given as default.
+ if not bits:
+ import struct
+ try:
+ size = struct.calcsize('P')
+ except struct.error:
+ # Older installations can only query longs
+ size = struct.calcsize('l')
+ bits = str(size*8) + 'bit'
+
+ # Get data from the 'file' system command
+ if executable:
+ output = _syscmd_file(executable, '')
+ else:
+ output = ''
+
+ if not output and \
+ executable == sys.executable:
+ # "file" command did not return anything; we'll try to provide
+ # some sensible defaults then...
+ if sys.platform in _default_architecture:
+ b, l = _default_architecture[sys.platform]
+ if b:
+ bits = b
+ if l:
+ linkage = l
+ return bits, linkage
+
+ # Split the output into a list of strings omitting the filename
+ fileout = _architecture_split(output)[1:]
+
+ if 'executable' not in fileout:
+ # Format not supported
+ return bits,linkage
+
+ # Bits
+ if '32-bit' in fileout:
+ bits = '32bit'
+ elif 'N32' in fileout:
+ # On Irix only
+ bits = 'n32bit'
+ elif '64-bit' in fileout:
+ bits = '64bit'
+
+ # Linkage
+ if 'ELF' in fileout:
+ linkage = 'ELF'
+ elif 'PE' in fileout:
+ # E.g. Windows uses this format
+ if 'Windows' in fileout:
+ linkage = 'WindowsPE'
+ else:
+ linkage = 'PE'
+ elif 'COFF' in fileout:
+ linkage = 'COFF'
+ elif 'MS-DOS' in fileout:
+ linkage = 'MSDOS'
+ else:
+ # XXX the A.OUT format also falls under this class...
+ pass
+
+ return bits,linkage
+
+### Portable uname() interface
+
+_uname_cache = None
+
+def uname():
+
+ """ Fairly portable uname interface. Returns a tuple
+ of strings (system,node,release,version,machine,processor)
+ identifying the underlying platform.
+
+ Note that unlike the os.uname function this also returns
+ possible processor information as an additional tuple entry.
+
+ Entries which cannot be determined are set to ''.
+
+ """
+ global _uname_cache
+ no_os_uname = 0
+
+ if _uname_cache is not None:
+ return _uname_cache
+
+ processor = ''
+
+ # Get some infos from the builtin os.uname API...
+ try:
+ system,node,release,version,machine = os.uname()
+ except AttributeError:
+ no_os_uname = 1
+
+ if no_os_uname or not filter(None, (system, node, release, version, machine)):
+ # Hmm, no there is either no uname or uname has returned
+ #'unknowns'... we'll have to poke around the system then.
+ if no_os_uname:
+ system = sys.platform
+ release = ''
+ version = ''
+ node = _node()
+ machine = ''
+
+ use_syscmd_ver = 1
+
+ # Try win32_ver() on win32 platforms
+ if system == 'win32':
+ release,version,csd,ptype = win32_ver()
+ if release and version:
+ use_syscmd_ver = 0
+ # Try to use the PROCESSOR_* environment variables
+ # available on Win XP and later; see
+ # http://support.microsoft.com/kb/888731 and
+ # http://www.geocities.com/rick_lively/MANUALS/ENV/MSWIN/PROCESSI.HTM
+ if not machine:
+ # WOW64 processes mask the native architecture
+ if "PROCESSOR_ARCHITEW6432" in os.environ:
+ machine = os.environ.get("PROCESSOR_ARCHITEW6432", '')
+ else:
+ machine = os.environ.get('PROCESSOR_ARCHITECTURE', '')
+ if not processor:
+ processor = os.environ.get('PROCESSOR_IDENTIFIER', machine)
+
+ # Try the 'ver' system command available on some
+ # platforms
+ if use_syscmd_ver:
+ system,release,version = _syscmd_ver(system)
+ # Normalize system to what win32_ver() normally returns
+ # (_syscmd_ver() tends to return the vendor name as well)
+ if system == 'Microsoft Windows':
+ system = 'Windows'
+ elif system == 'Microsoft' and release == 'Windows':
+ # Under Windows Vista and Windows Server 2008,
+ # Microsoft changed the output of the ver command. The
+ # release is no longer printed. This causes the
+ # system and release to be misidentified.
+ system = 'Windows'
+ if '6.0' == version[:3]:
+ release = 'Vista'
+ else:
+ release = ''
+
+ # In case we still don't know anything useful, we'll try to
+ # help ourselves
+ if system in ('win32','win16'):
+ if not version:
+ if system == 'win32':
+ version = '32bit'
+ else:
+ version = '16bit'
+ system = 'Windows'
+
+ elif system[:4] == 'java':
+ release,vendor,vminfo,osinfo = java_ver()
+ system = 'Java'
+ version = string.join(vminfo,', ')
+ if not version:
+ version = vendor
+
+ # System specific extensions
+ if system == 'OpenVMS':
+ # OpenVMS seems to have release and version mixed up
+ if not release or release == '0':
+ release = version
+ version = ''
+ # Get processor information
+ try:
+ import vms_lib
+ except ImportError:
+ pass
+ else:
+ csid, cpu_number = vms_lib.getsyi('SYI$_CPU',0)
+ if (cpu_number >= 128):
+ processor = 'Alpha'
+ else:
+ processor = 'VAX'
+ if not processor:
+ # Get processor information from the uname system command
+ processor = _syscmd_uname('-p','')
+
+ #If any unknowns still exist, replace them with ''s, which are more portable
+ if system == 'unknown':
+ system = ''
+ if node == 'unknown':
+ node = ''
+ if release == 'unknown':
+ release = ''
+ if version == 'unknown':
+ version = ''
+ if machine == 'unknown':
+ machine = ''
+ if processor == 'unknown':
+ processor = ''
+
+ # normalize name
+ if system == 'Microsoft' and release == 'Windows':
+ system = 'Windows'
+ release = 'Vista'
+
+ _uname_cache = system,node,release,version,machine,processor
+ return _uname_cache
+
+### Direct interfaces to some of the uname() return values
+
+def system():
+
+ """ Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'.
+
+ An empty string is returned if the value cannot be determined.
+
+ """
+ return uname()[0]
+
+def node():
+
+ """ Returns the computer's network name (which may not be fully
+ qualified)
+
+ An empty string is returned if the value cannot be determined.
+
+ """
+ return uname()[1]
+
+def release():
+
+ """ Returns the system's release, e.g. '2.2.0' or 'NT'
+
+ An empty string is returned if the value cannot be determined.
+
+ """
+ return uname()[2]
+
+def version():
+
+ """ Returns the system's release version, e.g. '#3 on degas'
+
+ An empty string is returned if the value cannot be determined.
+
+ """
+ return uname()[3]
+
+def machine():
+
+ """ Returns the machine type, e.g. 'i386'
+
+ An empty string is returned if the value cannot be determined.
+
+ """
+ return uname()[4]
+
+def processor():
+
+ """ Returns the (true) processor name, e.g. 'amdk6'
+
+ An empty string is returned if the value cannot be
+ determined. Note that many platforms do not provide this
+ information or simply return the same value as for machine(),
+ e.g. NetBSD does this.
+
+ """
+ return uname()[5]
+
+### Various APIs for extracting information from sys.version
+
+_sys_version_parser = re.compile(
+ r'([\w.+]+)\s*'
+ '\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*'
+ '\[([^\]]+)\]?')
+
+_ironpython_sys_version_parser = re.compile(
+ r'IronPython\s*'
+ '([\d\.]+)'
+ '(?: \(([\d\.]+)\))?'
+ ' on (.NET [\d\.]+)')
+
+# IronPython covering 2.6 and 2.7
+_ironpython26_sys_version_parser = re.compile(
+ r'([\d.]+)\s*'
+ '\(IronPython\s*'
+ '[\d.]+\s*'
+ '\(([\d.]+)\) on ([\w.]+ [\d.]+(?: \(\d+-bit\))?)\)'
+)
+
+_pypy_sys_version_parser = re.compile(
+ r'([\w.+]+)\s*'
+ '\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*'
+ '\[PyPy [^\]]+\]?')
+
+_sys_version_cache = {}
+
+def _sys_version(sys_version=None):
+
+ """ Returns a parsed version of Python's sys.version as tuple
+ (name, version, branch, revision, buildno, builddate, compiler)
+ referring to the Python implementation name, version, branch,
+ revision, build number, build date/time as string and the compiler
+ identification string.
+
+ Note that unlike the Python sys.version, the returned value
+ for the Python version will always include the patchlevel (it
+ defaults to '.0').
+
+ The function returns empty strings for tuple entries that
+ cannot be determined.
+
+ sys_version may be given to parse an alternative version
+ string, e.g. if the version was read from a different Python
+ interpreter.
+
+ """
+ # Get the Python version
+ if sys_version is None:
+ sys_version = sys.version
+
+ # Try the cache first
+ result = _sys_version_cache.get(sys_version, None)
+ if result is not None:
+ return result
+
+ # Parse it
+ if 'IronPython' in sys_version:
+ # IronPython
+ name = 'IronPython'
+ if sys_version.startswith('IronPython'):
+ match = _ironpython_sys_version_parser.match(sys_version)
+ else:
+ match = _ironpython26_sys_version_parser.match(sys_version)
+
+ if match is None:
+ raise ValueError(
+ 'failed to parse IronPython sys.version: %s' %
+ repr(sys_version))
+
+ version, alt_version, compiler = match.groups()
+ buildno = ''
+ builddate = ''
+
+ elif sys.platform.startswith('java'):
+ # Jython
+ name = 'Jython'
+ match = _sys_version_parser.match(sys_version)
+ if match is None:
+ raise ValueError(
+ 'failed to parse Jython sys.version: %s' %
+ repr(sys_version))
+ version, buildno, builddate, buildtime, _ = match.groups()
+ compiler = sys.platform
+
+ elif "PyPy" in sys_version:
+ # PyPy
+ name = "PyPy"
+ match = _pypy_sys_version_parser.match(sys_version)
+ if match is None:
+ raise ValueError("failed to parse PyPy sys.version: %s" %
+ repr(sys_version))
+ version, buildno, builddate, buildtime = match.groups()
+ compiler = ""
+
+ else:
+ # CPython
+ match = _sys_version_parser.match(sys_version)
+ if match is None:
+ raise ValueError(
+ 'failed to parse CPython sys.version: %s' %
+ repr(sys_version))
+ version, buildno, builddate, buildtime, compiler = \
+ match.groups()
+ name = 'CPython'
+ builddate = builddate + ' ' + buildtime
+
+ if hasattr(sys, 'subversion'):
+ # sys.subversion was added in Python 2.5
+ _, branch, revision = sys.subversion
+ else:
+ branch = ''
+ revision = ''
+
+ # Add the patchlevel version if missing
+ l = string.split(version, '.')
+ if len(l) == 2:
+ l.append('0')
+ version = string.join(l, '.')
+
+ # Build and cache the result
+ result = (name, version, branch, revision, buildno, builddate, compiler)
+ _sys_version_cache[sys_version] = result
+ return result
+
+def python_implementation():
+
+ """ Returns a string identifying the Python implementation.
+
+ Currently, the following implementations are identified:
+ 'CPython' (C implementation of Python),
+ 'IronPython' (.NET implementation of Python),
+ 'Jython' (Java implementation of Python),
+ 'PyPy' (Python implementation of Python).
+
+ """
+ return _sys_version()[0]
+
+def python_version():
+
+ """ Returns the Python version as string 'major.minor.patchlevel'
+
+ Note that unlike the Python sys.version, the returned value
+ will always include the patchlevel (it defaults to 0).
+
+ """
+ return _sys_version()[1]
+
+def python_version_tuple():
+
+ """ Returns the Python version as tuple (major, minor, patchlevel)
+ of strings.
+
+ Note that unlike the Python sys.version, the returned value
+ will always include the patchlevel (it defaults to 0).
+
+ """
+ return tuple(string.split(_sys_version()[1], '.'))
+
+def python_branch():
+
+ """ Returns a string identifying the Python implementation
+ branch.
+
+ For CPython this is the Subversion branch from which the
+ Python binary was built.
+
+ If not available, an empty string is returned.
+
+ """
+
+ return _sys_version()[2]
+
+def python_revision():
+
+ """ Returns a string identifying the Python implementation
+ revision.
+
+ For CPython this is the Subversion revision from which the
+ Python binary was built.
+
+ If not available, an empty string is returned.
+
+ """
+ return _sys_version()[3]
+
+def python_build():
+
+ """ Returns a tuple (buildno, builddate) stating the Python
+ build number and date as strings.
+
+ """
+ return _sys_version()[4:6]
+
+def python_compiler():
+
+ """ Returns a string identifying the compiler used for compiling
+ Python.
+
+ """
+ return _sys_version()[6]
+
+### The Opus Magnum of platform strings :-)
+
+_platform_cache = {}
+
+def platform(aliased=0, terse=0):
+
+ """ Returns a single string identifying the underlying platform
+ with as much useful information as possible (but no more :).
+
+ The output is intended to be human readable rather than
+ machine parseable. It may look different on different
+ platforms and this is intended.
+
+ If "aliased" is true, the function will use aliases for
+ various platforms that report system names which differ from
+ their common names, e.g. SunOS will be reported as
+ Solaris. The system_alias() function is used to implement
+ this.
+
+ Setting terse to true causes the function to return only the
+ absolute minimum information needed to identify the platform.
+
+ """
+ result = _platform_cache.get((aliased, terse), None)
+ if result is not None:
+ return result
+
+ # Get uname information and then apply platform specific cosmetics
+ # to it...
+ system,node,release,version,machine,processor = uname()
+ if machine == processor:
+ processor = ''
+ if aliased:
+ system,release,version = system_alias(system,release,version)
+
+ if system == 'Windows':
+ # MS platforms
+ rel,vers,csd,ptype = win32_ver(version)
+ if terse:
+ platform = _platform(system,release)
+ else:
+ platform = _platform(system,release,version,csd)
+
+ elif system in ('Linux',):
+ # Linux based systems
+ distname,distversion,distid = dist('')
+ if distname and not terse:
+ platform = _platform(system,release,machine,processor,
+ 'with',
+ distname,distversion,distid)
+ else:
+ # If the distribution name is unknown check for libc vs. glibc
+ libcname,libcversion = libc_ver(sys.executable)
+ platform = _platform(system,release,machine,processor,
+ 'with',
+ libcname+libcversion)
+ elif system == 'Java':
+ # Java platforms
+ r,v,vminfo,(os_name,os_version,os_arch) = java_ver()
+ if terse or not os_name:
+ platform = _platform(system,release,version)
+ else:
+ platform = _platform(system,release,version,
+ 'on',
+ os_name,os_version,os_arch)
+
+ elif system == 'MacOS':
+ # MacOS platforms
+ if terse:
+ platform = _platform(system,release)
+ else:
+ platform = _platform(system,release,machine)
+
+ else:
+ # Generic handler
+ if terse:
+ platform = _platform(system,release)
+ else:
+ bits,linkage = architecture(sys.executable)
+ platform = _platform(system,release,machine,processor,bits,linkage)
+
+ _platform_cache[(aliased, terse)] = platform
+ return platform
+
+### Command line interface
+
+if __name__ == '__main__':
+ # Default is to print the aliased verbose platform string
+ terse = ('terse' in sys.argv or '--terse' in sys.argv)
+ aliased = (not 'nonaliased' in sys.argv and not '--nonaliased' in sys.argv)
+ print platform(aliased,terse)
+ sys.exit(0)
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
index 0000000000..e69de29bb2
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/pydoc_data/__init__.py
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
index 0000000000..b6744d8c45
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/pydoc_data/topics.py
@@ -0,0 +1,80 @@
+# -*- coding: utf-8 -*-
+# Autogenerated by Sphinx on Sun May 10 13:12:18 2015
+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',
+ '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',
+ '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',
+ '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",
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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',
+ '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'}
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
index 0000000000..f234c85239
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/random.py
@@ -0,0 +1,910 @@
+"""Random variable generators.
+
+ integers
+ --------
+ uniform within range
+
+ sequences
+ ---------
+ pick random element
+ pick random sample
+ generate random permutation
+
+ distributions on the real line:
+ ------------------------------
+ uniform
+ triangular
+ normal (Gaussian)
+ lognormal
+ negative exponential
+ gamma
+ beta
+ pareto
+ Weibull
+
+ distributions on the circle (angles 0 to 2pi)
+ ---------------------------------------------
+ circular uniform
+ von Mises
+
+General notes on the underlying Mersenne Twister core generator:
+
+* The period is 2**19937-1.
+* It is one of the most extensively tested generators in existence.
+* Without a direct way to compute N steps forward, the semantics of
+ jumpahead(n) are weakened to simply jump to another distant state and rely
+ on the large period to avoid overlapping sequences.
+* The random() method is implemented in C, executes in a single Python step,
+ and is, therefore, threadsafe.
+
+"""
+
+from __future__ import division
+from warnings import warn as _warn
+from types import MethodType as _MethodType, BuiltinMethodType as _BuiltinMethodType
+from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
+from math import sqrt as _sqrt, acos as _acos, cos as _cos, sin as _sin
+from os import urandom as _urandom
+from binascii import hexlify as _hexlify
+import hashlib as _hashlib
+
+__all__ = ["Random","seed","random","uniform","randint","choice","sample",
+ "randrange","shuffle","normalvariate","lognormvariate",
+ "expovariate","vonmisesvariate","gammavariate","triangular",
+ "gauss","betavariate","paretovariate","weibullvariate",
+ "getstate","setstate","jumpahead", "WichmannHill", "getrandbits",
+ "SystemRandom"]
+
+NV_MAGICCONST = 4 * _exp(-0.5)/_sqrt(2.0)
+TWOPI = 2.0*_pi
+LOG4 = _log(4.0)
+SG_MAGICCONST = 1.0 + _log(4.5)
+BPF = 53 # Number of bits in a float
+RECIP_BPF = 2**-BPF
+
+
+# Translated by Guido van Rossum from C source provided by
+# Adrian Baddeley. Adapted by Raymond Hettinger for use with
+# the Mersenne Twister and os.urandom() core generators.
+
+import _random
+
+class Random(_random.Random):
+ """Random number generator base class used by bound module functions.
+
+ Used to instantiate instances of Random to get generators that don't
+ share state. Especially useful for multi-threaded programs, creating
+ a different instance of Random for each thread, and using the jumpahead()
+ method to ensure that the generated sequences seen by each thread don't
+ overlap.
+
+ Class Random can also be subclassed if you want to use a different basic
+ generator of your own devising: in that case, override the following
+ methods: random(), seed(), getstate(), setstate() and jumpahead().
+ Optionally, implement a getrandbits() method so that randrange() can cover
+ arbitrarily large ranges.
+
+ """
+
+ VERSION = 3 # used by getstate/setstate
+
+ def __init__(self, x=None):
+ """Initialize an instance.
+
+ Optional argument x controls seeding, as for Random.seed().
+ """
+
+ self.seed(x)
+ self.gauss_next = None
+
+ def seed(self, a=None):
+ """Initialize internal state from hashable object.
+
+ None or no argument seeds from current time or from an operating
+ system specific randomness source if available.
+
+ If a is not None or an int or long, hash(a) is used instead.
+ """
+
+ if a is None:
+ try:
+ # Seed with enough bytes to span the 19937 bit
+ # state space for the Mersenne Twister
+ a = long(_hexlify(_urandom(2500)), 16)
+ except NotImplementedError:
+ import time
+ a = long(time.time() * 256) # use fractional seconds
+
+ super(Random, self).seed(a)
+ self.gauss_next = None
+
+ def getstate(self):
+ """Return internal state; can be passed to setstate() later."""
+ return self.VERSION, super(Random, self).getstate(), self.gauss_next
+
+ def setstate(self, state):
+ """Restore internal state from object returned by getstate()."""
+ version = state[0]
+ if version == 3:
+ version, internalstate, self.gauss_next = state
+ super(Random, self).setstate(internalstate)
+ elif version == 2:
+ version, internalstate, self.gauss_next = state
+ # In version 2, the state was saved as signed ints, which causes
+ # inconsistencies between 32/64-bit systems. The state is
+ # really unsigned 32-bit ints, so we convert negative ints from
+ # version 2 to positive longs for version 3.
+ try:
+ internalstate = tuple( long(x) % (2**32) for x in internalstate )
+ except ValueError, e:
+ raise TypeError, e
+ super(Random, self).setstate(internalstate)
+ else:
+ raise ValueError("state with version %s passed to "
+ "Random.setstate() of version %s" %
+ (version, self.VERSION))
+
+ def jumpahead(self, n):
+ """Change the internal state to one that is likely far away
+ from the current state. This method will not be in Py3.x,
+ so it is better to simply reseed.
+ """
+ # The super.jumpahead() method uses shuffling to change state,
+ # so it needs a large and "interesting" n to work with. Here,
+ # we use hashing to create a large n for the shuffle.
+ s = repr(n) + repr(self.getstate())
+ n = int(_hashlib.new('sha512', s).hexdigest(), 16)
+ super(Random, self).jumpahead(n)
+
+## ---- Methods below this point do not need to be overridden when
+## ---- subclassing for the purpose of using a different core generator.
+
+## -------------------- pickle support -------------------
+
+ def __getstate__(self): # for pickle
+ return self.getstate()
+
+ def __setstate__(self, state): # for pickle
+ self.setstate(state)
+
+ def __reduce__(self):
+ return self.__class__, (), self.getstate()
+
+## -------------------- integer methods -------------------
+
+ def randrange(self, start, stop=None, step=1, _int=int, _maxwidth=1L<<BPF):
+ """Choose a random item from range(start, stop[, step]).
+
+ This fixes the problem with randint() which includes the
+ endpoint; in Python this is usually not what you want.
+
+ """
+
+ # This code is a bit messy to make it fast for the
+ # common case while still doing adequate error checking.
+ istart = _int(start)
+ if istart != start:
+ raise ValueError, "non-integer arg 1 for randrange()"
+ if stop is None:
+ if istart > 0:
+ if istart >= _maxwidth:
+ return self._randbelow(istart)
+ return _int(self.random() * istart)
+ raise ValueError, "empty range for randrange()"
+
+ # stop argument supplied.
+ istop = _int(stop)
+ if istop != stop:
+ raise ValueError, "non-integer stop for randrange()"
+ width = istop - istart
+ if step == 1 and width > 0:
+ # Note that
+ # int(istart + self.random()*width)
+ # instead would be incorrect. For example, consider istart
+ # = -2 and istop = 0. Then the guts would be in
+ # -2.0 to 0.0 exclusive on both ends (ignoring that random()
+ # might return 0.0), and because int() truncates toward 0, the
+ # final result would be -1 or 0 (instead of -2 or -1).
+ # istart + int(self.random()*width)
+ # would also be incorrect, for a subtler reason: the RHS
+ # can return a long, and then randrange() would also return
+ # a long, but we're supposed to return an int (for backward
+ # compatibility).
+
+ if width >= _maxwidth:
+ return _int(istart + self._randbelow(width))
+ return _int(istart + _int(self.random()*width))
+ if step == 1:
+ raise ValueError, "empty range for randrange() (%d,%d, %d)" % (istart, istop, width)
+
+ # Non-unit step argument supplied.
+ istep = _int(step)
+ if istep != step:
+ raise ValueError, "non-integer step for randrange()"
+ if istep > 0:
+ n = (width + istep - 1) // istep
+ elif istep < 0:
+ n = (width + istep + 1) // istep
+ else:
+ raise ValueError, "zero step for randrange()"
+
+ if n <= 0:
+ raise ValueError, "empty range for randrange()"
+
+ if n >= _maxwidth:
+ return istart + istep*self._randbelow(n)
+ return istart + istep*_int(self.random() * n)
+
+ def randint(self, a, b):
+ """Return random integer in range [a, b], including both end points.
+ """
+
+ return self.randrange(a, b+1)
+
+ def _randbelow(self, n, _log=_log, _int=int, _maxwidth=1L<<BPF,
+ _Method=_MethodType, _BuiltinMethod=_BuiltinMethodType):
+ """Return a random int in the range [0,n)
+
+ Handles the case where n has more bits than returned
+ by a single call to the underlying generator.
+ """
+
+ try:
+ getrandbits = self.getrandbits
+ except AttributeError:
+ pass
+ else:
+ # Only call self.getrandbits if the original random() builtin method
+ # has not been overridden or if a new getrandbits() was supplied.
+ # This assures that the two methods correspond.
+ if type(self.random) is _BuiltinMethod or type(getrandbits) is _Method:
+ k = _int(1.00001 + _log(n-1, 2.0)) # 2**k > n-1 > 2**(k-2)
+ r = getrandbits(k)
+ while r >= n:
+ r = getrandbits(k)
+ return r
+ if n >= _maxwidth:
+ _warn("Underlying random() generator does not supply \n"
+ "enough bits to choose from a population range this large")
+ return _int(self.random() * n)
+
+## -------------------- sequence methods -------------------
+
+ def choice(self, seq):
+ """Choose a random element from a non-empty sequence."""
+ return seq[int(self.random() * len(seq))] # raises IndexError if seq is empty
+
+ def shuffle(self, x, random=None):
+ """x, random=random.random -> shuffle list x in place; return None.
+
+ Optional arg random is a 0-argument function returning a random
+ float in [0.0, 1.0); by default, the standard random.random.
+
+ """
+
+ if random is None:
+ random = self.random
+ _int = int
+ for i in reversed(xrange(1, len(x))):
+ # pick an element in x[:i+1] with which to exchange x[i]
+ j = _int(random() * (i+1))
+ x[i], x[j] = x[j], x[i]
+
+ def sample(self, population, k):
+ """Chooses k unique random elements from a population sequence.
+
+ Returns a new list containing elements from the population while
+ leaving the original population unchanged. The resulting list is
+ in selection order so that all sub-slices will also be valid random
+ samples. This allows raffle winners (the sample) to be partitioned
+ into grand prize and second place winners (the subslices).
+
+ Members of the population need not be hashable or unique. If the
+ population contains repeats, then each occurrence is a possible
+ selection in the sample.
+
+ To choose a sample in a range of integers, use xrange as an argument.
+ This is especially fast and space efficient for sampling from a
+ large population: sample(xrange(10000000), 60)
+ """
+
+ # Sampling without replacement entails tracking either potential
+ # selections (the pool) in a list or previous selections in a set.
+
+ # When the number of selections is small compared to the
+ # population, then tracking selections is efficient, requiring
+ # only a small set and an occasional reselection. For
+ # a larger number of selections, the pool tracking method is
+ # preferred since the list takes less space than the
+ # set and it doesn't suffer from frequent reselections.
+
+ n = len(population)
+ if not 0 <= k <= n:
+ raise ValueError("sample larger than population")
+ random = self.random
+ _int = int
+ result = [None] * k
+ setsize = 21 # size of a small set minus size of an empty list
+ if k > 5:
+ setsize += 4 ** _ceil(_log(k * 3, 4)) # table size for big sets
+ if n <= setsize or hasattr(population, "keys"):
+ # An n-length list is smaller than a k-length set, or this is a
+ # mapping type so the other algorithm wouldn't work.
+ pool = list(population)
+ for i in xrange(k): # invariant: non-selected at [0,n-i)
+ j = _int(random() * (n-i))
+ result[i] = pool[j]
+ pool[j] = pool[n-i-1] # move non-selected item into vacancy
+ else:
+ try:
+ selected = set()
+ selected_add = selected.add
+ for i in xrange(k):
+ j = _int(random() * n)
+ while j in selected:
+ j = _int(random() * n)
+ selected_add(j)
+ result[i] = population[j]
+ except (TypeError, KeyError): # handle (at least) sets
+ if isinstance(population, list):
+ raise
+ return self.sample(tuple(population), k)
+ return result
+
+## -------------------- real-valued distributions -------------------
+
+## -------------------- uniform distribution -------------------
+
+ def uniform(self, a, b):
+ "Get a random number in the range [a, b) or [a, b] depending on rounding."
+ return a + (b-a) * self.random()
+
+## -------------------- triangular --------------------
+
+ def triangular(self, low=0.0, high=1.0, mode=None):
+ """Triangular distribution.
+
+ Continuous distribution bounded by given lower and upper limits,
+ and having a given mode value in-between.
+
+ http://en.wikipedia.org/wiki/Triangular_distribution
+
+ """
+ u = self.random()
+ try:
+ c = 0.5 if mode is None else (mode - low) / (high - low)
+ except ZeroDivisionError:
+ return low
+ if u > c:
+ u = 1.0 - u
+ c = 1.0 - c
+ low, high = high, low
+ return low + (high - low) * (u * c) ** 0.5
+
+## -------------------- normal distribution --------------------
+
+ def normalvariate(self, mu, sigma):
+ """Normal distribution.
+
+ mu is the mean, and sigma is the standard deviation.
+
+ """
+ # mu = mean, sigma = standard deviation
+
+ # Uses Kinderman and Monahan method. Reference: Kinderman,
+ # A.J. and Monahan, J.F., "Computer generation of random
+ # variables using the ratio of uniform deviates", ACM Trans
+ # Math Software, 3, (1977), pp257-260.
+
+ random = self.random
+ while 1:
+ u1 = random()
+ u2 = 1.0 - random()
+ z = NV_MAGICCONST*(u1-0.5)/u2
+ zz = z*z/4.0
+ if zz <= -_log(u2):
+ break
+ return mu + z*sigma
+
+## -------------------- lognormal distribution --------------------
+
+ def lognormvariate(self, mu, sigma):
+ """Log normal distribution.
+
+ If you take the natural logarithm of this distribution, you'll get a
+ normal distribution with mean mu and standard deviation sigma.
+ mu can have any value, and sigma must be greater than zero.
+
+ """
+ return _exp(self.normalvariate(mu, sigma))
+
+## -------------------- exponential distribution --------------------
+
+ def expovariate(self, lambd):
+ """Exponential distribution.
+
+ lambd is 1.0 divided by the desired mean. It should be
+ nonzero. (The parameter would be called "lambda", but that is
+ a reserved word in Python.) Returned values range from 0 to
+ positive infinity if lambd is positive, and from negative
+ infinity to 0 if lambd is negative.
+
+ """
+ # lambd: rate lambd = 1/mean
+ # ('lambda' is a Python reserved word)
+
+ # we use 1-random() instead of random() to preclude the
+ # possibility of taking the log of zero.
+ return -_log(1.0 - self.random())/lambd
+
+## -------------------- von Mises distribution --------------------
+
+ def vonmisesvariate(self, mu, kappa):
+ """Circular data distribution.
+
+ mu is the mean angle, expressed in radians between 0 and 2*pi, and
+ kappa is the concentration parameter, which must be greater than or
+ equal to zero. If kappa is equal to zero, this distribution reduces
+ to a uniform random angle over the range 0 to 2*pi.
+
+ """
+ # mu: mean angle (in radians between 0 and 2*pi)
+ # kappa: concentration parameter kappa (>= 0)
+ # if kappa = 0 generate uniform random angle
+
+ # Based upon an algorithm published in: Fisher, N.I.,
+ # "Statistical Analysis of Circular Data", Cambridge
+ # University Press, 1993.
+
+ # Thanks to Magnus Kessler for a correction to the
+ # implementation of step 4.
+
+ random = self.random
+ if kappa <= 1e-6:
+ return TWOPI * random()
+
+ s = 0.5 / kappa
+ r = s + _sqrt(1.0 + s * s)
+
+ while 1:
+ u1 = random()
+ z = _cos(_pi * u1)
+
+ d = z / (r + z)
+ u2 = random()
+ if u2 < 1.0 - d * d or u2 <= (1.0 - d) * _exp(d):
+ break
+
+ q = 1.0 / r
+ f = (q + z) / (1.0 + q * z)
+ u3 = random()
+ if u3 > 0.5:
+ theta = (mu + _acos(f)) % TWOPI
+ else:
+ theta = (mu - _acos(f)) % TWOPI
+
+ return theta
+
+## -------------------- gamma distribution --------------------
+
+ def gammavariate(self, alpha, beta):
+ """Gamma distribution. Not the gamma function!
+
+ Conditions on the parameters are alpha > 0 and beta > 0.
+
+ The probability distribution function is:
+
+ x ** (alpha - 1) * math.exp(-x / beta)
+ pdf(x) = --------------------------------------
+ math.gamma(alpha) * beta ** alpha
+
+ """
+
+ # alpha > 0, beta > 0, mean is alpha*beta, variance is alpha*beta**2
+
+ # Warning: a few older sources define the gamma distribution in terms
+ # of alpha > -1.0
+ if alpha <= 0.0 or beta <= 0.0:
+ raise ValueError, 'gammavariate: alpha and beta must be > 0.0'
+
+ random = self.random
+ if alpha > 1.0:
+
+ # Uses R.C.H. Cheng, "The generation of Gamma
+ # variables with non-integral shape parameters",
+ # Applied Statistics, (1977), 26, No. 1, p71-74
+
+ ainv = _sqrt(2.0 * alpha - 1.0)
+ bbb = alpha - LOG4
+ ccc = alpha + ainv
+
+ while 1:
+ u1 = random()
+ if not 1e-7 < u1 < .9999999:
+ continue
+ u2 = 1.0 - random()
+ v = _log(u1/(1.0-u1))/ainv
+ x = alpha*_exp(v)
+ z = u1*u1*u2
+ r = bbb+ccc*v-x
+ if r + SG_MAGICCONST - 4.5*z >= 0.0 or r >= _log(z):
+ return x * beta
+
+ elif alpha == 1.0:
+ # expovariate(1)
+ u = random()
+ while u <= 1e-7:
+ u = random()
+ return -_log(u) * beta
+
+ else: # alpha is between 0 and 1 (exclusive)
+
+ # Uses ALGORITHM GS of Statistical Computing - Kennedy & Gentle
+
+ while 1:
+ u = random()
+ b = (_e + alpha)/_e
+ p = b*u
+ if p <= 1.0:
+ x = p ** (1.0/alpha)
+ else:
+ x = -_log((b-p)/alpha)
+ u1 = random()
+ if p > 1.0:
+ if u1 <= x ** (alpha - 1.0):
+ break
+ elif u1 <= _exp(-x):
+ break
+ return x * beta
+
+## -------------------- Gauss (faster alternative) --------------------
+
+ def gauss(self, mu, sigma):
+ """Gaussian distribution.
+
+ mu is the mean, and sigma is the standard deviation. This is
+ slightly faster than the normalvariate() function.
+
+ Not thread-safe without a lock around calls.
+
+ """
+
+ # When x and y are two variables from [0, 1), uniformly
+ # distributed, then
+ #
+ # cos(2*pi*x)*sqrt(-2*log(1-y))
+ # sin(2*pi*x)*sqrt(-2*log(1-y))
+ #
+ # are two *independent* variables with normal distribution
+ # (mu = 0, sigma = 1).
+ # (Lambert Meertens)
+ # (corrected version; bug discovered by Mike Miller, fixed by LM)
+
+ # Multithreading note: When two threads call this function
+ # simultaneously, it is possible that they will receive the
+ # same return value. The window is very small though. To
+ # avoid this, you have to use a lock around all calls. (I
+ # didn't want to slow this down in the serial case by using a
+ # lock here.)
+
+ random = self.random
+ z = self.gauss_next
+ self.gauss_next = None
+ if z is None:
+ x2pi = random() * TWOPI
+ g2rad = _sqrt(-2.0 * _log(1.0 - random()))
+ z = _cos(x2pi) * g2rad
+ self.gauss_next = _sin(x2pi) * g2rad
+
+ return mu + z*sigma
+
+## -------------------- beta --------------------
+## See
+## http://mail.python.org/pipermail/python-bugs-list/2001-January/003752.html
+## for Ivan Frohne's insightful analysis of why the original implementation:
+##
+## def betavariate(self, alpha, beta):
+## # Discrete Event Simulation in C, pp 87-88.
+##
+## y = self.expovariate(alpha)
+## z = self.expovariate(1.0/beta)
+## return z/(y+z)
+##
+## was dead wrong, and how it probably got that way.
+
+ def betavariate(self, alpha, beta):
+ """Beta distribution.
+
+ Conditions on the parameters are alpha > 0 and beta > 0.
+ Returned values range between 0 and 1.
+
+ """
+
+ # This version due to Janne Sinkkonen, and matches all the std
+ # texts (e.g., Knuth Vol 2 Ed 3 pg 134 "the beta distribution").
+ y = self.gammavariate(alpha, 1.)
+ if y == 0:
+ return 0.0
+ else:
+ return y / (y + self.gammavariate(beta, 1.))
+
+## -------------------- Pareto --------------------
+
+ def paretovariate(self, alpha):
+ """Pareto distribution. alpha is the shape parameter."""
+ # Jain, pg. 495
+
+ u = 1.0 - self.random()
+ return 1.0 / pow(u, 1.0/alpha)
+
+## -------------------- Weibull --------------------
+
+ def weibullvariate(self, alpha, beta):
+ """Weibull distribution.
+
+ alpha is the scale parameter and beta is the shape parameter.
+
+ """
+ # Jain, pg. 499; bug fix courtesy Bill Arms
+
+ u = 1.0 - self.random()
+ return alpha * pow(-_log(u), 1.0/beta)
+
+## -------------------- Wichmann-Hill -------------------
+
+class WichmannHill(Random):
+
+ VERSION = 1 # used by getstate/setstate
+
+ def seed(self, a=None):
+ """Initialize internal state from hashable object.
+
+ None or no argument seeds from current time or from an operating
+ system specific randomness source if available.
+
+ If a is not None or an int or long, hash(a) is used instead.
+
+ If a is an int or long, a is used directly. Distinct values between
+ 0 and 27814431486575L inclusive are guaranteed to yield distinct
+ internal states (this guarantee is specific to the default
+ Wichmann-Hill generator).
+ """
+
+ if a is None:
+ try:
+ a = long(_hexlify(_urandom(16)), 16)
+ except NotImplementedError:
+ import time
+ a = long(time.time() * 256) # use fractional seconds
+
+ if not isinstance(a, (int, long)):
+ a = hash(a)
+
+ a, x = divmod(a, 30268)
+ a, y = divmod(a, 30306)
+ a, z = divmod(a, 30322)
+ self._seed = int(x)+1, int(y)+1, int(z)+1
+
+ self.gauss_next = None
+
+ def random(self):
+ """Get the next random number in the range [0.0, 1.0)."""
+
+ # Wichman-Hill random number generator.
+ #
+ # Wichmann, B. A. & Hill, I. D. (1982)
+ # Algorithm AS 183:
+ # An efficient and portable pseudo-random number generator
+ # Applied Statistics 31 (1982) 188-190
+ #
+ # see also:
+ # Correction to Algorithm AS 183
+ # Applied Statistics 33 (1984) 123
+ #
+ # McLeod, A. I. (1985)
+ # A remark on Algorithm AS 183
+ # Applied Statistics 34 (1985),198-200
+
+ # This part is thread-unsafe:
+ # BEGIN CRITICAL SECTION
+ x, y, z = self._seed
+ x = (171 * x) % 30269
+ y = (172 * y) % 30307
+ z = (170 * z) % 30323
+ self._seed = x, y, z
+ # END CRITICAL SECTION
+
+ # Note: on a platform using IEEE-754 double arithmetic, this can
+ # never return 0.0 (asserted by Tim; proof too long for a comment).
+ return (x/30269.0 + y/30307.0 + z/30323.0) % 1.0
+
+ def getstate(self):
+ """Return internal state; can be passed to setstate() later."""
+ return self.VERSION, self._seed, self.gauss_next
+
+ def setstate(self, state):
+ """Restore internal state from object returned by getstate()."""
+ version = state[0]
+ if version == 1:
+ version, self._seed, self.gauss_next = state
+ else:
+ raise ValueError("state with version %s passed to "
+ "Random.setstate() of version %s" %
+ (version, self.VERSION))
+
+ def jumpahead(self, n):
+ """Act as if n calls to random() were made, but quickly.
+
+ n is an int, greater than or equal to 0.
+
+ Example use: If you have 2 threads and know that each will
+ consume no more than a million random numbers, create two Random
+ objects r1 and r2, then do
+ r2.setstate(r1.getstate())
+ r2.jumpahead(1000000)
+ Then r1 and r2 will use guaranteed-disjoint segments of the full
+ period.
+ """
+
+ if not n >= 0:
+ raise ValueError("n must be >= 0")
+ x, y, z = self._seed
+ x = int(x * pow(171, n, 30269)) % 30269
+ y = int(y * pow(172, n, 30307)) % 30307
+ z = int(z * pow(170, n, 30323)) % 30323
+ self._seed = x, y, z
+
+ def __whseed(self, x=0, y=0, z=0):
+ """Set the Wichmann-Hill seed from (x, y, z).
+
+ These must be integers in the range [0, 256).
+ """
+
+ if not type(x) == type(y) == type(z) == int:
+ raise TypeError('seeds must be integers')
+ if not (0 <= x < 256 and 0 <= y < 256 and 0 <= z < 256):
+ raise ValueError('seeds must be in range(0, 256)')
+ if 0 == x == y == z:
+ # Initialize from current time
+ import time
+ t = long(time.time() * 256)
+ t = int((t&0xffffff) ^ (t>>24))
+ t, x = divmod(t, 256)
+ t, y = divmod(t, 256)
+ t, z = divmod(t, 256)
+ # Zero is a poor seed, so substitute 1
+ self._seed = (x or 1, y or 1, z or 1)
+
+ self.gauss_next = None
+
+ def whseed(self, a=None):
+ """Seed from hashable object's hash code.
+
+ None or no argument seeds from current time. It is not guaranteed
+ that objects with distinct hash codes lead to distinct internal
+ states.
+
+ This is obsolete, provided for compatibility with the seed routine
+ used prior to Python 2.1. Use the .seed() method instead.
+ """
+
+ if a is None:
+ self.__whseed()
+ return
+ a = hash(a)
+ a, x = divmod(a, 256)
+ a, y = divmod(a, 256)
+ a, z = divmod(a, 256)
+ x = (x + a) % 256 or 1
+ y = (y + a) % 256 or 1
+ z = (z + a) % 256 or 1
+ self.__whseed(x, y, z)
+
+## --------------- Operating System Random Source ------------------
+
+class SystemRandom(Random):
+ """Alternate random number generator using sources provided
+ by the operating system (such as /dev/urandom on Unix or
+ CryptGenRandom on Windows).
+
+ Not available on all systems (see os.urandom() for details).
+ """
+
+ def random(self):
+ """Get the next random number in the range [0.0, 1.0)."""
+ return (long(_hexlify(_urandom(7)), 16) >> 3) * RECIP_BPF
+
+ def getrandbits(self, k):
+ """getrandbits(k) -> x. Generates a long int with k random bits."""
+ if k <= 0:
+ raise ValueError('number of bits must be greater than zero')
+ if k != int(k):
+ raise TypeError('number of bits should be an integer')
+ bytes = (k + 7) // 8 # bits / 8 and rounded up
+ x = long(_hexlify(_urandom(bytes)), 16)
+ return x >> (bytes * 8 - k) # trim excess bits
+
+ def _stub(self, *args, **kwds):
+ "Stub method. Not used for a system random number generator."
+ return None
+ seed = jumpahead = _stub
+
+ def _notimplemented(self, *args, **kwds):
+ "Method should not be called for a system random number generator."
+ raise NotImplementedError('System entropy source does not have state.')
+ getstate = setstate = _notimplemented
+
+## -------------------- test program --------------------
+
+def _test_generator(n, func, args):
+ import time
+ print n, 'times', func.__name__
+ total = 0.0
+ sqsum = 0.0
+ smallest = 1e10
+ largest = -1e10
+ t0 = time.time()
+ for i in range(n):
+ x = func(*args)
+ total += x
+ sqsum = sqsum + x*x
+ smallest = min(x, smallest)
+ largest = max(x, largest)
+ t1 = time.time()
+ print round(t1-t0, 3), 'sec,',
+ avg = total/n
+ stddev = _sqrt(sqsum/n - avg*avg)
+ print 'avg %g, stddev %g, min %g, max %g' % \
+ (avg, stddev, smallest, largest)
+
+
+def _test(N=2000):
+ _test_generator(N, random, ())
+ _test_generator(N, normalvariate, (0.0, 1.0))
+ _test_generator(N, lognormvariate, (0.0, 1.0))
+ _test_generator(N, vonmisesvariate, (0.0, 1.0))
+ _test_generator(N, gammavariate, (0.01, 1.0))
+ _test_generator(N, gammavariate, (0.1, 1.0))
+ _test_generator(N, gammavariate, (0.1, 2.0))
+ _test_generator(N, gammavariate, (0.5, 1.0))
+ _test_generator(N, gammavariate, (0.9, 1.0))
+ _test_generator(N, gammavariate, (1.0, 1.0))
+ _test_generator(N, gammavariate, (2.0, 1.0))
+ _test_generator(N, gammavariate, (20.0, 1.0))
+ _test_generator(N, gammavariate, (200.0, 1.0))
+ _test_generator(N, gauss, (0.0, 1.0))
+ _test_generator(N, betavariate, (3.0, 3.0))
+ _test_generator(N, triangular, (0.0, 1.0, 1.0/3.0))
+
+# Create one instance, seeded from current time, and export its methods
+# as module-level functions. The functions share state across all uses
+#(both in the user's code and in the Python libraries), but that's fine
+# for most programs and is easier for the casual user than making them
+# instantiate their own Random() instance.
+
+_inst = Random()
+seed = _inst.seed
+random = _inst.random
+uniform = _inst.uniform
+triangular = _inst.triangular
+randint = _inst.randint
+choice = _inst.choice
+randrange = _inst.randrange
+sample = _inst.sample
+shuffle = _inst.shuffle
+normalvariate = _inst.normalvariate
+lognormvariate = _inst.lognormvariate
+expovariate = _inst.expovariate
+vonmisesvariate = _inst.vonmisesvariate
+gammavariate = _inst.gammavariate
+gauss = _inst.gauss
+betavariate = _inst.betavariate
+paretovariate = _inst.paretovariate
+weibullvariate = _inst.weibullvariate
+getstate = _inst.getstate
+setstate = _inst.setstate
+jumpahead = _inst.jumpahead
+getrandbits = _inst.getrandbits
+
+if __name__ == '__main__':
+ _test()
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
index 0000000000..6620d33265
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/re.py
@@ -0,0 +1,340 @@
+#
+# Secret Labs' Regular Expression Engine
+#
+# re-compatible interface for the sre matching engine
+#
+# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
+#
+# This version of the SRE library can be redistributed under CNRI's
+# Python 1.6 license. For any other use, please contact Secret Labs
+# AB (info@pythonware.com).
+#
+# Portions of this engine have been developed in cooperation with
+# CNRI. Hewlett-Packard provided funding for 1.6 integration and
+# other compatibility work.
+#
+
+r"""Support for regular expressions (RE).
+
+This module provides regular expression matching operations similar to
+those found in Perl. It supports both 8-bit and Unicode strings; both
+the pattern and the strings being processed can contain null bytes and
+characters outside the US ASCII range.
+
+Regular expressions can contain both special and ordinary characters.
+Most ordinary characters, like "A", "a", or "0", are the simplest
+regular expressions; they simply match themselves. You can
+concatenate ordinary characters, so last matches the string 'last'.
+
+The special characters are:
+ "." Matches any character except a newline.
+ "^" Matches the start of the string.
+ "$" Matches the end of the string or just before the newline at
+ the end of the string.
+ "*" Matches 0 or more (greedy) repetitions of the preceding RE.
+ Greedy means that it will match as many repetitions as possible.
+ "+" Matches 1 or more (greedy) repetitions of the preceding RE.
+ "?" Matches 0 or 1 (greedy) of the preceding RE.
+ *?,+?,?? Non-greedy versions of the previous three special characters.
+ {m,n} Matches from m to n repetitions of the preceding RE.
+ {m,n}? Non-greedy version of the above.
+ "\\" Either escapes special characters or signals a special sequence.
+ [] Indicates a set of characters.
+ A "^" as the first character indicates a complementing set.
+ "|" A|B, creates an RE that will match either A or B.
+ (...) Matches the RE inside the parentheses.
+ The contents can be retrieved or matched later in the string.
+ (?iLmsux) Set the I, L, M, S, U, or X flag for the RE (see below).
+ (?:...) Non-grouping version of regular parentheses.
+ (?P<name>...) The substring matched by the group is accessible by name.
+ (?P=name) Matches the text matched earlier by the group named name.
+ (?#...) A comment; ignored.
+ (?=...) Matches if ... matches next, but doesn't consume the string.
+ (?!...) Matches if ... doesn't match next.
+ (?<=...) Matches if preceded by ... (must be fixed length).
+ (?<!...) Matches if not preceded by ... (must be fixed length).
+ (?(id/name)yes|no) Matches yes pattern if the group with id/name matched,
+ the (optional) no pattern otherwise.
+
+The special sequences consist of "\\" and a character from the list
+below. If the ordinary character is not on the list, then the
+resulting RE will match the second character.
+ \number Matches the contents of the group of the same number.
+ \A Matches only at the start of the string.
+ \Z Matches only at the end of the string.
+ \b Matches the empty string, but only at the start or end of a word.
+ \B Matches the empty string, but not at the start or end of a word.
+ \d Matches any decimal digit; equivalent to the set [0-9].
+ \D Matches any non-digit character; equivalent to the set [^0-9].
+ \s Matches any whitespace character; equivalent to [ \t\n\r\f\v].
+ \S Matches any non-whitespace character; equiv. to [^ \t\n\r\f\v].
+ \w Matches any alphanumeric character; equivalent to [a-zA-Z0-9_].
+ With LOCALE, it will match the set [0-9_] plus characters defined
+ as letters for the current locale.
+ \W Matches the complement of \w.
+ \\ Matches a literal backslash.
+
+This module exports the following functions:
+ match Match a regular expression pattern to the beginning of a string.
+ search Search a string for the presence of a pattern.
+ sub Substitute occurrences of a pattern found in a string.
+ subn Same as sub, but also return the number of substitutions made.
+ split Split a string by the occurrences of a pattern.
+ findall Find all occurrences of a pattern in a string.
+ finditer Return an iterator yielding a match object for each match.
+ compile Compile a pattern into a RegexObject.
+ purge Clear the regular expression cache.
+ escape Backslash all non-alphanumerics in a string.
+
+Some of the functions in this module takes flags as optional parameters:
+ I IGNORECASE Perform case-insensitive matching.
+ L LOCALE Make \w, \W, \b, \B, dependent on the current locale.
+ M MULTILINE "^" matches the beginning of lines (after a newline)
+ as well as the string.
+ "$" matches the end of lines (before a newline) as well
+ as the end of the string.
+ S DOTALL "." matches any character at all, including the newline.
+ X VERBOSE Ignore whitespace and comments for nicer looking RE's.
+ U UNICODE Make \w, \W, \b, \B, dependent on the Unicode locale.
+
+This module also defines an exception 'error'.
+
+"""
+
+import sys
+import sre_compile
+import sre_parse
+try:
+ import _locale
+except ImportError:
+ _locale = None
+
+# public symbols
+__all__ = [ "match", "search", "sub", "subn", "split", "findall",
+ "compile", "purge", "template", "escape", "I", "L", "M", "S", "X",
+ "U", "IGNORECASE", "LOCALE", "MULTILINE", "DOTALL", "VERBOSE",
+ "UNICODE", "error" ]
+
+__version__ = "2.2.1"
+
+# flags
+I = IGNORECASE = sre_compile.SRE_FLAG_IGNORECASE # ignore case
+L = LOCALE = sre_compile.SRE_FLAG_LOCALE # assume current 8-bit locale
+U = UNICODE = sre_compile.SRE_FLAG_UNICODE # assume unicode locale
+M = MULTILINE = sre_compile.SRE_FLAG_MULTILINE # make anchors look for newline
+S = DOTALL = sre_compile.SRE_FLAG_DOTALL # make dot match newline
+X = VERBOSE = sre_compile.SRE_FLAG_VERBOSE # ignore whitespace and comments
+
+# sre extensions (experimental, don't rely on these)
+T = TEMPLATE = sre_compile.SRE_FLAG_TEMPLATE # disable backtracking
+DEBUG = sre_compile.SRE_FLAG_DEBUG # dump pattern after compilation
+
+# sre exception
+error = sre_compile.error
+
+# --------------------------------------------------------------------
+# public interface
+
+def match(pattern, string, flags=0):
+ """Try to apply the pattern at the start of the string, returning
+ a match object, or None if no match was found."""
+ return _compile(pattern, flags).match(string)
+
+def search(pattern, string, flags=0):
+ """Scan through string looking for a match to the pattern, returning
+ a match object, or None if no match was found."""
+ return _compile(pattern, flags).search(string)
+
+def sub(pattern, repl, string, count=0, flags=0):
+ """Return the string obtained by replacing the leftmost
+ non-overlapping occurrences of the pattern in string by the
+ replacement repl. repl can be either a string or a callable;
+ if a string, backslash escapes in it are processed. If it is
+ a callable, it's passed the match object and must return
+ a replacement string to be used."""
+ return _compile(pattern, flags).sub(repl, string, count)
+
+def subn(pattern, repl, string, count=0, flags=0):
+ """Return a 2-tuple containing (new_string, number).
+ new_string is the string obtained by replacing the leftmost
+ non-overlapping occurrences of the pattern in the source
+ string by the replacement repl. number is the number of
+ substitutions that were made. repl can be either a string or a
+ callable; if a string, backslash escapes in it are processed.
+ If it is a callable, it's passed the match object and must
+ return a replacement string to be used."""
+ return _compile(pattern, flags).subn(repl, string, count)
+
+def split(pattern, string, maxsplit=0, flags=0):
+ """Split the source string by the occurrences of the pattern,
+ returning a list containing the resulting substrings."""
+ return _compile(pattern, flags).split(string, maxsplit)
+
+def findall(pattern, string, flags=0):
+ """Return a list of all non-overlapping matches in the string.
+
+ If one or more groups are present in the pattern, return a
+ list of groups; this will be a list of tuples if the pattern
+ has more than one group.
+
+ Empty matches are included in the result."""
+ return _compile(pattern, flags).findall(string)
+
+if sys.hexversion >= 0x02020000:
+ __all__.append("finditer")
+ def finditer(pattern, string, flags=0):
+ """Return an iterator over all non-overlapping matches in the
+ string. For each match, the iterator returns a match object.
+
+ Empty matches are included in the result."""
+ return _compile(pattern, flags).finditer(string)
+
+def compile(pattern, flags=0):
+ "Compile a regular expression pattern, returning a pattern object."
+ return _compile(pattern, flags)
+
+def purge():
+ "Clear the regular expression cache"
+ _cache.clear()
+ _cache_repl.clear()
+
+def template(pattern, flags=0):
+ "Compile a template pattern, returning a pattern object"
+ return _compile(pattern, flags|T)
+
+_alphanum = frozenset(
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
+
+def escape(pattern):
+ "Escape all non-alphanumeric characters in pattern."
+ s = list(pattern)
+ alphanum = _alphanum
+ for i, c in enumerate(pattern):
+ if c not in alphanum:
+ if c == "\000":
+ s[i] = "\\000"
+ else:
+ s[i] = "\\" + c
+ return pattern[:0].join(s)
+
+# --------------------------------------------------------------------
+# internals
+
+_cache = {}
+_cache_repl = {}
+
+_pattern_type = type(sre_compile.compile("", 0))
+
+_MAXCACHE = 100
+
+def _compile(*key):
+ # internal: compile pattern
+ pattern, flags = key
+ bypass_cache = flags & DEBUG
+ if not bypass_cache:
+ cachekey = (type(key[0]),) + key
+ try:
+ p, loc = _cache[cachekey]
+ if loc is None or loc == _locale.setlocale(_locale.LC_CTYPE):
+ return p
+ except KeyError:
+ pass
+ if isinstance(pattern, _pattern_type):
+ if flags:
+ raise ValueError('Cannot process flags argument with a compiled pattern')
+ return pattern
+ if not sre_compile.isstring(pattern):
+ raise TypeError, "first argument must be string or compiled pattern"
+ try:
+ p = sre_compile.compile(pattern, flags)
+ except error, v:
+ raise error, v # invalid expression
+ if not bypass_cache:
+ if len(_cache) >= _MAXCACHE:
+ _cache.clear()
+ if p.flags & LOCALE:
+ if not _locale:
+ return p
+ loc = _locale.setlocale(_locale.LC_CTYPE)
+ else:
+ loc = None
+ _cache[cachekey] = p, loc
+ return p
+
+def _compile_repl(*key):
+ # internal: compile replacement pattern
+ p = _cache_repl.get(key)
+ if p is not None:
+ return p
+ repl, pattern = key
+ try:
+ p = sre_parse.parse_template(repl, pattern)
+ except error, v:
+ raise error, v # invalid expression
+ if len(_cache_repl) >= _MAXCACHE:
+ _cache_repl.clear()
+ _cache_repl[key] = p
+ return p
+
+def _expand(pattern, match, template):
+ # internal: match.expand implementation hook
+ template = sre_parse.parse_template(template, pattern)
+ return sre_parse.expand_template(template, match)
+
+def _subx(pattern, template):
+ # internal: pattern.sub/subn implementation helper
+ template = _compile_repl(template, pattern)
+ if not template[0] and len(template[1]) == 1:
+ # literal replacement
+ return template[1][0]
+ def filter(match, template=template):
+ return sre_parse.expand_template(template, match)
+ return filter
+
+# register myself for pickling
+
+import copy_reg
+
+def _pickle(p):
+ return _compile, (p.pattern, p.flags)
+
+copy_reg.pickle(_pattern_type, _pickle, _compile)
+
+# --------------------------------------------------------------------
+# experimental stuff (see python-dev discussions for details)
+
+class Scanner:
+ def __init__(self, lexicon, flags=0):
+ from sre_constants import BRANCH, SUBPATTERN
+ self.lexicon = lexicon
+ # combine phrases into a compound pattern
+ p = []
+ s = sre_parse.Pattern()
+ s.flags = flags
+ for phrase, action in lexicon:
+ p.append(sre_parse.SubPattern(s, [
+ (SUBPATTERN, (len(p)+1, sre_parse.parse(phrase, flags))),
+ ]))
+ s.groups = len(p)+1
+ p = sre_parse.SubPattern(s, [(BRANCH, (None, p))])
+ self.scanner = sre_compile.compile(p)
+ def scan(self, string):
+ result = []
+ append = result.append
+ match = self.scanner.scanner(string).match
+ i = 0
+ while 1:
+ m = match()
+ if not m:
+ break
+ j = m.end()
+ if i == j:
+ break
+ action = self.lexicon[m.lastindex-1][1]
+ if hasattr(action, '__call__'):
+ self.match = m
+ action = action(self, m.group())
+ if action is not None:
+ append(action)
+ i = j
+ return result, string[i:]
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
index 0000000000..71a3a15afc
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/repr.py
@@ -0,0 +1,132 @@
+"""Redo the builtin repr() (representation) but with limits on most sizes."""
+
+__all__ = ["Repr","repr"]
+
+import __builtin__
+from itertools import islice
+
+class Repr:
+
+ def __init__(self):
+ self.maxlevel = 6
+ self.maxtuple = 6
+ self.maxlist = 6
+ self.maxarray = 5
+ self.maxdict = 4
+ self.maxset = 6
+ self.maxfrozenset = 6
+ self.maxdeque = 6
+ self.maxstring = 30
+ self.maxlong = 40
+ self.maxother = 20
+
+ def repr(self, x):
+ return self.repr1(x, self.maxlevel)
+
+ def repr1(self, x, level):
+ typename = type(x).__name__
+ if ' ' in typename:
+ parts = typename.split()
+ typename = '_'.join(parts)
+ if hasattr(self, 'repr_' + typename):
+ return getattr(self, 'repr_' + typename)(x, level)
+ else:
+ s = __builtin__.repr(x)
+ if len(s) > self.maxother:
+ i = max(0, (self.maxother-3)//2)
+ j = max(0, self.maxother-3-i)
+ s = s[:i] + '...' + s[len(s)-j:]
+ return s
+
+ def _repr_iterable(self, x, level, left, right, maxiter, trail=''):
+ n = len(x)
+ if level <= 0 and n:
+ s = '...'
+ else:
+ newlevel = level - 1
+ repr1 = self.repr1
+ pieces = [repr1(elem, newlevel) for elem in islice(x, maxiter)]
+ if n > maxiter: pieces.append('...')
+ s = ', '.join(pieces)
+ if n == 1 and trail: right = trail + right
+ return '%s%s%s' % (left, s, right)
+
+ def repr_tuple(self, x, level):
+ return self._repr_iterable(x, level, '(', ')', self.maxtuple, ',')
+
+ def repr_list(self, x, level):
+ return self._repr_iterable(x, level, '[', ']', self.maxlist)
+
+ def repr_array(self, x, level):
+ header = "array('%s', [" % x.typecode
+ return self._repr_iterable(x, level, header, '])', self.maxarray)
+
+ def repr_set(self, x, level):
+ x = _possibly_sorted(x)
+ return self._repr_iterable(x, level, 'set([', '])', self.maxset)
+
+ def repr_frozenset(self, x, level):
+ x = _possibly_sorted(x)
+ return self._repr_iterable(x, level, 'frozenset([', '])',
+ self.maxfrozenset)
+
+ def repr_deque(self, x, level):
+ return self._repr_iterable(x, level, 'deque([', '])', self.maxdeque)
+
+ def repr_dict(self, x, level):
+ n = len(x)
+ if n == 0: return '{}'
+ if level <= 0: return '{...}'
+ newlevel = level - 1
+ repr1 = self.repr1
+ pieces = []
+ for key in islice(_possibly_sorted(x), self.maxdict):
+ keyrepr = repr1(key, newlevel)
+ valrepr = repr1(x[key], newlevel)
+ pieces.append('%s: %s' % (keyrepr, valrepr))
+ if n > self.maxdict: pieces.append('...')
+ s = ', '.join(pieces)
+ return '{%s}' % (s,)
+
+ def repr_str(self, x, level):
+ s = __builtin__.repr(x[:self.maxstring])
+ if len(s) > self.maxstring:
+ i = max(0, (self.maxstring-3)//2)
+ j = max(0, self.maxstring-3-i)
+ s = __builtin__.repr(x[:i] + x[len(x)-j:])
+ s = s[:i] + '...' + s[len(s)-j:]
+ return s
+
+ def repr_long(self, x, level):
+ s = __builtin__.repr(x) # XXX Hope this isn't too slow...
+ if len(s) > self.maxlong:
+ i = max(0, (self.maxlong-3)//2)
+ j = max(0, self.maxlong-3-i)
+ s = s[:i] + '...' + s[len(s)-j:]
+ return s
+
+ def repr_instance(self, x, level):
+ try:
+ s = __builtin__.repr(x)
+ # Bugs in x.__repr__() can cause arbitrary
+ # exceptions -- then make up something
+ except Exception:
+ return '<%s instance at %x>' % (x.__class__.__name__, id(x))
+ if len(s) > self.maxstring:
+ i = max(0, (self.maxstring-3)//2)
+ j = max(0, self.maxstring-3-i)
+ s = s[:i] + '...' + s[len(s)-j:]
+ return s
+
+
+def _possibly_sorted(x):
+ # Since not all sequences of items can be sorted and comparison
+ # functions may raise arbitrary exceptions, return an unsorted
+ # sequence in that case.
+ try:
+ return sorted(x)
+ except Exception:
+ return list(x)
+
+aRepr = Repr()
+repr = aRepr.repr
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
index 0000000000..abbd1db7b1
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/runpy.py
@@ -0,0 +1,278 @@
+"""runpy.py - locating and running Python code using the module namespace
+
+Provides support for locating and running Python scripts using the Python
+module namespace instead of the native filesystem.
+
+This allows Python code to play nicely with non-filesystem based PEP 302
+importers when locating support scripts as well as when importing modules.
+"""
+# Written by Nick Coghlan <ncoghlan at gmail.com>
+# to implement PEP 338 (Executing Modules as Scripts)
+
+import sys
+import imp
+from pkgutil import read_code
+try:
+ from imp import get_loader
+except ImportError:
+ from pkgutil import get_loader
+
+__all__ = [
+ "run_module", "run_path",
+]
+
+class _TempModule(object):
+ """Temporarily replace a module in sys.modules with an empty namespace"""
+ def __init__(self, mod_name):
+ self.mod_name = mod_name
+ self.module = imp.new_module(mod_name)
+ self._saved_module = []
+
+ def __enter__(self):
+ mod_name = self.mod_name
+ try:
+ self._saved_module.append(sys.modules[mod_name])
+ except KeyError:
+ pass
+ sys.modules[mod_name] = self.module
+ return self
+
+ def __exit__(self, *args):
+ if self._saved_module:
+ sys.modules[self.mod_name] = self._saved_module[0]
+ else:
+ del sys.modules[self.mod_name]
+ self._saved_module = []
+
+class _ModifiedArgv0(object):
+ def __init__(self, value):
+ self.value = value
+ self._saved_value = self._sentinel = object()
+
+ def __enter__(self):
+ if self._saved_value is not self._sentinel:
+ raise RuntimeError("Already preserving saved value")
+ self._saved_value = sys.argv[0]
+ sys.argv[0] = self.value
+
+ def __exit__(self, *args):
+ self.value = self._sentinel
+ sys.argv[0] = self._saved_value
+
+def _run_code(code, run_globals, init_globals=None,
+ mod_name=None, mod_fname=None,
+ mod_loader=None, pkg_name=None):
+ """Helper to run code in nominated namespace"""
+ if init_globals is not None:
+ run_globals.update(init_globals)
+ run_globals.update(__name__ = mod_name,
+ __file__ = mod_fname,
+ __loader__ = mod_loader,
+ __package__ = pkg_name)
+ exec code in run_globals
+ return run_globals
+
+def _run_module_code(code, init_globals=None,
+ mod_name=None, mod_fname=None,
+ mod_loader=None, pkg_name=None):
+ """Helper to run code in new namespace with sys modified"""
+ with _TempModule(mod_name) as temp_module, _ModifiedArgv0(mod_fname):
+ mod_globals = temp_module.module.__dict__
+ _run_code(code, mod_globals, init_globals,
+ mod_name, mod_fname, mod_loader, pkg_name)
+ # Copy the globals of the temporary module, as they
+ # may be cleared when the temporary module goes away
+ return mod_globals.copy()
+
+
+# This helper is needed due to a missing component in the PEP 302
+# loader protocol (specifically, "get_filename" is non-standard)
+# Since we can't introduce new features in maintenance releases,
+# support was added to zipimporter under the name '_get_filename'
+def _get_filename(loader, mod_name):
+ for attr in ("get_filename", "_get_filename"):
+ meth = getattr(loader, attr, None)
+ if meth is not None:
+ return meth(mod_name)
+ return None
+
+# Helper to get the loader, code and filename for a module
+def _get_module_details(mod_name):
+ loader = get_loader(mod_name)
+ if loader is None:
+ raise ImportError("No module named %s" % mod_name)
+ if loader.is_package(mod_name):
+ if mod_name == "__main__" or mod_name.endswith(".__main__"):
+ raise ImportError("Cannot use package as __main__ module")
+ try:
+ pkg_main_name = mod_name + ".__main__"
+ return _get_module_details(pkg_main_name)
+ except ImportError, e:
+ raise ImportError(("%s; %r is a package and cannot " +
+ "be directly executed") %(e, mod_name))
+ code = loader.get_code(mod_name)
+ if code is None:
+ raise ImportError("No code object available for %s" % mod_name)
+ filename = _get_filename(loader, mod_name)
+ return mod_name, loader, code, filename
+
+
+def _get_main_module_details():
+ # Helper that gives a nicer error message when attempting to
+ # execute a zipfile or directory by invoking __main__.py
+ main_name = "__main__"
+ try:
+ return _get_module_details(main_name)
+ except ImportError as exc:
+ if main_name in str(exc):
+ raise ImportError("can't find %r module in %r" %
+ (main_name, sys.path[0]))
+ raise
+
+# This function is the actual implementation of the -m switch and direct
+# execution of zipfiles and directories and is deliberately kept private.
+# This avoids a repeat of the situation where run_module() no longer met the
+# needs of mainmodule.c, but couldn't be changed because it was public
+def _run_module_as_main(mod_name, alter_argv=True):
+ """Runs the designated module in the __main__ namespace
+
+ Note that the executed module will have full access to the
+ __main__ namespace. If this is not desirable, the run_module()
+ function should be used to run the module code in a fresh namespace.
+
+ At the very least, these variables in __main__ will be overwritten:
+ __name__
+ __file__
+ __loader__
+ __package__
+ """
+ try:
+ if alter_argv or mod_name != "__main__": # i.e. -m switch
+ mod_name, loader, code, fname = _get_module_details(mod_name)
+ else: # i.e. directory or zipfile execution
+ mod_name, loader, code, fname = _get_main_module_details()
+ except ImportError as exc:
+ msg = "%s: %s" % (sys.executable, str(exc))
+ sys.exit(msg)
+ pkg_name = mod_name.rpartition('.')[0]
+ main_globals = sys.modules["__main__"].__dict__
+ if alter_argv:
+ sys.argv[0] = fname
+ return _run_code(code, main_globals, None,
+ "__main__", fname, loader, pkg_name)
+
+def run_module(mod_name, init_globals=None,
+ run_name=None, alter_sys=False):
+ """Execute a module's code without importing it
+
+ Returns the resulting top level namespace dictionary
+ """
+ mod_name, loader, code, fname = _get_module_details(mod_name)
+ if run_name is None:
+ run_name = mod_name
+ pkg_name = mod_name.rpartition('.')[0]
+ if alter_sys:
+ return _run_module_code(code, init_globals, run_name,
+ fname, loader, pkg_name)
+ else:
+ # Leave the sys module alone
+ return _run_code(code, {}, init_globals, run_name,
+ fname, loader, pkg_name)
+
+
+# XXX (ncoghlan): Perhaps expose the C API function
+# as imp.get_importer instead of reimplementing it in Python?
+def _get_importer(path_name):
+ """Python version of PyImport_GetImporter C API function"""
+ cache = sys.path_importer_cache
+ try:
+ importer = cache[path_name]
+ except KeyError:
+ # Not yet cached. Flag as using the
+ # standard machinery until we finish
+ # checking the hooks
+ cache[path_name] = None
+ for hook in sys.path_hooks:
+ try:
+ importer = hook(path_name)
+ break
+ except ImportError:
+ pass
+ else:
+ # The following check looks a bit odd. The trick is that
+ # NullImporter raises ImportError if the supplied path is a
+ # *valid* directory entry (and hence able to be handled
+ # by the standard import machinery)
+ try:
+ importer = imp.NullImporter(path_name)
+ except ImportError:
+ return None
+ cache[path_name] = importer
+ return importer
+
+def _get_code_from_file(fname):
+ # Check for a compiled file first
+ with open(fname, "rb") as f:
+ code = read_code(f)
+ if code is None:
+ # That didn't work, so try it as normal source code
+ with open(fname, "rU") as f:
+ code = compile(f.read(), fname, 'exec')
+ return code
+
+def run_path(path_name, init_globals=None, run_name=None):
+ """Execute code located at the specified filesystem location
+
+ Returns the resulting top level namespace dictionary
+
+ The file path may refer directly to a Python script (i.e.
+ one that could be directly executed with execfile) or else
+ it may refer to a zipfile or directory containing a top
+ level __main__.py script.
+ """
+ if run_name is None:
+ run_name = "<run_path>"
+ importer = _get_importer(path_name)
+ if isinstance(importer, imp.NullImporter):
+ # Not a valid sys.path entry, so run the code directly
+ # execfile() doesn't help as we want to allow compiled files
+ code = _get_code_from_file(path_name)
+ return _run_module_code(code, init_globals, run_name, path_name)
+ else:
+ # Importer is defined for path, so add it to
+ # the start of sys.path
+ sys.path.insert(0, path_name)
+ try:
+ # Here's where things are a little different from the run_module
+ # case. There, we only had to replace the module in sys while the
+ # code was running and doing so was somewhat optional. Here, we
+ # have no choice and we have to remove it even while we read the
+ # code. If we don't do this, a __loader__ attribute in the
+ # existing __main__ module may prevent location of the new module.
+ main_name = "__main__"
+ saved_main = sys.modules[main_name]
+ del sys.modules[main_name]
+ try:
+ mod_name, loader, code, fname = _get_main_module_details()
+ finally:
+ sys.modules[main_name] = saved_main
+ pkg_name = ""
+ with _TempModule(run_name) as temp_module, \
+ _ModifiedArgv0(path_name):
+ mod_globals = temp_module.module.__dict__
+ return _run_code(code, mod_globals, init_globals,
+ run_name, fname, loader, pkg_name).copy()
+ finally:
+ try:
+ sys.path.remove(path_name)
+ except ValueError:
+ pass
+
+
+if __name__ == "__main__":
+ # Run the module specified as the next command line argument
+ if len(sys.argv) < 2:
+ print >> sys.stderr, "No module specified for execution"
+ else:
+ del sys.argv[0] # Make the requested module sys.argv[0]
+ _run_module_as_main(sys.argv[0])
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
index 0000000000..93a17bcc1e
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/sha.py
@@ -0,0 +1,15 @@
+# $Id$
+#
+# Copyright (C) 2005 Gregory P. Smith (greg@krypto.org)
+# Licensed to PSF under a Contributor Agreement.
+
+import warnings
+warnings.warn("the sha module is deprecated; use the hashlib module instead",
+ DeprecationWarning, 2)
+
+from hashlib import sha1 as sha
+new = sha
+
+blocksize = 1 # legacy value (wrong in any useful sense)
+digest_size = 20
+digestsize = 20
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
index 0000000000..539c5b9d0a
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/shutil.py
@@ -0,0 +1,555 @@
+"""Utility functions for copying and archiving files and directory trees.
+
+XXX The functions here don't copy the resource fork or other metadata on Mac.
+
+"""
+
+import os
+import sys
+import stat
+from os.path import abspath
+import fnmatch
+import collections
+import errno
+
+try:
+ from pwd import getpwnam
+except ImportError:
+ getpwnam = None
+
+try:
+ from grp import getgrnam
+except ImportError:
+ getgrnam = None
+
+__all__ = ["copyfileobj", "copyfile", "copymode", "copystat", "copy", "copy2",
+ "copytree", "move", "rmtree", "Error", "SpecialFileError",
+ "ExecError", "make_archive", "get_archive_formats",
+ "register_archive_format", "unregister_archive_format",
+ "ignore_patterns"]
+
+class Error(EnvironmentError):
+ pass
+
+class SpecialFileError(EnvironmentError):
+ """Raised when trying to do a kind of operation (e.g. copying) which is
+ not supported on a special file (e.g. a named pipe)"""
+
+class ExecError(EnvironmentError):
+ """Raised when a command could not be executed"""
+
+try:
+ WindowsError
+except NameError:
+ WindowsError = None
+
+def copyfileobj(fsrc, fdst, length=16*1024):
+ """copy data from file-like object fsrc to file-like object fdst"""
+ while 1:
+ buf = fsrc.read(length)
+ if not buf:
+ break
+ fdst.write(buf)
+
+def _samefile(src, dst):
+ # Macintosh, Unix.
+ if hasattr(os.path, 'samefile'):
+ try:
+ return os.path.samefile(src, dst)
+ except OSError:
+ return False
+
+ # All other platforms: check for same pathname.
+ return (os.path.normcase(os.path.abspath(src)) ==
+ os.path.normcase(os.path.abspath(dst)))
+
+def copyfile(src, dst):
+ """Copy data from src to dst"""
+ if _samefile(src, dst):
+ raise Error("`%s` and `%s` are the same file" % (src, dst))
+
+ for fn in [src, dst]:
+ try:
+ st = os.stat(fn)
+ except OSError:
+ # File most likely does not exist
+ pass
+ else:
+ # XXX What about other special files? (sockets, devices...)
+ if stat.S_ISFIFO(st.st_mode):
+ raise SpecialFileError("`%s` is a named pipe" % fn)
+
+ with open(src, 'rb') as fsrc:
+ with open(dst, 'wb') as fdst:
+ copyfileobj(fsrc, fdst)
+
+def copymode(src, dst):
+ """Copy mode bits from src to dst"""
+ if hasattr(os, 'chmod'):
+ st = os.stat(src)
+ mode = stat.S_IMODE(st.st_mode)
+ os.chmod(dst, mode)
+
+def copystat(src, dst):
+ """Copy all stat info (mode bits, atime, mtime, flags) from src to dst"""
+ st = os.stat(src)
+ mode = stat.S_IMODE(st.st_mode)
+ if hasattr(os, 'utime'):
+ os.utime(dst, (st.st_atime, st.st_mtime))
+ if hasattr(os, 'chmod'):
+ os.chmod(dst, mode)
+ if hasattr(os, 'chflags') and hasattr(st, 'st_flags'):
+ try:
+ os.chflags(dst, st.st_flags)
+ except OSError, why:
+ for err in 'EOPNOTSUPP', 'ENOTSUP':
+ if hasattr(errno, err) and why.errno == getattr(errno, err):
+ break
+ else:
+ raise
+
+def copy(src, dst):
+ """Copy data and mode bits ("cp src dst").
+
+ The destination may be a directory.
+
+ """
+ if os.path.isdir(dst):
+ dst = os.path.join(dst, os.path.basename(src))
+ copyfile(src, dst)
+ copymode(src, dst)
+
+def copy2(src, dst):
+ """Copy data and all stat info ("cp -p src dst").
+
+ The destination may be a directory.
+
+ """
+ if os.path.isdir(dst):
+ dst = os.path.join(dst, os.path.basename(src))
+ copyfile(src, dst)
+ copystat(src, dst)
+
+def ignore_patterns(*patterns):
+ """Function that can be used as copytree() ignore parameter.
+
+ Patterns is a sequence of glob-style patterns
+ that are used to exclude files"""
+ def _ignore_patterns(path, names):
+ ignored_names = []
+ for pattern in patterns:
+ ignored_names.extend(fnmatch.filter(names, pattern))
+ return set(ignored_names)
+ return _ignore_patterns
+
+def copytree(src, dst, symlinks=False, ignore=None):
+ """Recursively copy a directory tree using copy2().
+
+ The destination directory must not already exist.
+ If exception(s) occur, an Error is raised with a list of reasons.
+
+ If the optional symlinks flag is true, symbolic links in the
+ source tree result in symbolic links in the destination tree; if
+ it is false, the contents of the files pointed to by symbolic
+ links are copied.
+
+ The optional ignore argument is a callable. If given, it
+ is called with the `src` parameter, which is the directory
+ being visited by copytree(), and `names` which is the list of
+ `src` contents, as returned by os.listdir():
+
+ callable(src, names) -> ignored_names
+
+ Since copytree() is called recursively, the callable will be
+ called once for each directory that is copied. It returns a
+ list of names relative to the `src` directory that should
+ not be copied.
+
+ XXX Consider this example code rather than the ultimate tool.
+
+ """
+ names = os.listdir(src)
+ if ignore is not None:
+ ignored_names = ignore(src, names)
+ else:
+ ignored_names = set()
+
+ os.makedirs(dst)
+ errors = []
+ for name in names:
+ if name in ignored_names:
+ continue
+ srcname = os.path.join(src, name)
+ dstname = os.path.join(dst, name)
+ try:
+ if symlinks and os.path.islink(srcname):
+ linkto = os.readlink(srcname)
+ os.symlink(linkto, dstname)
+ elif os.path.isdir(srcname):
+ copytree(srcname, dstname, symlinks, ignore)
+ else:
+ # Will raise a SpecialFileError for unsupported file types
+ copy2(srcname, dstname)
+ # catch the Error from the recursive copytree so that we can
+ # continue with other files
+ except Error, err:
+ errors.extend(err.args[0])
+ except EnvironmentError, why:
+ errors.append((srcname, dstname, str(why)))
+ try:
+ copystat(src, dst)
+ except OSError, why:
+ if WindowsError is not None and isinstance(why, WindowsError):
+ # Copying file access times may fail on Windows
+ pass
+ else:
+ errors.append((src, dst, str(why)))
+ if errors:
+ raise Error, errors
+
+def rmtree(path, ignore_errors=False, onerror=None):
+ """Recursively delete a directory tree.
+
+ If ignore_errors is set, errors are ignored; otherwise, if onerror
+ is set, it is called to handle the error with arguments (func,
+ path, exc_info) where func is os.listdir, os.remove, or os.rmdir;
+ path is the argument to that function that caused it to fail; and
+ exc_info is a tuple returned by sys.exc_info(). If ignore_errors
+ is false and onerror is None, an exception is raised.
+
+ """
+ if ignore_errors:
+ def onerror(*args):
+ pass
+ elif onerror is None:
+ def onerror(*args):
+ raise
+ try:
+ if os.path.islink(path):
+ # symlinks to directories are forbidden, see bug #1669
+ raise OSError("Cannot call rmtree on a symbolic link")
+ except OSError:
+ onerror(os.path.islink, path, sys.exc_info())
+ # can't continue even if onerror hook returns
+ return
+ names = []
+ try:
+ names = os.listdir(path)
+ except os.error, err:
+ onerror(os.listdir, path, sys.exc_info())
+ for name in names:
+ fullname = os.path.join(path, name)
+ try:
+ mode = os.lstat(fullname).st_mode
+ except os.error:
+ mode = 0
+ if stat.S_ISDIR(mode):
+ rmtree(fullname, ignore_errors, onerror)
+ else:
+ try:
+ os.remove(fullname)
+ except os.error, err:
+ onerror(os.remove, fullname, sys.exc_info())
+ try:
+ os.rmdir(path)
+ except os.error:
+ onerror(os.rmdir, path, sys.exc_info())
+
+
+def _basename(path):
+ # A basename() variant which first strips the trailing slash, if present.
+ # Thus we always get the last component of the path, even for directories.
+ sep = os.path.sep + (os.path.altsep or '')
+ return os.path.basename(path.rstrip(sep))
+
+def move(src, dst):
+ """Recursively move a file or directory to another location. This is
+ similar to the Unix "mv" command.
+
+ If the destination is a directory or a symlink to a directory, the source
+ is moved inside the directory. The destination path must not already
+ exist.
+
+ If the destination already exists but is not a directory, it may be
+ overwritten depending on os.rename() semantics.
+
+ If the destination is on our current filesystem, then rename() is used.
+ Otherwise, src is copied to the destination and then removed.
+ A lot more could be done here... A look at a mv.c shows a lot of
+ the issues this implementation glosses over.
+
+ """
+ real_dst = dst
+ if os.path.isdir(dst):
+ if _samefile(src, dst):
+ # We might be on a case insensitive filesystem,
+ # perform the rename anyway.
+ os.rename(src, dst)
+ return
+
+ real_dst = os.path.join(dst, _basename(src))
+ if os.path.exists(real_dst):
+ raise Error, "Destination path '%s' already exists" % real_dst
+ try:
+ os.rename(src, real_dst)
+ except OSError:
+ if os.path.isdir(src):
+ if _destinsrc(src, dst):
+ raise Error, "Cannot move a directory '%s' into itself '%s'." % (src, dst)
+ copytree(src, real_dst, symlinks=True)
+ rmtree(src)
+ else:
+ copy2(src, real_dst)
+ os.unlink(src)
+
+def _destinsrc(src, dst):
+ src = abspath(src)
+ dst = abspath(dst)
+ if not src.endswith(os.path.sep):
+ src += os.path.sep
+ if not dst.endswith(os.path.sep):
+ dst += os.path.sep
+ return dst.startswith(src)
+
+def _get_gid(name):
+ """Returns a gid, given a group name."""
+ if getgrnam is None or name is None:
+ return None
+ try:
+ result = getgrnam(name)
+ except KeyError:
+ result = None
+ if result is not None:
+ return result[2]
+ return None
+
+def _get_uid(name):
+ """Returns an uid, given a user name."""
+ if getpwnam is None or name is None:
+ return None
+ try:
+ result = getpwnam(name)
+ except KeyError:
+ result = None
+ if result is not None:
+ return result[2]
+ return None
+
+def _make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0,
+ owner=None, group=None, logger=None):
+ """Create a (possibly compressed) tar file from all the files under
+ 'base_dir'.
+
+ 'compress' must be "gzip" (the default), "bzip2", or None.
+
+ 'owner' and 'group' can be used to define an owner and a group for the
+ archive that is being built. If not provided, the current owner and group
+ will be used.
+
+ The output tar file will be named 'base_name' + ".tar", possibly plus
+ the appropriate compression extension (".gz", or ".bz2").
+
+ Returns the output filename.
+ """
+ tar_compression = {'gzip': 'gz', 'bzip2': 'bz2', None: ''}
+ compress_ext = {'gzip': '.gz', 'bzip2': '.bz2'}
+
+ # flags for compression program, each element of list will be an argument
+ if compress is not None and compress not in compress_ext.keys():
+ raise ValueError, \
+ ("bad value for 'compress': must be None, 'gzip' or 'bzip2'")
+
+ archive_name = base_name + '.tar' + compress_ext.get(compress, '')
+ archive_dir = os.path.dirname(archive_name)
+
+ if archive_dir and not os.path.exists(archive_dir):
+ if logger is not None:
+ logger.info("creating %s", archive_dir)
+ if not dry_run:
+ os.makedirs(archive_dir)
+
+
+ # creating the tarball
+ import tarfile # late import so Python build itself doesn't break
+
+ if logger is not None:
+ logger.info('Creating tar archive')
+
+ uid = _get_uid(owner)
+ gid = _get_gid(group)
+
+ def _set_uid_gid(tarinfo):
+ if gid is not None:
+ tarinfo.gid = gid
+ tarinfo.gname = group
+ if uid is not None:
+ tarinfo.uid = uid
+ tarinfo.uname = owner
+ return tarinfo
+
+ if not dry_run:
+ tar = tarfile.open(archive_name, 'w|%s' % tar_compression[compress])
+ try:
+ tar.add(base_dir, filter=_set_uid_gid)
+ finally:
+ tar.close()
+
+ return archive_name
+
+def _call_external_zip(base_dir, zip_filename, verbose=False, dry_run=False):
+ # XXX see if we want to keep an external call here
+ if verbose:
+ zipoptions = "-r"
+ else:
+ zipoptions = "-rq"
+ from distutils.errors import DistutilsExecError
+ from distutils.spawn import spawn
+ try:
+ spawn(["zip", zipoptions, zip_filename, base_dir], dry_run=dry_run)
+ except DistutilsExecError:
+ # XXX really should distinguish between "couldn't find
+ # external 'zip' command" and "zip failed".
+ raise ExecError, \
+ ("unable to create zip file '%s': "
+ "could neither import the 'zipfile' module nor "
+ "find a standalone zip utility") % zip_filename
+
+def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None):
+ """Create a zip file from all the files under 'base_dir'.
+
+ The output zip file will be named 'base_name' + ".zip". Uses either the
+ "zipfile" Python module (if available) or the InfoZIP "zip" utility
+ (if installed and found on the default search path). If neither tool is
+ available, raises ExecError. Returns the name of the output zip
+ file.
+ """
+ zip_filename = base_name + ".zip"
+ archive_dir = os.path.dirname(base_name)
+
+ if archive_dir and not os.path.exists(archive_dir):
+ if logger is not None:
+ logger.info("creating %s", archive_dir)
+ if not dry_run:
+ os.makedirs(archive_dir)
+
+ # If zipfile module is not available, try spawning an external 'zip'
+ # command.
+ try:
+ import zipfile
+ except ImportError:
+ zipfile = None
+
+ if zipfile is None:
+ _call_external_zip(base_dir, zip_filename, verbose, dry_run)
+ else:
+ if logger is not None:
+ logger.info("creating '%s' and adding '%s' to it",
+ zip_filename, base_dir)
+
+ if not dry_run:
+ with zipfile.ZipFile(zip_filename, "w",
+ compression=zipfile.ZIP_DEFLATED) as zf:
+ for dirpath, dirnames, filenames in os.walk(base_dir):
+ for name in filenames:
+ path = os.path.normpath(os.path.join(dirpath, name))
+ if os.path.isfile(path):
+ zf.write(path, path)
+ if logger is not None:
+ logger.info("adding '%s'", path)
+
+ return zip_filename
+
+_ARCHIVE_FORMATS = {
+ 'gztar': (_make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"),
+ 'bztar': (_make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"),
+ 'tar': (_make_tarball, [('compress', None)], "uncompressed tar file"),
+ 'zip': (_make_zipfile, [],"ZIP file")
+ }
+
+def get_archive_formats():
+ """Returns a list of supported formats for archiving and unarchiving.
+
+ Each element of the returned sequence is a tuple (name, description)
+ """
+ formats = [(name, registry[2]) for name, registry in
+ _ARCHIVE_FORMATS.items()]
+ formats.sort()
+ return formats
+
+def register_archive_format(name, function, extra_args=None, description=''):
+ """Registers an archive format.
+
+ name is the name of the format. function is the callable that will be
+ used to create archives. If provided, extra_args is a sequence of
+ (name, value) tuples that will be passed as arguments to the callable.
+ description can be provided to describe the format, and will be returned
+ by the get_archive_formats() function.
+ """
+ if extra_args is None:
+ extra_args = []
+ if not isinstance(function, collections.Callable):
+ raise TypeError('The %s object is not callable' % function)
+ if not isinstance(extra_args, (tuple, list)):
+ raise TypeError('extra_args needs to be a sequence')
+ for element in extra_args:
+ if not isinstance(element, (tuple, list)) or len(element) !=2 :
+ raise TypeError('extra_args elements are : (arg_name, value)')
+
+ _ARCHIVE_FORMATS[name] = (function, extra_args, description)
+
+def unregister_archive_format(name):
+ del _ARCHIVE_FORMATS[name]
+
+def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0,
+ dry_run=0, owner=None, group=None, logger=None):
+ """Create an archive file (eg. zip or tar).
+
+ 'base_name' is the name of the file to create, minus any format-specific
+ extension; 'format' is the archive format: one of "zip", "tar", "bztar"
+ or "gztar".
+
+ 'root_dir' is a directory that will be the root directory of the
+ archive; ie. we typically chdir into 'root_dir' before creating the
+ archive. 'base_dir' is the directory where we start archiving from;
+ ie. 'base_dir' will be the common prefix of all files and
+ directories in the archive. 'root_dir' and 'base_dir' both default
+ to the current directory. Returns the name of the archive file.
+
+ 'owner' and 'group' are used when creating a tar archive. By default,
+ uses the current owner and group.
+ """
+ save_cwd = os.getcwd()
+ if root_dir is not None:
+ if logger is not None:
+ logger.debug("changing into '%s'", root_dir)
+ base_name = os.path.abspath(base_name)
+ if not dry_run:
+ os.chdir(root_dir)
+
+ if base_dir is None:
+ base_dir = os.curdir
+
+ kwargs = {'dry_run': dry_run, 'logger': logger}
+
+ try:
+ format_info = _ARCHIVE_FORMATS[format]
+ except KeyError:
+ raise ValueError, "unknown archive format '%s'" % format
+
+ func = format_info[0]
+ for arg, val in format_info[1]:
+ kwargs[arg] = val
+
+ if format != 'zip':
+ kwargs['owner'] = owner
+ kwargs['group'] = group
+
+ try:
+ filename = func(base_name, base_dir, **kwargs)
+ finally:
+ if root_dir is not None:
+ if logger is not None:
+ logger.debug("changing back to '%s'", save_cwd)
+ os.chdir(save_cwd)
+
+ return filename
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
index 0000000000..74df190227
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/site-packages/README
@@ -0,0 +1,2 @@
+This directory exists so that 3rd party packages can be installed
+here. Read the source for site.py for more details.
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
index 0000000000..670bde1c5e
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/socket.py
@@ -0,0 +1,577 @@
+# Wrapper module for _socket, providing some additional facilities
+# implemented in Python.
+
+"""\
+This module provides socket operations and some related functions.
+On Unix, it supports IP (Internet Protocol) and Unix domain sockets.
+On other systems, it only supports IP. Functions specific for a
+socket are available as methods of the socket object.
+
+Functions:
+
+socket() -- create a new socket object
+socketpair() -- create a pair of new socket objects [*]
+fromfd() -- create a socket object from an open file descriptor [*]
+gethostname() -- return the current hostname
+gethostbyname() -- map a hostname to its IP number
+gethostbyaddr() -- map an IP number or hostname to DNS info
+getservbyname() -- map a service name and a protocol name to a port number
+getprotobyname() -- map a protocol name (e.g. 'tcp') to a number
+ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order
+htons(), htonl() -- convert 16, 32 bit int from host to network byte order
+inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format
+inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89)
+ssl() -- secure socket layer support (only available if configured)
+socket.getdefaulttimeout() -- get the default timeout value
+socket.setdefaulttimeout() -- set the default timeout value
+create_connection() -- connects to an address, with an optional timeout and
+ optional source address.
+
+ [*] not available on all platforms!
+
+Special objects:
+
+SocketType -- type object for socket objects
+error -- exception raised for I/O errors
+has_ipv6 -- boolean value indicating if IPv6 is supported
+
+Integer constants:
+
+AF_INET, AF_UNIX -- socket domains (first argument to socket() call)
+SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument)
+
+Many other constants may be defined; these may be used in calls to
+the setsockopt() and getsockopt() methods.
+"""
+
+import _socket
+from _socket import *
+from functools import partial
+from types import MethodType
+
+try:
+ import _ssl
+except ImportError:
+ # no SSL support
+ pass
+else:
+ def ssl(sock, keyfile=None, certfile=None):
+ # we do an internal import here because the ssl
+ # module imports the socket module
+ import ssl as _realssl
+ warnings.warn("socket.ssl() is deprecated. Use ssl.wrap_socket() instead.",
+ DeprecationWarning, stacklevel=2)
+ return _realssl.sslwrap_simple(sock, keyfile, certfile)
+
+ # we need to import the same constants we used to...
+ from _ssl import SSLError as sslerror
+ from _ssl import \
+ RAND_add, \
+ RAND_status, \
+ SSL_ERROR_ZERO_RETURN, \
+ SSL_ERROR_WANT_READ, \
+ SSL_ERROR_WANT_WRITE, \
+ SSL_ERROR_WANT_X509_LOOKUP, \
+ SSL_ERROR_SYSCALL, \
+ SSL_ERROR_SSL, \
+ SSL_ERROR_WANT_CONNECT, \
+ SSL_ERROR_EOF, \
+ SSL_ERROR_INVALID_ERROR_CODE
+ try:
+ from _ssl import RAND_egd
+ except ImportError:
+ # LibreSSL does not provide RAND_egd
+ pass
+
+import os, sys, warnings
+
+try:
+ from cStringIO import StringIO
+except ImportError:
+ from StringIO import StringIO
+
+try:
+ import errno
+except ImportError:
+ errno = None
+EBADF = getattr(errno, 'EBADF', 9)
+EINTR = getattr(errno, 'EINTR', 4)
+
+__all__ = ["getfqdn", "create_connection"]
+__all__.extend(os._get_exports_list(_socket))
+
+
+_realsocket = socket
+
+# WSA error codes
+if sys.platform.lower().startswith("win"):
+ errorTab = {}
+ errorTab[10004] = "The operation was interrupted."
+ errorTab[10009] = "A bad file handle was passed."
+ errorTab[10013] = "Permission denied."
+ errorTab[10014] = "A fault occurred on the network??" # WSAEFAULT
+ errorTab[10022] = "An invalid operation was attempted."
+ errorTab[10035] = "The socket operation would block"
+ errorTab[10036] = "A blocking operation is already in progress."
+ errorTab[10048] = "The network address is in use."
+ errorTab[10054] = "The connection has been reset."
+ errorTab[10058] = "The network has been shut down."
+ errorTab[10060] = "The operation timed out."
+ errorTab[10061] = "Connection refused."
+ errorTab[10063] = "The name is too long."
+ errorTab[10064] = "The host is down."
+ errorTab[10065] = "The host is unreachable."
+ __all__.append("errorTab")
+
+
+
+def getfqdn(name=''):
+ """Get fully qualified domain name from name.
+
+ An empty argument is interpreted as meaning the local host.
+
+ First the hostname returned by gethostbyaddr() is checked, then
+ possibly existing aliases. In case no FQDN is available, hostname
+ from gethostname() is returned.
+ """
+ name = name.strip()
+ if not name or name == '0.0.0.0':
+ name = gethostname()
+ try:
+ hostname, aliases, ipaddrs = gethostbyaddr(name)
+ except error:
+ pass
+ else:
+ aliases.insert(0, hostname)
+ for name in aliases:
+ if '.' in name:
+ break
+ else:
+ name = hostname
+ return name
+
+
+_socketmethods = (
+ 'bind', 'connect', 'connect_ex', 'fileno', 'listen',
+ 'getpeername', 'getsockname', 'getsockopt', 'setsockopt',
+ 'sendall', 'setblocking',
+ 'settimeout', 'gettimeout', 'shutdown')
+
+if os.name == "nt":
+ _socketmethods = _socketmethods + ('ioctl',)
+
+if sys.platform == "riscos":
+ _socketmethods = _socketmethods + ('sleeptaskw',)
+
+# All the method names that must be delegated to either the real socket
+# object or the _closedsocket object.
+_delegate_methods = ("recv", "recvfrom", "recv_into", "recvfrom_into",
+ "send", "sendto")
+
+class _closedsocket(object):
+ __slots__ = []
+ def _dummy(*args):
+ raise error(EBADF, 'Bad file descriptor')
+ # All _delegate_methods must also be initialized here.
+ send = recv = recv_into = sendto = recvfrom = recvfrom_into = _dummy
+ __getattr__ = _dummy
+
+# Wrapper around platform socket objects. This implements
+# a platform-independent dup() functionality. The
+# implementation currently relies on reference counting
+# to close the underlying socket object.
+class _socketobject(object):
+
+ __doc__ = _realsocket.__doc__
+
+ __slots__ = ["_sock", "__weakref__"] + list(_delegate_methods)
+
+ def __init__(self, family=AF_INET, type=SOCK_STREAM, proto=0, _sock=None):
+ if _sock is None:
+ _sock = _realsocket(family, type, proto)
+ self._sock = _sock
+ for method in _delegate_methods:
+ setattr(self, method, getattr(_sock, method))
+
+ def close(self, _closedsocket=_closedsocket,
+ _delegate_methods=_delegate_methods, setattr=setattr):
+ # This function should not reference any globals. See issue #808164.
+ self._sock = _closedsocket()
+ dummy = self._sock._dummy
+ for method in _delegate_methods:
+ setattr(self, method, dummy)
+ close.__doc__ = _realsocket.close.__doc__
+
+ def accept(self):
+ sock, addr = self._sock.accept()
+ return _socketobject(_sock=sock), addr
+ accept.__doc__ = _realsocket.accept.__doc__
+
+ def dup(self):
+ """dup() -> socket object
+
+ Return a new socket object connected to the same system resource."""
+ return _socketobject(_sock=self._sock)
+
+ def makefile(self, mode='r', bufsize=-1):
+ """makefile([mode[, bufsize]]) -> file object
+
+ Return a regular file object corresponding to the socket. The mode
+ and bufsize arguments are as for the built-in open() function."""
+ return _fileobject(self._sock, mode, bufsize)
+
+ family = property(lambda self: self._sock.family, doc="the socket family")
+ type = property(lambda self: self._sock.type, doc="the socket type")
+ proto = property(lambda self: self._sock.proto, doc="the socket protocol")
+
+def meth(name,self,*args):
+ return getattr(self._sock,name)(*args)
+
+for _m in _socketmethods:
+ p = partial(meth,_m)
+ p.__name__ = _m
+ p.__doc__ = getattr(_realsocket,_m).__doc__
+ m = MethodType(p,None,_socketobject)
+ setattr(_socketobject,_m,m)
+
+socket = SocketType = _socketobject
+
+class _fileobject(object):
+ """Faux file object attached to a socket object."""
+
+ default_bufsize = 8192
+ name = "<socket>"
+
+ __slots__ = ["mode", "bufsize", "softspace",
+ # "closed" is a property, see below
+ "_sock", "_rbufsize", "_wbufsize", "_rbuf", "_wbuf", "_wbuf_len",
+ "_close"]
+
+ def __init__(self, sock, mode='rb', bufsize=-1, close=False):
+ self._sock = sock
+ self.mode = mode # Not actually used in this version
+ if bufsize < 0:
+ bufsize = self.default_bufsize
+ self.bufsize = bufsize
+ self.softspace = False
+ # _rbufsize is the suggested recv buffer size. It is *strictly*
+ # obeyed within readline() for recv calls. If it is larger than
+ # default_bufsize it will be used for recv calls within read().
+ if bufsize == 0:
+ self._rbufsize = 1
+ elif bufsize == 1:
+ self._rbufsize = self.default_bufsize
+ else:
+ self._rbufsize = bufsize
+ self._wbufsize = bufsize
+ # We use StringIO for the read buffer to avoid holding a list
+ # of variously sized string objects which have been known to
+ # fragment the heap due to how they are malloc()ed and often
+ # realloc()ed down much smaller than their original allocation.
+ self._rbuf = StringIO()
+ self._wbuf = [] # A list of strings
+ self._wbuf_len = 0
+ self._close = close
+
+ def _getclosed(self):
+ return self._sock is None
+ closed = property(_getclosed, doc="True if the file is closed")
+
+ def close(self):
+ try:
+ if self._sock:
+ self.flush()
+ finally:
+ if self._close:
+ self._sock.close()
+ self._sock = None
+
+ def __del__(self):
+ try:
+ self.close()
+ except:
+ # close() may fail if __init__ didn't complete
+ pass
+
+ def flush(self):
+ if self._wbuf:
+ data = "".join(self._wbuf)
+ self._wbuf = []
+ self._wbuf_len = 0
+ buffer_size = max(self._rbufsize, self.default_bufsize)
+ data_size = len(data)
+ write_offset = 0
+ view = memoryview(data)
+ try:
+ while write_offset < data_size:
+ self._sock.sendall(view[write_offset:write_offset+buffer_size])
+ write_offset += buffer_size
+ finally:
+ if write_offset < data_size:
+ remainder = data[write_offset:]
+ del view, data # explicit free
+ self._wbuf.append(remainder)
+ self._wbuf_len = len(remainder)
+
+ def fileno(self):
+ return self._sock.fileno()
+
+ def write(self, data):
+ data = str(data) # XXX Should really reject non-string non-buffers
+ if not data:
+ return
+ self._wbuf.append(data)
+ self._wbuf_len += len(data)
+ if (self._wbufsize == 0 or
+ (self._wbufsize == 1 and '\n' in data) or
+ (self._wbufsize > 1 and self._wbuf_len >= self._wbufsize)):
+ self.flush()
+
+ def writelines(self, list):
+ # XXX We could do better here for very long lists
+ # XXX Should really reject non-string non-buffers
+ lines = filter(None, map(str, list))
+ self._wbuf_len += sum(map(len, lines))
+ self._wbuf.extend(lines)
+ if (self._wbufsize <= 1 or
+ self._wbuf_len >= self._wbufsize):
+ self.flush()
+
+ def read(self, size=-1):
+ # Use max, disallow tiny reads in a loop as they are very inefficient.
+ # We never leave read() with any leftover data from a new recv() call
+ # in our internal buffer.
+ rbufsize = max(self._rbufsize, self.default_bufsize)
+ # Our use of StringIO rather than lists of string objects returned by
+ # recv() minimizes memory usage and fragmentation that occurs when
+ # rbufsize is large compared to the typical return value of recv().
+ buf = self._rbuf
+ buf.seek(0, 2) # seek end
+ if size < 0:
+ # Read until EOF
+ self._rbuf = StringIO() # reset _rbuf. we consume it via buf.
+ while True:
+ try:
+ data = self._sock.recv(rbufsize)
+ except error, e:
+ if e.args[0] == EINTR:
+ continue
+ raise
+ if not data:
+ break
+ buf.write(data)
+ return buf.getvalue()
+ else:
+ # Read until size bytes or EOF seen, whichever comes first
+ buf_len = buf.tell()
+ if buf_len >= size:
+ # Already have size bytes in our buffer? Extract and return.
+ buf.seek(0)
+ rv = buf.read(size)
+ self._rbuf = StringIO()
+ self._rbuf.write(buf.read())
+ return rv
+
+ self._rbuf = StringIO() # reset _rbuf. we consume it via buf.
+ while True:
+ left = size - buf_len
+ # recv() will malloc the amount of memory given as its
+ # parameter even though it often returns much less data
+ # than that. The returned data string is short lived
+ # as we copy it into a StringIO and free it. This avoids
+ # fragmentation issues on many platforms.
+ try:
+ data = self._sock.recv(left)
+ except error, e:
+ if e.args[0] == EINTR:
+ continue
+ raise
+ if not data:
+ break
+ n = len(data)
+ if n == size and not buf_len:
+ # Shortcut. Avoid buffer data copies when:
+ # - We have no data in our buffer.
+ # AND
+ # - Our call to recv returned exactly the
+ # number of bytes we were asked to read.
+ return data
+ if n == left:
+ buf.write(data)
+ del data # explicit free
+ break
+ assert n <= left, "recv(%d) returned %d bytes" % (left, n)
+ buf.write(data)
+ buf_len += n
+ del data # explicit free
+ #assert buf_len == buf.tell()
+ return buf.getvalue()
+
+ def readline(self, size=-1):
+ buf = self._rbuf
+ buf.seek(0, 2) # seek end
+ if buf.tell() > 0:
+ # check if we already have it in our buffer
+ buf.seek(0)
+ bline = buf.readline(size)
+ if bline.endswith('\n') or len(bline) == size:
+ self._rbuf = StringIO()
+ self._rbuf.write(buf.read())
+ return bline
+ del bline
+ if size < 0:
+ # Read until \n or EOF, whichever comes first
+ if self._rbufsize <= 1:
+ # Speed up unbuffered case
+ buf.seek(0)
+ buffers = [buf.read()]
+ self._rbuf = StringIO() # reset _rbuf. we consume it via buf.
+ data = None
+ recv = self._sock.recv
+ while True:
+ try:
+ while data != "\n":
+ data = recv(1)
+ if not data:
+ break
+ buffers.append(data)
+ except error, e:
+ # The try..except to catch EINTR was moved outside the
+ # recv loop to avoid the per byte overhead.
+ if e.args[0] == EINTR:
+ continue
+ raise
+ break
+ return "".join(buffers)
+
+ buf.seek(0, 2) # seek end
+ self._rbuf = StringIO() # reset _rbuf. we consume it via buf.
+ while True:
+ try:
+ data = self._sock.recv(self._rbufsize)
+ except error, e:
+ if e.args[0] == EINTR:
+ continue
+ raise
+ if not data:
+ break
+ nl = data.find('\n')
+ if nl >= 0:
+ nl += 1
+ buf.write(data[:nl])
+ self._rbuf.write(data[nl:])
+ del data
+ break
+ buf.write(data)
+ return buf.getvalue()
+ else:
+ # Read until size bytes or \n or EOF seen, whichever comes first
+ buf.seek(0, 2) # seek end
+ buf_len = buf.tell()
+ if buf_len >= size:
+ buf.seek(0)
+ rv = buf.read(size)
+ self._rbuf = StringIO()
+ self._rbuf.write(buf.read())
+ return rv
+ self._rbuf = StringIO() # reset _rbuf. we consume it via buf.
+ while True:
+ try:
+ data = self._sock.recv(self._rbufsize)
+ except error, e:
+ if e.args[0] == EINTR:
+ continue
+ raise
+ if not data:
+ break
+ left = size - buf_len
+ # did we just receive a newline?
+ nl = data.find('\n', 0, left)
+ if nl >= 0:
+ nl += 1
+ # save the excess data to _rbuf
+ self._rbuf.write(data[nl:])
+ if buf_len:
+ buf.write(data[:nl])
+ break
+ else:
+ # Shortcut. Avoid data copy through buf when returning
+ # a substring of our first recv().
+ return data[:nl]
+ n = len(data)
+ if n == size and not buf_len:
+ # Shortcut. Avoid data copy through buf when
+ # returning exactly all of our first recv().
+ return data
+ if n >= left:
+ buf.write(data[:left])
+ self._rbuf.write(data[left:])
+ break
+ buf.write(data)
+ buf_len += n
+ #assert buf_len == buf.tell()
+ return buf.getvalue()
+
+ def readlines(self, sizehint=0):
+ total = 0
+ list = []
+ while True:
+ line = self.readline()
+ if not line:
+ break
+ list.append(line)
+ total += len(line)
+ if sizehint and total >= sizehint:
+ break
+ return list
+
+ # Iterator protocols
+
+ def __iter__(self):
+ return self
+
+ def next(self):
+ line = self.readline()
+ if not line:
+ raise StopIteration
+ return line
+
+_GLOBAL_DEFAULT_TIMEOUT = object()
+
+def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT,
+ source_address=None):
+ """Connect to *address* and return the socket object.
+
+ Convenience function. Connect to *address* (a 2-tuple ``(host,
+ port)``) and return the socket object. Passing the optional
+ *timeout* parameter will set the timeout on the socket instance
+ before attempting to connect. If no *timeout* is supplied, the
+ global default timeout setting returned by :func:`getdefaulttimeout`
+ is used. If *source_address* is set it must be a tuple of (host, port)
+ for the socket to bind as a source address before making the connection.
+ An host of '' or port 0 tells the OS to use the default.
+ """
+
+ host, port = address
+ err = None
+ for res in getaddrinfo(host, port, 0, SOCK_STREAM):
+ af, socktype, proto, canonname, sa = res
+ sock = None
+ try:
+ sock = socket(af, socktype, proto)
+ if timeout is not _GLOBAL_DEFAULT_TIMEOUT:
+ sock.settimeout(timeout)
+ if source_address:
+ sock.bind(source_address)
+ sock.connect(sa)
+ return sock
+
+ except error as _:
+ err = _
+ if sock is not None:
+ sock.close()
+
+ if err is not None:
+ raise err
+ else:
+ raise error("getaddrinfo returns an empty list")
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
index 0000000000..6d376ad6fd
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/sre.py
@@ -0,0 +1,13 @@
+"""This file is only retained for backwards compatibility.
+It will be removed in the future. sre was moved to re in version 2.5.
+"""
+
+import warnings
+warnings.warn("The sre module is deprecated, please import re.",
+ DeprecationWarning, 2)
+
+from re import *
+from re import __all__
+
+# old pickles expect the _compile() reconstructor in this module
+from re import _compile
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
index 0000000000..6a74d04932
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/sre_compile.py
@@ -0,0 +1,596 @@
+# -*- coding: utf-8 -*-
+#
+# Secret Labs' Regular Expression Engine
+#
+# convert template to internal format
+#
+# Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved.
+#
+# See the sre.py file for information on usage and redistribution.
+#
+
+"""Internal support module for sre"""
+
+import _sre, sys
+import sre_parse
+from sre_constants import *
+
+assert _sre.MAGIC == MAGIC, "SRE module mismatch"
+
+if _sre.CODESIZE == 2:
+ MAXCODE = 65535
+else:
+ MAXCODE = 0xFFFFFFFFL
+
+_LITERAL_CODES = set([LITERAL, NOT_LITERAL])
+_REPEATING_CODES = set([REPEAT, MIN_REPEAT, MAX_REPEAT])
+_SUCCESS_CODES = set([SUCCESS, FAILURE])
+_ASSERT_CODES = set([ASSERT, ASSERT_NOT])
+
+# Sets of lowercase characters which have the same uppercase.
+_equivalences = (
+ # LATIN SMALL LETTER I, LATIN SMALL LETTER DOTLESS I
+ (0x69, 0x131), # iı
+ # LATIN SMALL LETTER S, LATIN SMALL LETTER LONG S
+ (0x73, 0x17f), # sſ
+ # MICRO SIGN, GREEK SMALL LETTER MU
+ (0xb5, 0x3bc), # µμ
+ # COMBINING GREEK YPOGEGRAMMENI, GREEK SMALL LETTER IOTA, GREEK PROSGEGRAMMENI
+ (0x345, 0x3b9, 0x1fbe), # \u0345ιι
+ # GREEK SMALL LETTER BETA, GREEK BETA SYMBOL
+ (0x3b2, 0x3d0), # βÏ
+ # GREEK SMALL LETTER EPSILON, GREEK LUNATE EPSILON SYMBOL
+ (0x3b5, 0x3f5), # εϵ
+ # GREEK SMALL LETTER THETA, GREEK THETA SYMBOL
+ (0x3b8, 0x3d1), # θϑ
+ # GREEK SMALL LETTER KAPPA, GREEK KAPPA SYMBOL
+ (0x3ba, 0x3f0), # κϰ
+ # GREEK SMALL LETTER PI, GREEK PI SYMBOL
+ (0x3c0, 0x3d6), # πϖ
+ # GREEK SMALL LETTER RHO, GREEK RHO SYMBOL
+ (0x3c1, 0x3f1), # Ïϱ
+ # GREEK SMALL LETTER FINAL SIGMA, GREEK SMALL LETTER SIGMA
+ (0x3c2, 0x3c3), # ςσ
+ # GREEK SMALL LETTER PHI, GREEK PHI SYMBOL
+ (0x3c6, 0x3d5), # φϕ
+ # LATIN SMALL LETTER S WITH DOT ABOVE, LATIN SMALL LETTER LONG S WITH DOT ABOVE
+ (0x1e61, 0x1e9b), # ṡẛ
+)
+
+# Maps the lowercase code to lowercase codes which have the same uppercase.
+_ignorecase_fixes = {i: tuple(j for j in t if i != j)
+ for t in _equivalences for i in t}
+
+def _compile(code, pattern, flags):
+ # internal: compile a (sub)pattern
+ emit = code.append
+ _len = len
+ LITERAL_CODES = _LITERAL_CODES
+ REPEATING_CODES = _REPEATING_CODES
+ SUCCESS_CODES = _SUCCESS_CODES
+ ASSERT_CODES = _ASSERT_CODES
+ if (flags & SRE_FLAG_IGNORECASE and
+ not (flags & SRE_FLAG_LOCALE) and
+ flags & SRE_FLAG_UNICODE):
+ fixes = _ignorecase_fixes
+ else:
+ fixes = None
+ for op, av in pattern:
+ if op in LITERAL_CODES:
+ if flags & SRE_FLAG_IGNORECASE:
+ lo = _sre.getlower(av, flags)
+ if fixes and lo in fixes:
+ emit(OPCODES[IN_IGNORE])
+ skip = _len(code); emit(0)
+ if op is NOT_LITERAL:
+ emit(OPCODES[NEGATE])
+ for k in (lo,) + fixes[lo]:
+ emit(OPCODES[LITERAL])
+ emit(k)
+ emit(OPCODES[FAILURE])
+ code[skip] = _len(code) - skip
+ else:
+ emit(OPCODES[OP_IGNORE[op]])
+ emit(lo)
+ else:
+ emit(OPCODES[op])
+ emit(av)
+ elif op is IN:
+ if flags & SRE_FLAG_IGNORECASE:
+ emit(OPCODES[OP_IGNORE[op]])
+ def fixup(literal, flags=flags):
+ return _sre.getlower(literal, flags)
+ else:
+ emit(OPCODES[op])
+ fixup = None
+ skip = _len(code); emit(0)
+ _compile_charset(av, flags, code, fixup, fixes)
+ code[skip] = _len(code) - skip
+ elif op is ANY:
+ if flags & SRE_FLAG_DOTALL:
+ emit(OPCODES[ANY_ALL])
+ else:
+ emit(OPCODES[ANY])
+ elif op in REPEATING_CODES:
+ if flags & SRE_FLAG_TEMPLATE:
+ raise error, "internal: unsupported template operator"
+ emit(OPCODES[REPEAT])
+ skip = _len(code); emit(0)
+ emit(av[0])
+ emit(av[1])
+ _compile(code, av[2], flags)
+ emit(OPCODES[SUCCESS])
+ code[skip] = _len(code) - skip
+ elif _simple(av) and op is not REPEAT:
+ if op is MAX_REPEAT:
+ emit(OPCODES[REPEAT_ONE])
+ else:
+ emit(OPCODES[MIN_REPEAT_ONE])
+ skip = _len(code); emit(0)
+ emit(av[0])
+ emit(av[1])
+ _compile(code, av[2], flags)
+ emit(OPCODES[SUCCESS])
+ code[skip] = _len(code) - skip
+ else:
+ emit(OPCODES[REPEAT])
+ skip = _len(code); emit(0)
+ emit(av[0])
+ emit(av[1])
+ _compile(code, av[2], flags)
+ code[skip] = _len(code) - skip
+ if op is MAX_REPEAT:
+ emit(OPCODES[MAX_UNTIL])
+ else:
+ emit(OPCODES[MIN_UNTIL])
+ elif op is SUBPATTERN:
+ if av[0]:
+ emit(OPCODES[MARK])
+ emit((av[0]-1)*2)
+ # _compile_info(code, av[1], flags)
+ _compile(code, av[1], flags)
+ if av[0]:
+ emit(OPCODES[MARK])
+ emit((av[0]-1)*2+1)
+ elif op in SUCCESS_CODES:
+ emit(OPCODES[op])
+ elif op in ASSERT_CODES:
+ emit(OPCODES[op])
+ skip = _len(code); emit(0)
+ if av[0] >= 0:
+ emit(0) # look ahead
+ else:
+ lo, hi = av[1].getwidth()
+ if lo != hi:
+ raise error, "look-behind requires fixed-width pattern"
+ emit(lo) # look behind
+ _compile(code, av[1], flags)
+ emit(OPCODES[SUCCESS])
+ code[skip] = _len(code) - skip
+ elif op is CALL:
+ emit(OPCODES[op])
+ skip = _len(code); emit(0)
+ _compile(code, av, flags)
+ emit(OPCODES[SUCCESS])
+ code[skip] = _len(code) - skip
+ elif op is AT:
+ emit(OPCODES[op])
+ if flags & SRE_FLAG_MULTILINE:
+ av = AT_MULTILINE.get(av, av)
+ if flags & SRE_FLAG_LOCALE:
+ av = AT_LOCALE.get(av, av)
+ elif flags & SRE_FLAG_UNICODE:
+ av = AT_UNICODE.get(av, av)
+ emit(ATCODES[av])
+ elif op is BRANCH:
+ emit(OPCODES[op])
+ tail = []
+ tailappend = tail.append
+ for av in av[1]:
+ skip = _len(code); emit(0)
+ # _compile_info(code, av, flags)
+ _compile(code, av, flags)
+ emit(OPCODES[JUMP])
+ tailappend(_len(code)); emit(0)
+ code[skip] = _len(code) - skip
+ emit(0) # end of branch
+ for tail in tail:
+ code[tail] = _len(code) - tail
+ elif op is CATEGORY:
+ emit(OPCODES[op])
+ if flags & SRE_FLAG_LOCALE:
+ av = CH_LOCALE[av]
+ elif flags & SRE_FLAG_UNICODE:
+ av = CH_UNICODE[av]
+ emit(CHCODES[av])
+ elif op is GROUPREF:
+ if flags & SRE_FLAG_IGNORECASE:
+ emit(OPCODES[OP_IGNORE[op]])
+ else:
+ emit(OPCODES[op])
+ emit(av-1)
+ elif op is GROUPREF_EXISTS:
+ emit(OPCODES[op])
+ emit(av[0]-1)
+ skipyes = _len(code); emit(0)
+ _compile(code, av[1], flags)
+ if av[2]:
+ emit(OPCODES[JUMP])
+ skipno = _len(code); emit(0)
+ code[skipyes] = _len(code) - skipyes + 1
+ _compile(code, av[2], flags)
+ code[skipno] = _len(code) - skipno
+ else:
+ code[skipyes] = _len(code) - skipyes + 1
+ else:
+ raise ValueError, ("unsupported operand type", op)
+
+def _compile_charset(charset, flags, code, fixup=None, fixes=None):
+ # compile charset subprogram
+ emit = code.append
+ for op, av in _optimize_charset(charset, fixup, fixes,
+ flags & SRE_FLAG_UNICODE):
+ emit(OPCODES[op])
+ if op is NEGATE:
+ pass
+ elif op is LITERAL:
+ emit(av)
+ elif op is RANGE:
+ emit(av[0])
+ emit(av[1])
+ elif op is CHARSET:
+ code.extend(av)
+ elif op is BIGCHARSET:
+ code.extend(av)
+ elif op is CATEGORY:
+ if flags & SRE_FLAG_LOCALE:
+ emit(CHCODES[CH_LOCALE[av]])
+ elif flags & SRE_FLAG_UNICODE:
+ emit(CHCODES[CH_UNICODE[av]])
+ else:
+ emit(CHCODES[av])
+ else:
+ raise error, "internal: unsupported set operator"
+ emit(OPCODES[FAILURE])
+
+def _optimize_charset(charset, fixup, fixes, isunicode):
+ # internal: optimize character set
+ out = []
+ tail = []
+ charmap = bytearray(256)
+ for op, av in charset:
+ while True:
+ try:
+ if op is LITERAL:
+ if fixup:
+ i = fixup(av)
+ charmap[i] = 1
+ if fixes and i in fixes:
+ for k in fixes[i]:
+ charmap[k] = 1
+ else:
+ charmap[av] = 1
+ elif op is RANGE:
+ r = range(av[0], av[1]+1)
+ if fixup:
+ r = map(fixup, r)
+ if fixup and fixes:
+ for i in r:
+ charmap[i] = 1
+ if i in fixes:
+ for k in fixes[i]:
+ charmap[k] = 1
+ else:
+ for i in r:
+ charmap[i] = 1
+ elif op is NEGATE:
+ out.append((op, av))
+ else:
+ tail.append((op, av))
+ except IndexError:
+ if len(charmap) == 256:
+ # character set contains non-UCS1 character codes
+ charmap += b'\0' * 0xff00
+ continue
+ # character set contains non-BMP character codes
+ if fixup and isunicode and op is RANGE:
+ lo, hi = av
+ ranges = [av]
+ # There are only two ranges of cased astral characters:
+ # 10400-1044F (Deseret) and 118A0-118DF (Warang Citi).
+ _fixup_range(max(0x10000, lo), min(0x11fff, hi),
+ ranges, fixup)
+ for lo, hi in ranges:
+ if lo == hi:
+ tail.append((LITERAL, hi))
+ else:
+ tail.append((RANGE, (lo, hi)))
+ else:
+ tail.append((op, av))
+ break
+
+ # compress character map
+ runs = []
+ q = 0
+ while True:
+ p = charmap.find(b'\1', q)
+ if p < 0:
+ break
+ if len(runs) >= 2:
+ runs = None
+ break
+ q = charmap.find(b'\0', p)
+ if q < 0:
+ runs.append((p, len(charmap)))
+ break
+ runs.append((p, q))
+ if runs is not None:
+ # use literal/range
+ for p, q in runs:
+ if q - p == 1:
+ out.append((LITERAL, p))
+ else:
+ out.append((RANGE, (p, q - 1)))
+ out += tail
+ # if the case was changed or new representation is more compact
+ if fixup or len(out) < len(charset):
+ return out
+ # else original character set is good enough
+ return charset
+
+ # use bitmap
+ if len(charmap) == 256:
+ data = _mk_bitmap(charmap)
+ out.append((CHARSET, data))
+ out += tail
+ return out
+
+ # To represent a big charset, first a bitmap of all characters in the
+ # set is constructed. Then, this bitmap is sliced into chunks of 256
+ # characters, duplicate chunks are eliminated, and each chunk is
+ # given a number. In the compiled expression, the charset is
+ # represented by a 32-bit word sequence, consisting of one word for
+ # the number of different chunks, a sequence of 256 bytes (64 words)
+ # of chunk numbers indexed by their original chunk position, and a
+ # sequence of 256-bit chunks (8 words each).
+
+ # Compression is normally good: in a typical charset, large ranges of
+ # Unicode will be either completely excluded (e.g. if only cyrillic
+ # letters are to be matched), or completely included (e.g. if large
+ # subranges of Kanji match). These ranges will be represented by
+ # chunks of all one-bits or all zero-bits.
+
+ # Matching can be also done efficiently: the more significant byte of
+ # the Unicode character is an index into the chunk number, and the
+ # less significant byte is a bit index in the chunk (just like the
+ # CHARSET matching).
+
+ # In UCS-4 mode, the BIGCHARSET opcode still supports only subsets
+ # of the basic multilingual plane; an efficient representation
+ # for all of Unicode has not yet been developed.
+
+ charmap = bytes(charmap) # should be hashable
+ comps = {}
+ mapping = bytearray(256)
+ block = 0
+ data = bytearray()
+ for i in range(0, 65536, 256):
+ chunk = charmap[i: i + 256]
+ if chunk in comps:
+ mapping[i // 256] = comps[chunk]
+ else:
+ mapping[i // 256] = comps[chunk] = block
+ block += 1
+ data += chunk
+ data = _mk_bitmap(data)
+ data[0:0] = [block] + _bytes_to_codes(mapping)
+ out.append((BIGCHARSET, data))
+ out += tail
+ return out
+
+def _fixup_range(lo, hi, ranges, fixup):
+ for i in map(fixup, range(lo, hi+1)):
+ for k, (lo, hi) in enumerate(ranges):
+ if i < lo:
+ if l == lo - 1:
+ ranges[k] = (i, hi)
+ else:
+ ranges.insert(k, (i, i))
+ break
+ elif i > hi:
+ if i == hi + 1:
+ ranges[k] = (lo, i)
+ break
+ else:
+ break
+ else:
+ ranges.append((i, i))
+
+_CODEBITS = _sre.CODESIZE * 8
+_BITS_TRANS = b'0' + b'1' * 255
+def _mk_bitmap(bits, _CODEBITS=_CODEBITS, _int=int):
+ s = bytes(bits).translate(_BITS_TRANS)[::-1]
+ return [_int(s[i - _CODEBITS: i], 2)
+ for i in range(len(s), 0, -_CODEBITS)]
+
+def _bytes_to_codes(b):
+ # Convert block indices to word array
+ import array
+ if _sre.CODESIZE == 2:
+ code = 'H'
+ else:
+ code = 'I'
+ a = array.array(code, bytes(b))
+ assert a.itemsize == _sre.CODESIZE
+ assert len(a) * a.itemsize == len(b)
+ return a.tolist()
+
+def _simple(av):
+ # check if av is a "simple" operator
+ lo, hi = av[2].getwidth()
+ return lo == hi == 1 and av[2][0][0] != SUBPATTERN
+
+def _compile_info(code, pattern, flags):
+ # internal: compile an info block. in the current version,
+ # this contains min/max pattern width, and an optional literal
+ # prefix or a character map
+ lo, hi = pattern.getwidth()
+ if lo == 0:
+ return # not worth it
+ # look for a literal prefix
+ prefix = []
+ prefixappend = prefix.append
+ prefix_skip = 0
+ charset = [] # not used
+ charsetappend = charset.append
+ if not (flags & SRE_FLAG_IGNORECASE):
+ # look for literal prefix
+ for op, av in pattern.data:
+ if op is LITERAL:
+ if len(prefix) == prefix_skip:
+ prefix_skip = prefix_skip + 1
+ prefixappend(av)
+ elif op is SUBPATTERN and len(av[1]) == 1:
+ op, av = av[1][0]
+ if op is LITERAL:
+ prefixappend(av)
+ else:
+ break
+ else:
+ break
+ # if no prefix, look for charset prefix
+ if not prefix and pattern.data:
+ op, av = pattern.data[0]
+ if op is SUBPATTERN and av[1]:
+ op, av = av[1][0]
+ if op is LITERAL:
+ charsetappend((op, av))
+ elif op is BRANCH:
+ c = []
+ cappend = c.append
+ for p in av[1]:
+ if not p:
+ break
+ op, av = p[0]
+ if op is LITERAL:
+ cappend((op, av))
+ else:
+ break
+ else:
+ charset = c
+ elif op is BRANCH:
+ c = []
+ cappend = c.append
+ for p in av[1]:
+ if not p:
+ break
+ op, av = p[0]
+ if op is LITERAL:
+ cappend((op, av))
+ else:
+ break
+ else:
+ charset = c
+ elif op is IN:
+ charset = av
+## if prefix:
+## print "*** PREFIX", prefix, prefix_skip
+## if charset:
+## print "*** CHARSET", charset
+ # add an info block
+ emit = code.append
+ emit(OPCODES[INFO])
+ skip = len(code); emit(0)
+ # literal flag
+ mask = 0
+ if prefix:
+ mask = SRE_INFO_PREFIX
+ if len(prefix) == prefix_skip == len(pattern.data):
+ mask = mask + SRE_INFO_LITERAL
+ elif charset:
+ mask = mask + SRE_INFO_CHARSET
+ emit(mask)
+ # pattern length
+ if lo < MAXCODE:
+ emit(lo)
+ else:
+ emit(MAXCODE)
+ prefix = prefix[:MAXCODE]
+ if hi < MAXCODE:
+ emit(hi)
+ else:
+ emit(0)
+ # add literal prefix
+ if prefix:
+ emit(len(prefix)) # length
+ emit(prefix_skip) # skip
+ code.extend(prefix)
+ # generate overlap table
+ table = [-1] + ([0]*len(prefix))
+ for i in xrange(len(prefix)):
+ table[i+1] = table[i]+1
+ while table[i+1] > 0 and prefix[i] != prefix[table[i+1]-1]:
+ table[i+1] = table[table[i+1]-1]+1
+ code.extend(table[1:]) # don't store first entry
+ elif charset:
+ _compile_charset(charset, flags, code)
+ code[skip] = len(code) - skip
+
+try:
+ unicode
+except NameError:
+ STRING_TYPES = (type(""),)
+else:
+ STRING_TYPES = (type(""), type(unicode("")))
+
+def isstring(obj):
+ for tp in STRING_TYPES:
+ if isinstance(obj, tp):
+ return 1
+ return 0
+
+def _code(p, flags):
+
+ flags = p.pattern.flags | flags
+ code = []
+
+ # compile info block
+ _compile_info(code, p, flags)
+
+ # compile the pattern
+ _compile(code, p.data, flags)
+
+ code.append(OPCODES[SUCCESS])
+
+ return code
+
+def compile(p, flags=0):
+ # internal: convert pattern list to internal format
+
+ if isstring(p):
+ pattern = p
+ p = sre_parse.parse(p, flags)
+ else:
+ pattern = None
+
+ code = _code(p, flags)
+
+ # print code
+
+ # XXX: <fl> get rid of this limitation!
+ if p.pattern.groups > 100:
+ raise AssertionError(
+ "sorry, but this version only supports 100 named groups"
+ )
+
+ # map in either direction
+ groupindex = p.pattern.groupdict
+ indexgroup = [None] * p.pattern.groups
+ for k, i in groupindex.items():
+ indexgroup[i] = k
+
+ return _sre.compile(
+ pattern, flags | p.pattern.flags, code,
+ p.pattern.groups-1,
+ groupindex, indexgroup
+ )
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
index 0000000000..cabbda45e0
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/sre_constants.py
@@ -0,0 +1,263 @@
+#
+# Secret Labs' Regular Expression Engine
+#
+# various symbols used by the regular expression engine.
+# run this script to update the _sre include files!
+#
+# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
+#
+# See the sre.py file for information on usage and redistribution.
+#
+
+"""Internal support module for sre"""
+
+# update when constants are added or removed
+
+MAGIC = 20031017
+
+try:
+ from _sre import MAXREPEAT
+except ImportError:
+ import _sre
+ MAXREPEAT = _sre.MAXREPEAT = 65535
+
+# SRE standard exception (access as sre.error)
+# should this really be here?
+
+class error(Exception):
+ pass
+
+# operators
+
+FAILURE = "failure"
+SUCCESS = "success"
+
+ANY = "any"
+ANY_ALL = "any_all"
+ASSERT = "assert"
+ASSERT_NOT = "assert_not"
+AT = "at"
+BIGCHARSET = "bigcharset"
+BRANCH = "branch"
+CALL = "call"
+CATEGORY = "category"
+CHARSET = "charset"
+GROUPREF = "groupref"
+GROUPREF_IGNORE = "groupref_ignore"
+GROUPREF_EXISTS = "groupref_exists"
+IN = "in"
+IN_IGNORE = "in_ignore"
+INFO = "info"
+JUMP = "jump"
+LITERAL = "literal"
+LITERAL_IGNORE = "literal_ignore"
+MARK = "mark"
+MAX_REPEAT = "max_repeat"
+MAX_UNTIL = "max_until"
+MIN_REPEAT = "min_repeat"
+MIN_UNTIL = "min_until"
+NEGATE = "negate"
+NOT_LITERAL = "not_literal"
+NOT_LITERAL_IGNORE = "not_literal_ignore"
+RANGE = "range"
+REPEAT = "repeat"
+REPEAT_ONE = "repeat_one"
+SUBPATTERN = "subpattern"
+MIN_REPEAT_ONE = "min_repeat_one"
+
+# positions
+AT_BEGINNING = "at_beginning"
+AT_BEGINNING_LINE = "at_beginning_line"
+AT_BEGINNING_STRING = "at_beginning_string"
+AT_BOUNDARY = "at_boundary"
+AT_NON_BOUNDARY = "at_non_boundary"
+AT_END = "at_end"
+AT_END_LINE = "at_end_line"
+AT_END_STRING = "at_end_string"
+AT_LOC_BOUNDARY = "at_loc_boundary"
+AT_LOC_NON_BOUNDARY = "at_loc_non_boundary"
+AT_UNI_BOUNDARY = "at_uni_boundary"
+AT_UNI_NON_BOUNDARY = "at_uni_non_boundary"
+
+# categories
+CATEGORY_DIGIT = "category_digit"
+CATEGORY_NOT_DIGIT = "category_not_digit"
+CATEGORY_SPACE = "category_space"
+CATEGORY_NOT_SPACE = "category_not_space"
+CATEGORY_WORD = "category_word"
+CATEGORY_NOT_WORD = "category_not_word"
+CATEGORY_LINEBREAK = "category_linebreak"
+CATEGORY_NOT_LINEBREAK = "category_not_linebreak"
+CATEGORY_LOC_WORD = "category_loc_word"
+CATEGORY_LOC_NOT_WORD = "category_loc_not_word"
+CATEGORY_UNI_DIGIT = "category_uni_digit"
+CATEGORY_UNI_NOT_DIGIT = "category_uni_not_digit"
+CATEGORY_UNI_SPACE = "category_uni_space"
+CATEGORY_UNI_NOT_SPACE = "category_uni_not_space"
+CATEGORY_UNI_WORD = "category_uni_word"
+CATEGORY_UNI_NOT_WORD = "category_uni_not_word"
+CATEGORY_UNI_LINEBREAK = "category_uni_linebreak"
+CATEGORY_UNI_NOT_LINEBREAK = "category_uni_not_linebreak"
+
+OPCODES = [
+
+ # failure=0 success=1 (just because it looks better that way :-)
+ FAILURE, SUCCESS,
+
+ ANY, ANY_ALL,
+ ASSERT, ASSERT_NOT,
+ AT,
+ BRANCH,
+ CALL,
+ CATEGORY,
+ CHARSET, BIGCHARSET,
+ GROUPREF, GROUPREF_EXISTS, GROUPREF_IGNORE,
+ IN, IN_IGNORE,
+ INFO,
+ JUMP,
+ LITERAL, LITERAL_IGNORE,
+ MARK,
+ MAX_UNTIL,
+ MIN_UNTIL,
+ NOT_LITERAL, NOT_LITERAL_IGNORE,
+ NEGATE,
+ RANGE,
+ REPEAT,
+ REPEAT_ONE,
+ SUBPATTERN,
+ MIN_REPEAT_ONE
+
+]
+
+ATCODES = [
+ AT_BEGINNING, AT_BEGINNING_LINE, AT_BEGINNING_STRING, AT_BOUNDARY,
+ AT_NON_BOUNDARY, AT_END, AT_END_LINE, AT_END_STRING,
+ AT_LOC_BOUNDARY, AT_LOC_NON_BOUNDARY, AT_UNI_BOUNDARY,
+ AT_UNI_NON_BOUNDARY
+]
+
+CHCODES = [
+ CATEGORY_DIGIT, CATEGORY_NOT_DIGIT, CATEGORY_SPACE,
+ CATEGORY_NOT_SPACE, CATEGORY_WORD, CATEGORY_NOT_WORD,
+ CATEGORY_LINEBREAK, CATEGORY_NOT_LINEBREAK, CATEGORY_LOC_WORD,
+ CATEGORY_LOC_NOT_WORD, CATEGORY_UNI_DIGIT, CATEGORY_UNI_NOT_DIGIT,
+ CATEGORY_UNI_SPACE, CATEGORY_UNI_NOT_SPACE, CATEGORY_UNI_WORD,
+ CATEGORY_UNI_NOT_WORD, CATEGORY_UNI_LINEBREAK,
+ CATEGORY_UNI_NOT_LINEBREAK
+]
+
+def makedict(list):
+ d = {}
+ i = 0
+ for item in list:
+ d[item] = i
+ i = i + 1
+ return d
+
+OPCODES = makedict(OPCODES)
+ATCODES = makedict(ATCODES)
+CHCODES = makedict(CHCODES)
+
+# replacement operations for "ignore case" mode
+OP_IGNORE = {
+ GROUPREF: GROUPREF_IGNORE,
+ IN: IN_IGNORE,
+ LITERAL: LITERAL_IGNORE,
+ NOT_LITERAL: NOT_LITERAL_IGNORE
+}
+
+AT_MULTILINE = {
+ AT_BEGINNING: AT_BEGINNING_LINE,
+ AT_END: AT_END_LINE
+}
+
+AT_LOCALE = {
+ AT_BOUNDARY: AT_LOC_BOUNDARY,
+ AT_NON_BOUNDARY: AT_LOC_NON_BOUNDARY
+}
+
+AT_UNICODE = {
+ AT_BOUNDARY: AT_UNI_BOUNDARY,
+ AT_NON_BOUNDARY: AT_UNI_NON_BOUNDARY
+}
+
+CH_LOCALE = {
+ CATEGORY_DIGIT: CATEGORY_DIGIT,
+ CATEGORY_NOT_DIGIT: CATEGORY_NOT_DIGIT,
+ CATEGORY_SPACE: CATEGORY_SPACE,
+ CATEGORY_NOT_SPACE: CATEGORY_NOT_SPACE,
+ CATEGORY_WORD: CATEGORY_LOC_WORD,
+ CATEGORY_NOT_WORD: CATEGORY_LOC_NOT_WORD,
+ CATEGORY_LINEBREAK: CATEGORY_LINEBREAK,
+ CATEGORY_NOT_LINEBREAK: CATEGORY_NOT_LINEBREAK
+}
+
+CH_UNICODE = {
+ CATEGORY_DIGIT: CATEGORY_UNI_DIGIT,
+ CATEGORY_NOT_DIGIT: CATEGORY_UNI_NOT_DIGIT,
+ CATEGORY_SPACE: CATEGORY_UNI_SPACE,
+ CATEGORY_NOT_SPACE: CATEGORY_UNI_NOT_SPACE,
+ CATEGORY_WORD: CATEGORY_UNI_WORD,
+ CATEGORY_NOT_WORD: CATEGORY_UNI_NOT_WORD,
+ CATEGORY_LINEBREAK: CATEGORY_UNI_LINEBREAK,
+ CATEGORY_NOT_LINEBREAK: CATEGORY_UNI_NOT_LINEBREAK
+}
+
+# flags
+SRE_FLAG_TEMPLATE = 1 # template mode (disable backtracking)
+SRE_FLAG_IGNORECASE = 2 # case insensitive
+SRE_FLAG_LOCALE = 4 # honour system locale
+SRE_FLAG_MULTILINE = 8 # treat target as multiline string
+SRE_FLAG_DOTALL = 16 # treat target as a single string
+SRE_FLAG_UNICODE = 32 # use unicode locale
+SRE_FLAG_VERBOSE = 64 # ignore whitespace and comments
+SRE_FLAG_DEBUG = 128 # debugging
+
+# flags for INFO primitive
+SRE_INFO_PREFIX = 1 # has prefix
+SRE_INFO_LITERAL = 2 # entire pattern is literal (given by prefix)
+SRE_INFO_CHARSET = 4 # pattern starts with character from given set
+
+if __name__ == "__main__":
+ def dump(f, d, prefix):
+ items = d.items()
+ items.sort(key=lambda a: a[1])
+ for k, v in items:
+ f.write("#define %s_%s %s\n" % (prefix, k.upper(), v))
+ f = open("sre_constants.h", "w")
+ f.write("""\
+/*
+ * Secret Labs' Regular Expression Engine
+ *
+ * regular expression matching engine
+ *
+ * NOTE: This file is generated by sre_constants.py. If you need
+ * to change anything in here, edit sre_constants.py and run it.
+ *
+ * Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved.
+ *
+ * See the _sre.c file for information on usage and redistribution.
+ */
+
+""")
+
+ f.write("#define SRE_MAGIC %d\n" % MAGIC)
+
+ dump(f, OPCODES, "SRE_OP")
+ dump(f, ATCODES, "SRE")
+ dump(f, CHCODES, "SRE")
+
+ f.write("#define SRE_FLAG_TEMPLATE %d\n" % SRE_FLAG_TEMPLATE)
+ f.write("#define SRE_FLAG_IGNORECASE %d\n" % SRE_FLAG_IGNORECASE)
+ f.write("#define SRE_FLAG_LOCALE %d\n" % SRE_FLAG_LOCALE)
+ f.write("#define SRE_FLAG_MULTILINE %d\n" % SRE_FLAG_MULTILINE)
+ f.write("#define SRE_FLAG_DOTALL %d\n" % SRE_FLAG_DOTALL)
+ f.write("#define SRE_FLAG_UNICODE %d\n" % SRE_FLAG_UNICODE)
+ f.write("#define SRE_FLAG_VERBOSE %d\n" % SRE_FLAG_VERBOSE)
+
+ f.write("#define SRE_INFO_PREFIX %d\n" % SRE_INFO_PREFIX)
+ f.write("#define SRE_INFO_LITERAL %d\n" % SRE_INFO_LITERAL)
+ f.write("#define SRE_INFO_CHARSET %d\n" % SRE_INFO_CHARSET)
+
+ f.close()
+ print "done"
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
index 0000000000..803c09d81f
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/sre_parse.py
@@ -0,0 +1,834 @@
+#
+# Secret Labs' Regular Expression Engine
+#
+# convert re-style regular expression to sre pattern
+#
+# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
+#
+# See the sre.py file for information on usage and redistribution.
+#
+
+"""Internal support module for sre"""
+
+# XXX: show string offset and offending character for all errors
+
+import sys
+
+from sre_constants import *
+
+SPECIAL_CHARS = ".\\[{()*+?^$|"
+REPEAT_CHARS = "*+?{"
+
+DIGITS = set("0123456789")
+
+OCTDIGITS = set("01234567")
+HEXDIGITS = set("0123456789abcdefABCDEF")
+
+WHITESPACE = set(" \t\n\r\v\f")
+
+ESCAPES = {
+ r"\a": (LITERAL, ord("\a")),
+ r"\b": (LITERAL, ord("\b")),
+ r"\f": (LITERAL, ord("\f")),
+ r"\n": (LITERAL, ord("\n")),
+ r"\r": (LITERAL, ord("\r")),
+ r"\t": (LITERAL, ord("\t")),
+ r"\v": (LITERAL, ord("\v")),
+ r"\\": (LITERAL, ord("\\"))
+}
+
+CATEGORIES = {
+ r"\A": (AT, AT_BEGINNING_STRING), # start of string
+ r"\b": (AT, AT_BOUNDARY),
+ r"\B": (AT, AT_NON_BOUNDARY),
+ r"\d": (IN, [(CATEGORY, CATEGORY_DIGIT)]),
+ r"\D": (IN, [(CATEGORY, CATEGORY_NOT_DIGIT)]),
+ r"\s": (IN, [(CATEGORY, CATEGORY_SPACE)]),
+ r"\S": (IN, [(CATEGORY, CATEGORY_NOT_SPACE)]),
+ r"\w": (IN, [(CATEGORY, CATEGORY_WORD)]),
+ r"\W": (IN, [(CATEGORY, CATEGORY_NOT_WORD)]),
+ r"\Z": (AT, AT_END_STRING), # end of string
+}
+
+FLAGS = {
+ # standard flags
+ "i": SRE_FLAG_IGNORECASE,
+ "L": SRE_FLAG_LOCALE,
+ "m": SRE_FLAG_MULTILINE,
+ "s": SRE_FLAG_DOTALL,
+ "x": SRE_FLAG_VERBOSE,
+ # extensions
+ "t": SRE_FLAG_TEMPLATE,
+ "u": SRE_FLAG_UNICODE,
+}
+
+class Pattern:
+ # master pattern object. keeps track of global attributes
+ def __init__(self):
+ self.flags = 0
+ self.open = []
+ self.groups = 1
+ self.groupdict = {}
+ self.lookbehind = 0
+
+ def opengroup(self, name=None):
+ gid = self.groups
+ self.groups = gid + 1
+ if name is not None:
+ ogid = self.groupdict.get(name, None)
+ if ogid is not None:
+ raise error, ("redefinition of group name %s as group %d; "
+ "was group %d" % (repr(name), gid, ogid))
+ self.groupdict[name] = gid
+ self.open.append(gid)
+ return gid
+ def closegroup(self, gid):
+ self.open.remove(gid)
+ def checkgroup(self, gid):
+ return gid < self.groups and gid not in self.open
+
+class SubPattern:
+ # a subpattern, in intermediate form
+ def __init__(self, pattern, data=None):
+ self.pattern = pattern
+ if data is None:
+ data = []
+ self.data = data
+ self.width = None
+ def dump(self, level=0):
+ seqtypes = (tuple, list)
+ for op, av in self.data:
+ print level*" " + op,
+ if op == IN:
+ # member sublanguage
+ print
+ for op, a in av:
+ print (level+1)*" " + op, a
+ elif op == BRANCH:
+ print
+ for i, a in enumerate(av[1]):
+ if i:
+ print level*" " + "or"
+ a.dump(level+1)
+ elif op == GROUPREF_EXISTS:
+ condgroup, item_yes, item_no = av
+ print condgroup
+ item_yes.dump(level+1)
+ if item_no:
+ print level*" " + "else"
+ item_no.dump(level+1)
+ elif isinstance(av, seqtypes):
+ nl = 0
+ for a in av:
+ if isinstance(a, SubPattern):
+ if not nl:
+ print
+ a.dump(level+1)
+ nl = 1
+ else:
+ print a,
+ nl = 0
+ if not nl:
+ print
+ else:
+ print av
+ def __repr__(self):
+ return repr(self.data)
+ def __len__(self):
+ return len(self.data)
+ def __delitem__(self, index):
+ del self.data[index]
+ def __getitem__(self, index):
+ if isinstance(index, slice):
+ return SubPattern(self.pattern, self.data[index])
+ return self.data[index]
+ def __setitem__(self, index, code):
+ self.data[index] = code
+ def insert(self, index, code):
+ self.data.insert(index, code)
+ def append(self, code):
+ self.data.append(code)
+ def getwidth(self):
+ # determine the width (min, max) for this subpattern
+ if self.width:
+ return self.width
+ lo = hi = 0
+ UNITCODES = (ANY, RANGE, IN, LITERAL, NOT_LITERAL, CATEGORY)
+ REPEATCODES = (MIN_REPEAT, MAX_REPEAT)
+ for op, av in self.data:
+ if op is BRANCH:
+ i = MAXREPEAT - 1
+ j = 0
+ for av in av[1]:
+ l, h = av.getwidth()
+ i = min(i, l)
+ j = max(j, h)
+ lo = lo + i
+ hi = hi + j
+ elif op is CALL:
+ i, j = av.getwidth()
+ lo = lo + i
+ hi = hi + j
+ elif op is SUBPATTERN:
+ i, j = av[1].getwidth()
+ lo = lo + i
+ hi = hi + j
+ elif op in REPEATCODES:
+ i, j = av[2].getwidth()
+ lo = lo + i * av[0]
+ hi = hi + j * av[1]
+ elif op in UNITCODES:
+ lo = lo + 1
+ hi = hi + 1
+ elif op == SUCCESS:
+ break
+ self.width = min(lo, MAXREPEAT - 1), min(hi, MAXREPEAT)
+ return self.width
+
+class Tokenizer:
+ def __init__(self, string):
+ self.string = string
+ self.index = 0
+ self.__next()
+ def __next(self):
+ if self.index >= len(self.string):
+ self.next = None
+ return
+ char = self.string[self.index]
+ if char[0] == "\\":
+ try:
+ c = self.string[self.index + 1]
+ except IndexError:
+ raise error, "bogus escape (end of line)"
+ char = char + c
+ self.index = self.index + len(char)
+ self.next = char
+ def match(self, char, skip=1):
+ if char == self.next:
+ if skip:
+ self.__next()
+ return 1
+ return 0
+ def get(self):
+ this = self.next
+ self.__next()
+ return this
+ def tell(self):
+ return self.index, self.next
+ def seek(self, index):
+ self.index, self.next = index
+
+def isident(char):
+ return "a" <= char <= "z" or "A" <= char <= "Z" or char == "_"
+
+def isdigit(char):
+ return "0" <= char <= "9"
+
+def isname(name):
+ # check that group name is a valid string
+ if not isident(name[0]):
+ return False
+ for char in name[1:]:
+ if not isident(char) and not isdigit(char):
+ return False
+ return True
+
+def _class_escape(source, escape):
+ # handle escape code inside character class
+ code = ESCAPES.get(escape)
+ if code:
+ return code
+ code = CATEGORIES.get(escape)
+ if code and code[0] == IN:
+ return code
+ try:
+ c = escape[1:2]
+ if c == "x":
+ # hexadecimal escape (exactly two digits)
+ while source.next in HEXDIGITS and len(escape) < 4:
+ escape = escape + source.get()
+ escape = escape[2:]
+ if len(escape) != 2:
+ raise error, "bogus escape: %s" % repr("\\" + escape)
+ return LITERAL, int(escape, 16) & 0xff
+ elif c in OCTDIGITS:
+ # octal escape (up to three digits)
+ while source.next in OCTDIGITS and len(escape) < 4:
+ escape = escape + source.get()
+ escape = escape[1:]
+ return LITERAL, int(escape, 8) & 0xff
+ elif c in DIGITS:
+ raise error, "bogus escape: %s" % repr(escape)
+ if len(escape) == 2:
+ return LITERAL, ord(escape[1])
+ except ValueError:
+ pass
+ raise error, "bogus escape: %s" % repr(escape)
+
+def _escape(source, escape, state):
+ # handle escape code in expression
+ code = CATEGORIES.get(escape)
+ if code:
+ return code
+ code = ESCAPES.get(escape)
+ if code:
+ return code
+ try:
+ c = escape[1:2]
+ if c == "x":
+ # hexadecimal escape
+ while source.next in HEXDIGITS and len(escape) < 4:
+ escape = escape + source.get()
+ if len(escape) != 4:
+ raise ValueError
+ return LITERAL, int(escape[2:], 16) & 0xff
+ elif c == "0":
+ # octal escape
+ while source.next in OCTDIGITS and len(escape) < 4:
+ escape = escape + source.get()
+ return LITERAL, int(escape[1:], 8) & 0xff
+ elif c in DIGITS:
+ # octal escape *or* decimal group reference (sigh)
+ if source.next in DIGITS:
+ escape = escape + source.get()
+ if (escape[1] in OCTDIGITS and escape[2] in OCTDIGITS and
+ source.next in OCTDIGITS):
+ # got three octal digits; this is an octal escape
+ escape = escape + source.get()
+ return LITERAL, int(escape[1:], 8) & 0xff
+ # not an octal escape, so this is a group reference
+ group = int(escape[1:])
+ if group < state.groups:
+ if not state.checkgroup(group):
+ raise error, "cannot refer to open group"
+ if state.lookbehind:
+ import warnings
+ warnings.warn('group references in lookbehind '
+ 'assertions are not supported',
+ RuntimeWarning)
+ return GROUPREF, group
+ raise ValueError
+ if len(escape) == 2:
+ return LITERAL, ord(escape[1])
+ except ValueError:
+ pass
+ raise error, "bogus escape: %s" % repr(escape)
+
+def _parse_sub(source, state, nested=1):
+ # parse an alternation: a|b|c
+
+ items = []
+ itemsappend = items.append
+ sourcematch = source.match
+ while 1:
+ itemsappend(_parse(source, state))
+ if sourcematch("|"):
+ continue
+ if not nested:
+ break
+ if not source.next or sourcematch(")", 0):
+ break
+ else:
+ raise error, "pattern not properly closed"
+
+ if len(items) == 1:
+ return items[0]
+
+ subpattern = SubPattern(state)
+ subpatternappend = subpattern.append
+
+ # check if all items share a common prefix
+ while 1:
+ prefix = None
+ for item in items:
+ if not item:
+ break
+ if prefix is None:
+ prefix = item[0]
+ elif item[0] != prefix:
+ break
+ else:
+ # all subitems start with a common "prefix".
+ # move it out of the branch
+ for item in items:
+ del item[0]
+ subpatternappend(prefix)
+ continue # check next one
+ break
+
+ # check if the branch can be replaced by a character set
+ for item in items:
+ if len(item) != 1 or item[0][0] != LITERAL:
+ break
+ else:
+ # we can store this as a character set instead of a
+ # branch (the compiler may optimize this even more)
+ set = []
+ setappend = set.append
+ for item in items:
+ setappend(item[0])
+ subpatternappend((IN, set))
+ return subpattern
+
+ subpattern.append((BRANCH, (None, items)))
+ return subpattern
+
+def _parse_sub_cond(source, state, condgroup):
+ item_yes = _parse(source, state)
+ if source.match("|"):
+ item_no = _parse(source, state)
+ if source.match("|"):
+ raise error, "conditional backref with more than two branches"
+ else:
+ item_no = None
+ if source.next and not source.match(")", 0):
+ raise error, "pattern not properly closed"
+ subpattern = SubPattern(state)
+ subpattern.append((GROUPREF_EXISTS, (condgroup, item_yes, item_no)))
+ return subpattern
+
+_PATTERNENDERS = set("|)")
+_ASSERTCHARS = set("=!<")
+_LOOKBEHINDASSERTCHARS = set("=!")
+_REPEATCODES = set([MIN_REPEAT, MAX_REPEAT])
+
+def _parse(source, state):
+ # parse a simple pattern
+ subpattern = SubPattern(state)
+
+ # precompute constants into local variables
+ subpatternappend = subpattern.append
+ sourceget = source.get
+ sourcematch = source.match
+ _len = len
+ PATTERNENDERS = _PATTERNENDERS
+ ASSERTCHARS = _ASSERTCHARS
+ LOOKBEHINDASSERTCHARS = _LOOKBEHINDASSERTCHARS
+ REPEATCODES = _REPEATCODES
+
+ while 1:
+
+ if source.next in PATTERNENDERS:
+ break # end of subpattern
+ this = sourceget()
+ if this is None:
+ break # end of pattern
+
+ if state.flags & SRE_FLAG_VERBOSE:
+ # skip whitespace and comments
+ if this in WHITESPACE:
+ continue
+ if this == "#":
+ while 1:
+ this = sourceget()
+ if this in (None, "\n"):
+ break
+ continue
+
+ if this and this[0] not in SPECIAL_CHARS:
+ subpatternappend((LITERAL, ord(this)))
+
+ elif this == "[":
+ # character set
+ set = []
+ setappend = set.append
+## if sourcematch(":"):
+## pass # handle character classes
+ if sourcematch("^"):
+ setappend((NEGATE, None))
+ # check remaining characters
+ start = set[:]
+ while 1:
+ this = sourceget()
+ if this == "]" and set != start:
+ break
+ elif this and this[0] == "\\":
+ code1 = _class_escape(source, this)
+ elif this:
+ code1 = LITERAL, ord(this)
+ else:
+ raise error, "unexpected end of regular expression"
+ if sourcematch("-"):
+ # potential range
+ this = sourceget()
+ if this == "]":
+ if code1[0] is IN:
+ code1 = code1[1][0]
+ setappend(code1)
+ setappend((LITERAL, ord("-")))
+ break
+ elif this:
+ if this[0] == "\\":
+ code2 = _class_escape(source, this)
+ else:
+ code2 = LITERAL, ord(this)
+ if code1[0] != LITERAL or code2[0] != LITERAL:
+ raise error, "bad character range"
+ lo = code1[1]
+ hi = code2[1]
+ if hi < lo:
+ raise error, "bad character range"
+ setappend((RANGE, (lo, hi)))
+ else:
+ raise error, "unexpected end of regular expression"
+ else:
+ if code1[0] is IN:
+ code1 = code1[1][0]
+ setappend(code1)
+
+ # XXX: <fl> should move set optimization to compiler!
+ if _len(set)==1 and set[0][0] is LITERAL:
+ subpatternappend(set[0]) # optimization
+ elif _len(set)==2 and set[0][0] is NEGATE and set[1][0] is LITERAL:
+ subpatternappend((NOT_LITERAL, set[1][1])) # optimization
+ else:
+ # XXX: <fl> should add charmap optimization here
+ subpatternappend((IN, set))
+
+ elif this and this[0] in REPEAT_CHARS:
+ # repeat previous item
+ if this == "?":
+ min, max = 0, 1
+ elif this == "*":
+ min, max = 0, MAXREPEAT
+
+ elif this == "+":
+ min, max = 1, MAXREPEAT
+ elif this == "{":
+ if source.next == "}":
+ subpatternappend((LITERAL, ord(this)))
+ continue
+ here = source.tell()
+ min, max = 0, MAXREPEAT
+ lo = hi = ""
+ while source.next in DIGITS:
+ lo = lo + source.get()
+ if sourcematch(","):
+ while source.next in DIGITS:
+ hi = hi + sourceget()
+ else:
+ hi = lo
+ if not sourcematch("}"):
+ subpatternappend((LITERAL, ord(this)))
+ source.seek(here)
+ continue
+ if lo:
+ min = int(lo)
+ if min >= MAXREPEAT:
+ raise OverflowError("the repetition number is too large")
+ if hi:
+ max = int(hi)
+ if max >= MAXREPEAT:
+ raise OverflowError("the repetition number is too large")
+ if max < min:
+ raise error("bad repeat interval")
+ else:
+ raise error, "not supported"
+ # figure out which item to repeat
+ if subpattern:
+ item = subpattern[-1:]
+ else:
+ item = None
+ if not item or (_len(item) == 1 and item[0][0] == AT):
+ raise error, "nothing to repeat"
+ if item[0][0] in REPEATCODES:
+ raise error, "multiple repeat"
+ if sourcematch("?"):
+ subpattern[-1] = (MIN_REPEAT, (min, max, item))
+ else:
+ subpattern[-1] = (MAX_REPEAT, (min, max, item))
+
+ elif this == ".":
+ subpatternappend((ANY, None))
+
+ elif this == "(":
+ group = 1
+ name = None
+ condgroup = None
+ if sourcematch("?"):
+ group = 0
+ # options
+ if sourcematch("P"):
+ # python extensions
+ if sourcematch("<"):
+ # named group: skip forward to end of name
+ name = ""
+ while 1:
+ char = sourceget()
+ if char is None:
+ raise error, "unterminated name"
+ if char == ">":
+ break
+ name = name + char
+ group = 1
+ if not name:
+ raise error("missing group name")
+ if not isname(name):
+ raise error("bad character in group name %r" %
+ name)
+ elif sourcematch("="):
+ # named backreference
+ name = ""
+ while 1:
+ char = sourceget()
+ if char is None:
+ raise error, "unterminated name"
+ if char == ")":
+ break
+ name = name + char
+ if not name:
+ raise error("missing group name")
+ if not isname(name):
+ raise error("bad character in backref group name "
+ "%r" % name)
+ gid = state.groupdict.get(name)
+ if gid is None:
+ msg = "unknown group name: {0!r}".format(name)
+ raise error(msg)
+ if state.lookbehind:
+ import warnings
+ warnings.warn('group references in lookbehind '
+ 'assertions are not supported',
+ RuntimeWarning)
+ subpatternappend((GROUPREF, gid))
+ continue
+ else:
+ char = sourceget()
+ if char is None:
+ raise error, "unexpected end of pattern"
+ raise error, "unknown specifier: ?P%s" % char
+ elif sourcematch(":"):
+ # non-capturing group
+ group = 2
+ elif sourcematch("#"):
+ # comment
+ while 1:
+ if source.next is None or source.next == ")":
+ break
+ sourceget()
+ if not sourcematch(")"):
+ raise error, "unbalanced parenthesis"
+ continue
+ elif source.next in ASSERTCHARS:
+ # lookahead assertions
+ char = sourceget()
+ dir = 1
+ if char == "<":
+ if source.next not in LOOKBEHINDASSERTCHARS:
+ raise error, "syntax error"
+ dir = -1 # lookbehind
+ char = sourceget()
+ state.lookbehind += 1
+ p = _parse_sub(source, state)
+ if dir < 0:
+ state.lookbehind -= 1
+ if not sourcematch(")"):
+ raise error, "unbalanced parenthesis"
+ if char == "=":
+ subpatternappend((ASSERT, (dir, p)))
+ else:
+ subpatternappend((ASSERT_NOT, (dir, p)))
+ continue
+ elif sourcematch("("):
+ # conditional backreference group
+ condname = ""
+ while 1:
+ char = sourceget()
+ if char is None:
+ raise error, "unterminated name"
+ if char == ")":
+ break
+ condname = condname + char
+ group = 2
+ if not condname:
+ raise error("missing group name")
+ if isname(condname):
+ condgroup = state.groupdict.get(condname)
+ if condgroup is None:
+ msg = "unknown group name: {0!r}".format(condname)
+ raise error(msg)
+ else:
+ try:
+ condgroup = int(condname)
+ except ValueError:
+ raise error, "bad character in group name"
+ if state.lookbehind:
+ import warnings
+ warnings.warn('group references in lookbehind '
+ 'assertions are not supported',
+ RuntimeWarning)
+ else:
+ # flags
+ if not source.next in FLAGS:
+ raise error, "unexpected end of pattern"
+ while source.next in FLAGS:
+ state.flags = state.flags | FLAGS[sourceget()]
+ if group:
+ # parse group contents
+ if group == 2:
+ # anonymous group
+ group = None
+ else:
+ group = state.opengroup(name)
+ if condgroup:
+ p = _parse_sub_cond(source, state, condgroup)
+ else:
+ p = _parse_sub(source, state)
+ if not sourcematch(")"):
+ raise error, "unbalanced parenthesis"
+ if group is not None:
+ state.closegroup(group)
+ subpatternappend((SUBPATTERN, (group, p)))
+ else:
+ while 1:
+ char = sourceget()
+ if char is None:
+ raise error, "unexpected end of pattern"
+ if char == ")":
+ break
+ raise error, "unknown extension"
+
+ elif this == "^":
+ subpatternappend((AT, AT_BEGINNING))
+
+ elif this == "$":
+ subpattern.append((AT, AT_END))
+
+ elif this and this[0] == "\\":
+ code = _escape(source, this, state)
+ subpatternappend(code)
+
+ else:
+ raise error, "parser error"
+
+ return subpattern
+
+def parse(str, flags=0, pattern=None):
+ # parse 're' pattern into list of (opcode, argument) tuples
+
+ source = Tokenizer(str)
+
+ if pattern is None:
+ pattern = Pattern()
+ pattern.flags = flags
+ pattern.str = str
+
+ p = _parse_sub(source, pattern, 0)
+
+ tail = source.get()
+ if tail == ")":
+ raise error, "unbalanced parenthesis"
+ elif tail:
+ raise error, "bogus characters at end of regular expression"
+
+ if flags & SRE_FLAG_DEBUG:
+ p.dump()
+
+ if not (flags & SRE_FLAG_VERBOSE) and p.pattern.flags & SRE_FLAG_VERBOSE:
+ # the VERBOSE flag was switched on inside the pattern. to be
+ # on the safe side, we'll parse the whole thing again...
+ return parse(str, p.pattern.flags)
+
+ return p
+
+def parse_template(source, pattern):
+ # parse 're' replacement string into list of literals and
+ # group references
+ s = Tokenizer(source)
+ sget = s.get
+ p = []
+ a = p.append
+ def literal(literal, p=p, pappend=a):
+ if p and p[-1][0] is LITERAL:
+ p[-1] = LITERAL, p[-1][1] + literal
+ else:
+ pappend((LITERAL, literal))
+ sep = source[:0]
+ if type(sep) is type(""):
+ makechar = chr
+ else:
+ makechar = unichr
+ while 1:
+ this = sget()
+ if this is None:
+ break # end of replacement string
+ if this and this[0] == "\\":
+ # group
+ c = this[1:2]
+ if c == "g":
+ name = ""
+ if s.match("<"):
+ while 1:
+ char = sget()
+ if char is None:
+ raise error, "unterminated group name"
+ if char == ">":
+ break
+ name = name + char
+ if not name:
+ raise error, "missing group name"
+ try:
+ index = int(name)
+ if index < 0:
+ raise error, "negative group number"
+ except ValueError:
+ if not isname(name):
+ raise error, "bad character in group name"
+ try:
+ index = pattern.groupindex[name]
+ except KeyError:
+ msg = "unknown group name: {0!r}".format(name)
+ raise IndexError(msg)
+ a((MARK, index))
+ elif c == "0":
+ if s.next in OCTDIGITS:
+ this = this + sget()
+ if s.next in OCTDIGITS:
+ this = this + sget()
+ literal(makechar(int(this[1:], 8) & 0xff))
+ elif c in DIGITS:
+ isoctal = False
+ if s.next in DIGITS:
+ this = this + sget()
+ if (c in OCTDIGITS and this[2] in OCTDIGITS and
+ s.next in OCTDIGITS):
+ this = this + sget()
+ isoctal = True
+ literal(makechar(int(this[1:], 8) & 0xff))
+ if not isoctal:
+ a((MARK, int(this[1:])))
+ else:
+ try:
+ this = makechar(ESCAPES[this][1])
+ except KeyError:
+ pass
+ literal(this)
+ else:
+ literal(this)
+ # convert template to groups and literals lists
+ i = 0
+ groups = []
+ groupsappend = groups.append
+ literals = [None] * len(p)
+ for c, s in p:
+ if c is MARK:
+ groupsappend((i, s))
+ # literal[i] is already None
+ else:
+ literals[i] = s
+ i = i + 1
+ return groups, literals
+
+def expand_template(template, match):
+ g = match.group
+ sep = match.string[:0]
+ groups, literals = template
+ literals = literals[:]
+ try:
+ for index, group in groups:
+ literals[index] = s = g(group)
+ if s is None:
+ raise error, "unmatched group"
+ except IndexError:
+ raise error, "invalid group reference"
+ return sep.join(literals)
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
index 0000000000..e917fc17e4
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/stat.py
@@ -0,0 +1,96 @@
+"""Constants/functions for interpreting results of os.stat() and os.lstat().
+
+Suggested usage: from stat import *
+"""
+
+# Indices for stat struct members in the tuple returned by os.stat()
+
+ST_MODE = 0
+ST_INO = 1
+ST_DEV = 2
+ST_NLINK = 3
+ST_UID = 4
+ST_GID = 5
+ST_SIZE = 6
+ST_ATIME = 7
+ST_MTIME = 8
+ST_CTIME = 9
+
+# Extract bits from the mode
+
+def S_IMODE(mode):
+ return mode & 07777
+
+def S_IFMT(mode):
+ return mode & 0170000
+
+# Constants used as S_IFMT() for various file types
+# (not all are implemented on all systems)
+
+S_IFDIR = 0040000
+S_IFCHR = 0020000
+S_IFBLK = 0060000
+S_IFREG = 0100000
+S_IFIFO = 0010000
+S_IFLNK = 0120000
+S_IFSOCK = 0140000
+
+# Functions to test for each file type
+
+def S_ISDIR(mode):
+ return S_IFMT(mode) == S_IFDIR
+
+def S_ISCHR(mode):
+ return S_IFMT(mode) == S_IFCHR
+
+def S_ISBLK(mode):
+ return S_IFMT(mode) == S_IFBLK
+
+def S_ISREG(mode):
+ return S_IFMT(mode) == S_IFREG
+
+def S_ISFIFO(mode):
+ return S_IFMT(mode) == S_IFIFO
+
+def S_ISLNK(mode):
+ return S_IFMT(mode) == S_IFLNK
+
+def S_ISSOCK(mode):
+ return S_IFMT(mode) == S_IFSOCK
+
+# Names for permission bits
+
+S_ISUID = 04000
+S_ISGID = 02000
+S_ENFMT = S_ISGID
+S_ISVTX = 01000
+S_IREAD = 00400
+S_IWRITE = 00200
+S_IEXEC = 00100
+S_IRWXU = 00700
+S_IRUSR = 00400
+S_IWUSR = 00200
+S_IXUSR = 00100
+S_IRWXG = 00070
+S_IRGRP = 00040
+S_IWGRP = 00020
+S_IXGRP = 00010
+S_IRWXO = 00007
+S_IROTH = 00004
+S_IWOTH = 00002
+S_IXOTH = 00001
+
+# Names for file flags
+
+UF_NODUMP = 0x00000001
+UF_IMMUTABLE = 0x00000002
+UF_APPEND = 0x00000004
+UF_OPAQUE = 0x00000008
+UF_NOUNLINK = 0x00000010
+UF_COMPRESSED = 0x00000020 # OS X: file is hfs-compressed
+UF_HIDDEN = 0x00008000 # OS X: file should not be displayed
+SF_ARCHIVED = 0x00010000
+SF_IMMUTABLE = 0x00020000
+SF_APPEND = 0x00040000
+SF_NOUNLINK = 0x00100000
+SF_SNAPSHOT = 0x00200000
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
index 0000000000..3509872863
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/string.py
@@ -0,0 +1,656 @@
+"""A collection of string operations (most are no longer used).
+
+Warning: most of the code you see here isn't normally used nowadays.
+Beginning with Python 1.6, many of these functions are implemented as
+methods on the standard string object. They used to be implemented by
+a built-in module called strop, but strop is now obsolete itself.
+
+Public module variables:
+
+whitespace -- a string containing all characters considered whitespace
+lowercase -- a string containing all characters considered lowercase letters
+uppercase -- a string containing all characters considered uppercase letters
+letters -- a string containing all characters considered letters
+digits -- a string containing all characters considered decimal digits
+hexdigits -- a string containing all characters considered hexadecimal digits
+octdigits -- a string containing all characters considered octal digits
+punctuation -- a string containing all characters considered punctuation
+printable -- a string containing all characters considered printable
+
+"""
+
+# Some strings for ctype-style character classification
+whitespace = ' \t\n\r\v\f'
+lowercase = 'abcdefghijklmnopqrstuvwxyz'
+uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+letters = lowercase + uppercase
+ascii_lowercase = lowercase
+ascii_uppercase = uppercase
+ascii_letters = ascii_lowercase + ascii_uppercase
+digits = '0123456789'
+hexdigits = digits + 'abcdef' + 'ABCDEF'
+octdigits = '01234567'
+punctuation = """!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~"""
+printable = digits + letters + punctuation + whitespace
+
+# Case conversion helpers
+# Use str to convert Unicode literal in case of -U
+l = map(chr, xrange(256))
+_idmap = str('').join(l)
+del l
+
+# Functions which aren't available as string methods.
+
+# Capitalize the words in a string, e.g. " aBc dEf " -> "Abc Def".
+def capwords(s, sep=None):
+ """capwords(s [,sep]) -> string
+
+ Split the argument into words using split, capitalize each
+ word using capitalize, and join the capitalized words using
+ join. If the optional second argument sep is absent or None,
+ runs of whitespace characters are replaced by a single space
+ and leading and trailing whitespace are removed, otherwise
+ sep is used to split and join the words.
+
+ """
+ return (sep or ' ').join(x.capitalize() for x in s.split(sep))
+
+
+# Construct a translation string
+_idmapL = None
+def maketrans(fromstr, tostr):
+ """maketrans(frm, to) -> string
+
+ Return a translation table (a string of 256 bytes long)
+ suitable for use in string.translate. The strings frm and to
+ must be of the same length.
+
+ """
+ if len(fromstr) != len(tostr):
+ raise ValueError, "maketrans arguments must have same length"
+ global _idmapL
+ if not _idmapL:
+ _idmapL = list(_idmap)
+ L = _idmapL[:]
+ fromstr = map(ord, fromstr)
+ for i in range(len(fromstr)):
+ L[fromstr[i]] = tostr[i]
+ return ''.join(L)
+
+
+
+####################################################################
+import re as _re
+
+class _multimap:
+ """Helper class for combining multiple mappings.
+
+ Used by .{safe_,}substitute() to combine the mapping and keyword
+ arguments.
+ """
+ def __init__(self, primary, secondary):
+ self._primary = primary
+ self._secondary = secondary
+
+ def __getitem__(self, key):
+ try:
+ return self._primary[key]
+ except KeyError:
+ return self._secondary[key]
+
+
+class _TemplateMetaclass(type):
+ pattern = r"""
+ %(delim)s(?:
+ (?P<escaped>%(delim)s) | # Escape sequence of two delimiters
+ (?P<named>%(id)s) | # delimiter and a Python identifier
+ {(?P<braced>%(id)s)} | # delimiter and a braced identifier
+ (?P<invalid>) # Other ill-formed delimiter exprs
+ )
+ """
+
+ def __init__(cls, name, bases, dct):
+ super(_TemplateMetaclass, cls).__init__(name, bases, dct)
+ if 'pattern' in dct:
+ pattern = cls.pattern
+ else:
+ pattern = _TemplateMetaclass.pattern % {
+ 'delim' : _re.escape(cls.delimiter),
+ 'id' : cls.idpattern,
+ }
+ cls.pattern = _re.compile(pattern, _re.IGNORECASE | _re.VERBOSE)
+
+
+class Template:
+ """A string class for supporting $-substitutions."""
+ __metaclass__ = _TemplateMetaclass
+
+ delimiter = '$'
+ idpattern = r'[_a-z][_a-z0-9]*'
+
+ def __init__(self, template):
+ self.template = template
+
+ # Search for $$, $identifier, ${identifier}, and any bare $'s
+
+ def _invalid(self, mo):
+ i = mo.start('invalid')
+ lines = self.template[:i].splitlines(True)
+ if not lines:
+ colno = 1
+ lineno = 1
+ else:
+ colno = i - len(''.join(lines[:-1]))
+ lineno = len(lines)
+ raise ValueError('Invalid placeholder in string: line %d, col %d' %
+ (lineno, colno))
+
+ def substitute(*args, **kws):
+ if not args:
+ raise TypeError("descriptor 'substitute' of 'Template' object "
+ "needs an argument")
+ self, args = args[0], args[1:] # allow the "self" keyword be passed
+ if len(args) > 1:
+ raise TypeError('Too many positional arguments')
+ if not args:
+ mapping = kws
+ elif kws:
+ mapping = _multimap(kws, args[0])
+ else:
+ mapping = args[0]
+ # Helper function for .sub()
+ def convert(mo):
+ # Check the most common path first.
+ named = mo.group('named') or mo.group('braced')
+ if named is not None:
+ val = mapping[named]
+ # We use this idiom instead of str() because the latter will
+ # fail if val is a Unicode containing non-ASCII characters.
+ return '%s' % (val,)
+ if mo.group('escaped') is not None:
+ return self.delimiter
+ if mo.group('invalid') is not None:
+ self._invalid(mo)
+ raise ValueError('Unrecognized named group in pattern',
+ self.pattern)
+ return self.pattern.sub(convert, self.template)
+
+ def safe_substitute(*args, **kws):
+ if not args:
+ raise TypeError("descriptor 'safe_substitute' of 'Template' object "
+ "needs an argument")
+ self, args = args[0], args[1:] # allow the "self" keyword be passed
+ if len(args) > 1:
+ raise TypeError('Too many positional arguments')
+ if not args:
+ mapping = kws
+ elif kws:
+ mapping = _multimap(kws, args[0])
+ else:
+ mapping = args[0]
+ # Helper function for .sub()
+ def convert(mo):
+ named = mo.group('named') or mo.group('braced')
+ if named is not None:
+ try:
+ # We use this idiom instead of str() because the latter
+ # will fail if val is a Unicode containing non-ASCII
+ return '%s' % (mapping[named],)
+ except KeyError:
+ return mo.group()
+ if mo.group('escaped') is not None:
+ return self.delimiter
+ if mo.group('invalid') is not None:
+ return mo.group()
+ raise ValueError('Unrecognized named group in pattern',
+ self.pattern)
+ return self.pattern.sub(convert, self.template)
+
+
+
+####################################################################
+# NOTE: Everything below here is deprecated. Use string methods instead.
+# This stuff will go away in Python 3.0.
+
+# Backward compatible names for exceptions
+index_error = ValueError
+atoi_error = ValueError
+atof_error = ValueError
+atol_error = ValueError
+
+# convert UPPER CASE letters to lower case
+def lower(s):
+ """lower(s) -> string
+
+ Return a copy of the string s converted to lowercase.
+
+ """
+ return s.lower()
+
+# Convert lower case letters to UPPER CASE
+def upper(s):
+ """upper(s) -> string
+
+ Return a copy of the string s converted to uppercase.
+
+ """
+ return s.upper()
+
+# Swap lower case letters and UPPER CASE
+def swapcase(s):
+ """swapcase(s) -> string
+
+ Return a copy of the string s with upper case characters
+ converted to lowercase and vice versa.
+
+ """
+ return s.swapcase()
+
+# Strip leading and trailing tabs and spaces
+def strip(s, chars=None):
+ """strip(s [,chars]) -> string
+
+ Return a copy of the string s with leading and trailing
+ whitespace removed.
+ If chars is given and not None, remove characters in chars instead.
+ If chars is unicode, S will be converted to unicode before stripping.
+
+ """
+ return s.strip(chars)
+
+# Strip leading tabs and spaces
+def lstrip(s, chars=None):
+ """lstrip(s [,chars]) -> string
+
+ Return a copy of the string s with leading whitespace removed.
+ If chars is given and not None, remove characters in chars instead.
+
+ """
+ return s.lstrip(chars)
+
+# Strip trailing tabs and spaces
+def rstrip(s, chars=None):
+ """rstrip(s [,chars]) -> string
+
+ Return a copy of the string s with trailing whitespace removed.
+ If chars is given and not None, remove characters in chars instead.
+
+ """
+ return s.rstrip(chars)
+
+
+# Split a string into a list of space/tab-separated words
+def split(s, sep=None, maxsplit=-1):
+ """split(s [,sep [,maxsplit]]) -> list of strings
+
+ Return a list of the words in the string s, using sep as the
+ delimiter string. If maxsplit is given, splits at no more than
+ maxsplit places (resulting in at most maxsplit+1 words). If sep
+ is not specified or is None, any whitespace string is a separator.
+
+ (split and splitfields are synonymous)
+
+ """
+ return s.split(sep, maxsplit)
+splitfields = split
+
+# Split a string into a list of space/tab-separated words
+def rsplit(s, sep=None, maxsplit=-1):
+ """rsplit(s [,sep [,maxsplit]]) -> list of strings
+
+ Return a list of the words in the string s, using sep as the
+ delimiter string, starting at the end of the string and working
+ to the front. If maxsplit is given, at most maxsplit splits are
+ done. If sep is not specified or is None, any whitespace string
+ is a separator.
+ """
+ return s.rsplit(sep, maxsplit)
+
+# Join fields with optional separator
+def join(words, sep = ' '):
+ """join(list [,sep]) -> string
+
+ Return a string composed of the words in list, with
+ intervening occurrences of sep. The default separator is a
+ single space.
+
+ (joinfields and join are synonymous)
+
+ """
+ return sep.join(words)
+joinfields = join
+
+# Find substring, raise exception if not found
+def index(s, *args):
+ """index(s, sub [,start [,end]]) -> int
+
+ Like find but raises ValueError when the substring is not found.
+
+ """
+ return s.index(*args)
+
+# Find last substring, raise exception if not found
+def rindex(s, *args):
+ """rindex(s, sub [,start [,end]]) -> int
+
+ Like rfind but raises ValueError when the substring is not found.
+
+ """
+ return s.rindex(*args)
+
+# Count non-overlapping occurrences of substring
+def count(s, *args):
+ """count(s, sub[, start[,end]]) -> int
+
+ Return the number of occurrences of substring sub in string
+ s[start:end]. Optional arguments start and end are
+ interpreted as in slice notation.
+
+ """
+ return s.count(*args)
+
+# Find substring, return -1 if not found
+def find(s, *args):
+ """find(s, sub [,start [,end]]) -> in
+
+ Return the lowest index in s where substring sub is found,
+ such that sub is contained within s[start,end]. Optional
+ arguments start and end are interpreted as in slice notation.
+
+ Return -1 on failure.
+
+ """
+ return s.find(*args)
+
+# Find last substring, return -1 if not found
+def rfind(s, *args):
+ """rfind(s, sub [,start [,end]]) -> int
+
+ Return the highest index in s where substring sub is found,
+ such that sub is contained within s[start,end]. Optional
+ arguments start and end are interpreted as in slice notation.
+
+ Return -1 on failure.
+
+ """
+ return s.rfind(*args)
+
+# for a bit of speed
+_float = float
+_int = int
+_long = long
+
+# Convert string to float
+def atof(s):
+ """atof(s) -> float
+
+ Return the floating point number represented by the string s.
+
+ """
+ return _float(s)
+
+
+# Convert string to integer
+def atoi(s , base=10):
+ """atoi(s [,base]) -> int
+
+ Return the integer represented by the string s in the given
+ base, which defaults to 10. The string s must consist of one
+ or more digits, possibly preceded by a sign. If base is 0, it
+ is chosen from the leading characters of s, 0 for octal, 0x or
+ 0X for hexadecimal. If base is 16, a preceding 0x or 0X is
+ accepted.
+
+ """
+ return _int(s, base)
+
+
+# Convert string to long integer
+def atol(s, base=10):
+ """atol(s [,base]) -> long
+
+ Return the long integer represented by the string s in the
+ given base, which defaults to 10. The string s must consist
+ of one or more digits, possibly preceded by a sign. If base
+ is 0, it is chosen from the leading characters of s, 0 for
+ octal, 0x or 0X for hexadecimal. If base is 16, a preceding
+ 0x or 0X is accepted. A trailing L or l is not accepted,
+ unless base is 0.
+
+ """
+ return _long(s, base)
+
+
+# Left-justify a string
+def ljust(s, width, *args):
+ """ljust(s, width[, fillchar]) -> string
+
+ Return a left-justified version of s, in a field of the
+ specified width, padded with spaces as needed. The string is
+ never truncated. If specified the fillchar is used instead of spaces.
+
+ """
+ return s.ljust(width, *args)
+
+# Right-justify a string
+def rjust(s, width, *args):
+ """rjust(s, width[, fillchar]) -> string
+
+ Return a right-justified version of s, in a field of the
+ specified width, padded with spaces as needed. The string is
+ never truncated. If specified the fillchar is used instead of spaces.
+
+ """
+ return s.rjust(width, *args)
+
+# Center a string
+def center(s, width, *args):
+ """center(s, width[, fillchar]) -> string
+
+ Return a center version of s, in a field of the specified
+ width. padded with spaces as needed. The string is never
+ truncated. If specified the fillchar is used instead of spaces.
+
+ """
+ return s.center(width, *args)
+
+# Zero-fill a number, e.g., (12, 3) --> '012' and (-3, 3) --> '-03'
+# Decadent feature: the argument may be a string or a number
+# (Use of this is deprecated; it should be a string as with ljust c.s.)
+def zfill(x, width):
+ """zfill(x, width) -> string
+
+ Pad a numeric string x with zeros on the left, to fill a field
+ of the specified width. The string x is never truncated.
+
+ """
+ if not isinstance(x, basestring):
+ x = repr(x)
+ return x.zfill(width)
+
+# Expand tabs in a string.
+# Doesn't take non-printing chars into account, but does understand \n.
+def expandtabs(s, tabsize=8):
+ """expandtabs(s [,tabsize]) -> string
+
+ Return a copy of the string s with all tab characters replaced
+ by the appropriate number of spaces, depending on the current
+ column, and the tabsize (default 8).
+
+ """
+ return s.expandtabs(tabsize)
+
+# Character translation through look-up table.
+def translate(s, table, deletions=""):
+ """translate(s,table [,deletions]) -> string
+
+ Return a copy of the string s, where all characters occurring
+ in the optional argument deletions are removed, and the
+ remaining characters have been mapped through the given
+ translation table, which must be a string of length 256. The
+ deletions argument is not allowed for Unicode strings.
+
+ """
+ if deletions or table is None:
+ return s.translate(table, deletions)
+ else:
+ # Add s[:0] so that if s is Unicode and table is an 8-bit string,
+ # table is converted to Unicode. This means that table *cannot*
+ # be a dictionary -- for that feature, use u.translate() directly.
+ return s.translate(table + s[:0])
+
+# Capitalize a string, e.g. "aBc dEf" -> "Abc def".
+def capitalize(s):
+ """capitalize(s) -> string
+
+ Return a copy of the string s with only its first character
+ capitalized.
+
+ """
+ return s.capitalize()
+
+# Substring replacement (global)
+def replace(s, old, new, maxreplace=-1):
+ """replace (str, old, new[, maxreplace]) -> string
+
+ Return a copy of string str with all occurrences of substring
+ old replaced by new. If the optional argument maxreplace is
+ given, only the first maxreplace occurrences are replaced.
+
+ """
+ return s.replace(old, new, maxreplace)
+
+
+# Try importing optional built-in module "strop" -- if it exists,
+# it redefines some string operations that are 100-1000 times faster.
+# It also defines values for whitespace, lowercase and uppercase
+# that match <ctype.h>'s definitions.
+
+try:
+ from strop import maketrans, lowercase, uppercase, whitespace
+ letters = lowercase + uppercase
+except ImportError:
+ pass # Use the original versions
+
+########################################################################
+# the Formatter class
+# see PEP 3101 for details and purpose of this class
+
+# The hard parts are reused from the C implementation. They're exposed as "_"
+# prefixed methods of str and unicode.
+
+# The overall parser is implemented in str._formatter_parser.
+# The field name parser is implemented in str._formatter_field_name_split
+
+class Formatter(object):
+ def format(*args, **kwargs):
+ if not args:
+ raise TypeError("descriptor 'format' of 'Formatter' object "
+ "needs an argument")
+ self, args = args[0], args[1:] # allow the "self" keyword be passed
+ try:
+ format_string, args = args[0], args[1:] # allow the "format_string" keyword be passed
+ except IndexError:
+ if 'format_string' in kwargs:
+ format_string = kwargs.pop('format_string')
+ else:
+ raise TypeError("format() missing 1 required positional "
+ "argument: 'format_string'")
+ return self.vformat(format_string, args, kwargs)
+
+ def vformat(self, format_string, args, kwargs):
+ used_args = set()
+ result = self._vformat(format_string, args, kwargs, used_args, 2)
+ self.check_unused_args(used_args, args, kwargs)
+ return result
+
+ def _vformat(self, format_string, args, kwargs, used_args, recursion_depth):
+ if recursion_depth < 0:
+ raise ValueError('Max string recursion exceeded')
+ result = []
+ for literal_text, field_name, format_spec, conversion in \
+ self.parse(format_string):
+
+ # output the literal text
+ if literal_text:
+ result.append(literal_text)
+
+ # if there's a field, output it
+ if field_name is not None:
+ # this is some markup, find the object and do
+ # the formatting
+
+ # given the field_name, find the object it references
+ # and the argument it came from
+ obj, arg_used = self.get_field(field_name, args, kwargs)
+ used_args.add(arg_used)
+
+ # do any conversion on the resulting object
+ obj = self.convert_field(obj, conversion)
+
+ # expand the format spec, if needed
+ format_spec = self._vformat(format_spec, args, kwargs,
+ used_args, recursion_depth-1)
+
+ # format the object and append to the result
+ result.append(self.format_field(obj, format_spec))
+
+ return ''.join(result)
+
+
+ def get_value(self, key, args, kwargs):
+ if isinstance(key, (int, long)):
+ return args[key]
+ else:
+ return kwargs[key]
+
+
+ def check_unused_args(self, used_args, args, kwargs):
+ pass
+
+
+ def format_field(self, value, format_spec):
+ return format(value, format_spec)
+
+
+ def convert_field(self, value, conversion):
+ # do any conversion on the resulting object
+ if conversion is None:
+ return value
+ elif conversion == 's':
+ return str(value)
+ elif conversion == 'r':
+ return repr(value)
+ raise ValueError("Unknown conversion specifier {0!s}".format(conversion))
+
+
+ # returns an iterable that contains tuples of the form:
+ # (literal_text, field_name, format_spec, conversion)
+ # literal_text can be zero length
+ # field_name can be None, in which case there's no
+ # object to format and output
+ # if field_name is not None, it is looked up, formatted
+ # with format_spec and conversion and then used
+ def parse(self, format_string):
+ return format_string._formatter_parser()
+
+
+ # given a field_name, find the object it references.
+ # field_name: the field being looked up, e.g. "0.name"
+ # or "lookup[3]"
+ # used_args: a set of which args have been used
+ # args, kwargs: as passed in to vformat
+ def get_field(self, field_name, args, kwargs):
+ first, rest = field_name._formatter_field_name_split()
+
+ obj = self.get_value(first, args, kwargs)
+
+ # loop through the rest of the field_name, doing
+ # getattr or getitem as needed
+ for is_attr, i in rest:
+ if is_attr:
+ obj = getattr(obj, i)
+ else:
+ obj = obj[i]
+
+ return obj, first
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
index 0000000000..f7c44e93ff
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/struct.py
@@ -0,0 +1,3 @@
+from _struct import *
+from _struct import _clearcache
+from _struct import __doc__
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
index 0000000000..f365443cf1
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/sysconfig.py
@@ -0,0 +1,640 @@
+"""Provide access to Python's configuration information.
+
+"""
+import sys
+import os
+from os.path import pardir, realpath
+
+_INSTALL_SCHEMES = {
+ 'posix_prefix': {
+ 'stdlib': '{base}/lib/python{py_version_short}',
+ 'platstdlib': '{platbase}/lib/python{py_version_short}',
+ 'purelib': '{base}/lib/python{py_version_short}/site-packages',
+ 'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
+ 'include': '{base}/include/python{py_version_short}',
+ 'platinclude': '{platbase}/include/python{py_version_short}',
+ 'scripts': '{base}/bin',
+ 'data': '{base}',
+ },
+ 'posix_home': {
+ 'stdlib': '{base}/lib/python',
+ 'platstdlib': '{base}/lib/python',
+ 'purelib': '{base}/lib/python',
+ 'platlib': '{base}/lib/python',
+ 'include': '{base}/include/python',
+ 'platinclude': '{base}/include/python',
+ 'scripts': '{base}/bin',
+ 'data' : '{base}',
+ },
+ 'nt': {
+ 'stdlib': '{base}/Lib',
+ 'platstdlib': '{base}/Lib',
+ 'purelib': '{base}/Lib/site-packages',
+ 'platlib': '{base}/Lib/site-packages',
+ 'include': '{base}/Include',
+ 'platinclude': '{base}/Include',
+ 'scripts': '{base}/Scripts',
+ 'data' : '{base}',
+ },
+ 'os2': {
+ 'stdlib': '{base}/Lib',
+ 'platstdlib': '{base}/Lib',
+ 'purelib': '{base}/Lib/site-packages',
+ 'platlib': '{base}/Lib/site-packages',
+ 'include': '{base}/Include',
+ 'platinclude': '{base}/Include',
+ 'scripts': '{base}/Scripts',
+ 'data' : '{base}',
+ },
+ 'os2_home': {
+ 'stdlib': '{userbase}/lib/python{py_version_short}',
+ 'platstdlib': '{userbase}/lib/python{py_version_short}',
+ 'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
+ 'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
+ 'include': '{userbase}/include/python{py_version_short}',
+ 'scripts': '{userbase}/bin',
+ 'data' : '{userbase}',
+ },
+ 'nt_user': {
+ 'stdlib': '{userbase}/Python{py_version_nodot}',
+ 'platstdlib': '{userbase}/Python{py_version_nodot}',
+ 'purelib': '{userbase}/Python{py_version_nodot}/site-packages',
+ 'platlib': '{userbase}/Python{py_version_nodot}/site-packages',
+ 'include': '{userbase}/Python{py_version_nodot}/Include',
+ 'scripts': '{userbase}/Scripts',
+ 'data' : '{userbase}',
+ },
+ 'posix_user': {
+ 'stdlib': '{userbase}/lib/python{py_version_short}',
+ 'platstdlib': '{userbase}/lib/python{py_version_short}',
+ 'purelib': '{userbase}/lib/python{py_version_short}/site-packages',
+ 'platlib': '{userbase}/lib/python{py_version_short}/site-packages',
+ 'include': '{userbase}/include/python{py_version_short}',
+ 'scripts': '{userbase}/bin',
+ 'data' : '{userbase}',
+ },
+ 'osx_framework_user': {
+ 'stdlib': '{userbase}/lib/python',
+ 'platstdlib': '{userbase}/lib/python',
+ 'purelib': '{userbase}/lib/python/site-packages',
+ 'platlib': '{userbase}/lib/python/site-packages',
+ 'include': '{userbase}/include',
+ 'scripts': '{userbase}/bin',
+ 'data' : '{userbase}',
+ },
+ }
+
+_SCHEME_KEYS = ('stdlib', 'platstdlib', 'purelib', 'platlib', 'include',
+ 'scripts', 'data')
+_PY_VERSION = sys.version.split()[0]
+_PY_VERSION_SHORT = sys.version[:3]
+_PY_VERSION_SHORT_NO_DOT = _PY_VERSION[0] + _PY_VERSION[2]
+_PREFIX = os.path.normpath(sys.prefix)
+_EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
+_CONFIG_VARS = None
+_USER_BASE = None
+
+def _safe_realpath(path):
+ try:
+ return realpath(path)
+ except OSError:
+ return path
+
+if sys.executable:
+ _PROJECT_BASE = os.path.dirname(_safe_realpath(sys.executable))
+else:
+ # sys.executable can be empty if argv[0] has been changed and Python is
+ # unable to retrieve the real program name
+ _PROJECT_BASE = _safe_realpath(os.getcwd())
+
+if os.name == "nt" and "pcbuild" in _PROJECT_BASE[-8:].lower():
+ _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir))
+# PC/VS7.1
+if os.name == "nt" and "\\pc\\v" in _PROJECT_BASE[-10:].lower():
+ _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir))
+# PC/AMD64
+if os.name == "nt" and "\\pcbuild\\amd64" in _PROJECT_BASE[-14:].lower():
+ _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir))
+
+# set for cross builds
+if "_PYTHON_PROJECT_BASE" in os.environ:
+ # the build directory for posix builds
+ _PROJECT_BASE = os.path.normpath(os.path.abspath("."))
+def is_python_build():
+ for fn in ("Setup.dist", "Setup.local"):
+ if os.path.isfile(os.path.join(_PROJECT_BASE, "Modules", fn)):
+ return True
+ return False
+
+_PYTHON_BUILD = is_python_build()
+
+if _PYTHON_BUILD:
+ for scheme in ('posix_prefix', 'posix_home'):
+ _INSTALL_SCHEMES[scheme]['include'] = '{projectbase}/Include'
+ _INSTALL_SCHEMES[scheme]['platinclude'] = '{srcdir}'
+
+def _subst_vars(s, local_vars):
+ try:
+ return s.format(**local_vars)
+ except KeyError:
+ try:
+ return s.format(**os.environ)
+ except KeyError, var:
+ raise AttributeError('{%s}' % var)
+
+def _extend_dict(target_dict, other_dict):
+ target_keys = target_dict.keys()
+ for key, value in other_dict.items():
+ if key in target_keys:
+ continue
+ target_dict[key] = value
+
+def _expand_vars(scheme, vars):
+ res = {}
+ if vars is None:
+ vars = {}
+ _extend_dict(vars, get_config_vars())
+
+ for key, value in _INSTALL_SCHEMES[scheme].items():
+ if os.name in ('posix', 'nt'):
+ value = os.path.expanduser(value)
+ res[key] = os.path.normpath(_subst_vars(value, vars))
+ return res
+
+def _get_default_scheme():
+ if os.name == 'posix':
+ # the default scheme for posix is posix_prefix
+ return 'posix_prefix'
+ return os.name
+
+def _getuserbase():
+ env_base = os.environ.get("PYTHONUSERBASE", None)
+ def joinuser(*args):
+ return os.path.expanduser(os.path.join(*args))
+
+ # what about 'os2emx', 'riscos' ?
+ if os.name == "nt":
+ base = os.environ.get("APPDATA") or "~"
+ return env_base if env_base else joinuser(base, "Python")
+
+ if sys.platform == "darwin":
+ framework = get_config_var("PYTHONFRAMEWORK")
+ if framework:
+ return env_base if env_base else \
+ joinuser("~", "Library", framework, "%d.%d"
+ % (sys.version_info[:2]))
+
+ return env_base if env_base else joinuser("~", ".local")
+
+
+def _parse_makefile(filename, vars=None):
+ """Parse a Makefile-style file.
+
+ A dictionary containing name/value pairs is returned. If an
+ optional dictionary is passed in as the second argument, it is
+ used instead of a new dictionary.
+ """
+ import re
+ # Regexes needed for parsing Makefile (and similar syntaxes,
+ # like old-style Setup files).
+ _variable_rx = re.compile("([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)")
+ _findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)")
+ _findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}")
+
+ if vars is None:
+ vars = {}
+ done = {}
+ notdone = {}
+
+ with open(filename) as f:
+ lines = f.readlines()
+
+ for line in lines:
+ if line.startswith('#') or line.strip() == '':
+ continue
+ m = _variable_rx.match(line)
+ if m:
+ n, v = m.group(1, 2)
+ v = v.strip()
+ # `$$' is a literal `$' in make
+ tmpv = v.replace('$$', '')
+
+ if "$" in tmpv:
+ notdone[n] = v
+ else:
+ try:
+ v = int(v)
+ except ValueError:
+ # insert literal `$'
+ done[n] = v.replace('$$', '$')
+ else:
+ done[n] = v
+
+ # do variable interpolation here
+ while notdone:
+ for name in notdone.keys():
+ value = notdone[name]
+ m = _findvar1_rx.search(value) or _findvar2_rx.search(value)
+ if m:
+ n = m.group(1)
+ found = True
+ if n in done:
+ item = str(done[n])
+ elif n in notdone:
+ # get it on a subsequent round
+ found = False
+ elif n in os.environ:
+ # do it like make: fall back to environment
+ item = os.environ[n]
+ else:
+ done[n] = item = ""
+ if found:
+ after = value[m.end():]
+ value = value[:m.start()] + item + after
+ if "$" in after:
+ notdone[name] = value
+ else:
+ try: value = int(value)
+ except ValueError:
+ done[name] = value.strip()
+ else:
+ done[name] = value
+ del notdone[name]
+ else:
+ # bogus variable reference; just drop it since we can't deal
+ del notdone[name]
+ # strip spurious spaces
+ for k, v in done.items():
+ if isinstance(v, str):
+ done[k] = v.strip()
+
+ # save the results in the global dictionary
+ vars.update(done)
+ return vars
+
+
+def get_makefile_filename():
+ """Return the path of the Makefile."""
+ if _PYTHON_BUILD:
+ return os.path.join(_PROJECT_BASE, "Makefile")
+ return os.path.join(get_path('platstdlib'), "config", "Makefile")
+
+# Issue #22199: retain undocumented private name for compatibility
+_get_makefile_filename = get_makefile_filename
+
+def _generate_posix_vars():
+ """Generate the Python module containing build-time variables."""
+ import pprint
+ vars = {}
+ # load the installed Makefile:
+ makefile = get_makefile_filename()
+ try:
+ _parse_makefile(makefile, vars)
+ except IOError, e:
+ msg = "invalid Python installation: unable to open %s" % makefile
+ if hasattr(e, "strerror"):
+ msg = msg + " (%s)" % e.strerror
+ raise IOError(msg)
+
+ # load the installed pyconfig.h:
+ config_h = get_config_h_filename()
+ try:
+ with open(config_h) as f:
+ parse_config_h(f, vars)
+ except IOError, e:
+ msg = "invalid Python installation: unable to open %s" % config_h
+ if hasattr(e, "strerror"):
+ msg = msg + " (%s)" % e.strerror
+ raise IOError(msg)
+
+ # On AIX, there are wrong paths to the linker scripts in the Makefile
+ # -- these paths are relative to the Python source, but when installed
+ # the scripts are in another directory.
+ if _PYTHON_BUILD:
+ vars['LDSHARED'] = vars['BLDSHARED']
+
+ # There's a chicken-and-egg situation on OS X with regards to the
+ # _sysconfigdata module after the changes introduced by #15298:
+ # get_config_vars() is called by get_platform() as part of the
+ # `make pybuilddir.txt` target -- which is a precursor to the
+ # _sysconfigdata.py module being constructed. Unfortunately,
+ # get_config_vars() eventually calls _init_posix(), which attempts
+ # to import _sysconfigdata, which we won't have built yet. In order
+ # for _init_posix() to work, if we're on Darwin, just mock up the
+ # _sysconfigdata module manually and populate it with the build vars.
+ # This is more than sufficient for ensuring the subsequent call to
+ # get_platform() succeeds.
+ name = '_sysconfigdata'
+ if 'darwin' in sys.platform:
+ import imp
+ module = imp.new_module(name)
+ module.build_time_vars = vars
+ sys.modules[name] = module
+
+ pybuilddir = 'build/lib.%s-%s' % (get_platform(), sys.version[:3])
+ if hasattr(sys, "gettotalrefcount"):
+ pybuilddir += '-pydebug'
+ try:
+ os.makedirs(pybuilddir)
+ except OSError:
+ pass
+ destfile = os.path.join(pybuilddir, name + '.py')
+
+ with open(destfile, 'wb') as f:
+ f.write('# system configuration generated and used by'
+ ' the sysconfig module\n')
+ f.write('build_time_vars = ')
+ pprint.pprint(vars, stream=f)
+
+ # Create file used for sys.path fixup -- see Modules/getpath.c
+ with open('pybuilddir.txt', 'w') as f:
+ f.write(pybuilddir)
+
+def _init_posix(vars):
+ """Initialize the module as appropriate for POSIX systems."""
+ # _sysconfigdata is generated at build time, see _generate_posix_vars()
+ from _sysconfigdata import build_time_vars
+ vars.update(build_time_vars)
+
+def _init_non_posix(vars):
+ """Initialize the module as appropriate for NT"""
+ # set basic install directories
+ vars['LIBDEST'] = get_path('stdlib')
+ vars['BINLIBDEST'] = get_path('platstdlib')
+ vars['INCLUDEPY'] = get_path('include')
+ vars['SO'] = '.pyd'
+ vars['EXE'] = '.exe'
+ vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT
+ vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable))
+
+#
+# public APIs
+#
+
+
+def parse_config_h(fp, vars=None):
+ """Parse a config.h-style file.
+
+ A dictionary containing name/value pairs is returned. If an
+ optional dictionary is passed in as the second argument, it is
+ used instead of a new dictionary.
+ """
+ import re
+ if vars is None:
+ vars = {}
+ define_rx = re.compile("#define ([A-Z][A-Za-z0-9_]+) (.*)\n")
+ undef_rx = re.compile("/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/\n")
+
+ while True:
+ line = fp.readline()
+ if not line:
+ break
+ m = define_rx.match(line)
+ if m:
+ n, v = m.group(1, 2)
+ try: v = int(v)
+ except ValueError: pass
+ vars[n] = v
+ else:
+ m = undef_rx.match(line)
+ if m:
+ vars[m.group(1)] = 0
+ return vars
+
+def get_config_h_filename():
+ """Returns the path of pyconfig.h."""
+ if _PYTHON_BUILD:
+ if os.name == "nt":
+ inc_dir = os.path.join(_PROJECT_BASE, "PC")
+ else:
+ inc_dir = _PROJECT_BASE
+ else:
+ inc_dir = get_path('platinclude')
+ return os.path.join(inc_dir, 'pyconfig.h')
+
+def get_scheme_names():
+ """Returns a tuple containing the schemes names."""
+ schemes = _INSTALL_SCHEMES.keys()
+ schemes.sort()
+ return tuple(schemes)
+
+def get_path_names():
+ """Returns a tuple containing the paths names."""
+ return _SCHEME_KEYS
+
+def get_paths(scheme=_get_default_scheme(), vars=None, expand=True):
+ """Returns a mapping containing an install scheme.
+
+ ``scheme`` is the install scheme name. If not provided, it will
+ return the default scheme for the current platform.
+ """
+ if expand:
+ return _expand_vars(scheme, vars)
+ else:
+ return _INSTALL_SCHEMES[scheme]
+
+def get_path(name, scheme=_get_default_scheme(), vars=None, expand=True):
+ """Returns a path corresponding to the scheme.
+
+ ``scheme`` is the install scheme name.
+ """
+ return get_paths(scheme, vars, expand)[name]
+
+def get_config_vars(*args):
+ """With no arguments, return a dictionary of all configuration
+ variables relevant for the current platform.
+
+ On Unix, this means every variable defined in Python's installed Makefile;
+ On Windows and Mac OS it's a much smaller set.
+
+ With arguments, return a list of values that result from looking up
+ each argument in the configuration variable dictionary.
+ """
+ import re
+ global _CONFIG_VARS
+ if _CONFIG_VARS is None:
+ _CONFIG_VARS = {}
+ # Normalized versions of prefix and exec_prefix are handy to have;
+ # in fact, these are the standard versions used most places in the
+ # Distutils.
+ _CONFIG_VARS['prefix'] = _PREFIX
+ _CONFIG_VARS['exec_prefix'] = _EXEC_PREFIX
+ _CONFIG_VARS['py_version'] = _PY_VERSION
+ _CONFIG_VARS['py_version_short'] = _PY_VERSION_SHORT
+ _CONFIG_VARS['py_version_nodot'] = _PY_VERSION[0] + _PY_VERSION[2]
+ _CONFIG_VARS['base'] = _PREFIX
+ _CONFIG_VARS['platbase'] = _EXEC_PREFIX
+ _CONFIG_VARS['projectbase'] = _PROJECT_BASE
+
+ if os.name in ('nt', 'os2'):
+ _init_non_posix(_CONFIG_VARS)
+ if os.name == 'posix':
+ _init_posix(_CONFIG_VARS)
+
+ # Setting 'userbase' is done below the call to the
+ # init function to enable using 'get_config_var' in
+ # the init-function.
+ _CONFIG_VARS['userbase'] = _getuserbase()
+
+ if 'srcdir' not in _CONFIG_VARS:
+ _CONFIG_VARS['srcdir'] = _PROJECT_BASE
+
+ # Convert srcdir into an absolute path if it appears necessary.
+ # Normally it is relative to the build directory. However, during
+ # testing, for example, we might be running a non-installed python
+ # from a different directory.
+ if _PYTHON_BUILD and os.name == "posix":
+ base = _PROJECT_BASE
+ try:
+ cwd = os.getcwd()
+ except OSError:
+ cwd = None
+ if (not os.path.isabs(_CONFIG_VARS['srcdir']) and
+ base != cwd):
+ # srcdir is relative and we are not in the same directory
+ # as the executable. Assume executable is in the build
+ # directory and make srcdir absolute.
+ srcdir = os.path.join(base, _CONFIG_VARS['srcdir'])
+ _CONFIG_VARS['srcdir'] = os.path.normpath(srcdir)
+
+ # OS X platforms require special customization to handle
+ # multi-architecture, multi-os-version installers
+ if sys.platform == 'darwin':
+ import _osx_support
+ _osx_support.customize_config_vars(_CONFIG_VARS)
+
+ if args:
+ vals = []
+ for name in args:
+ vals.append(_CONFIG_VARS.get(name))
+ return vals
+ else:
+ return _CONFIG_VARS
+
+def get_config_var(name):
+ """Return the value of a single variable using the dictionary returned by
+ 'get_config_vars()'.
+
+ Equivalent to get_config_vars().get(name)
+ """
+ return get_config_vars().get(name)
+
+def get_platform():
+ """Return a string that identifies the current platform.
+
+ This is used mainly to distinguish platform-specific build directories and
+ platform-specific built distributions. Typically includes the OS name
+ and version and the architecture (as supplied by 'os.uname()'),
+ although the exact information included depends on the OS; eg. for IRIX
+ the architecture isn't particularly important (IRIX only runs on SGI
+ hardware), but for Linux the kernel version isn't particularly
+ important.
+
+ Examples of returned values:
+ linux-i586
+ linux-alpha (?)
+ solaris-2.6-sun4u
+ irix-5.3
+ irix64-6.2
+
+ Windows will return one of:
+ win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc)
+ win-ia64 (64bit Windows on Itanium)
+ win32 (all others - specifically, sys.platform is returned)
+
+ For other non-POSIX platforms, currently just returns 'sys.platform'.
+ """
+ import re
+ if os.name == 'nt':
+ # sniff sys.version for architecture.
+ prefix = " bit ("
+ i = sys.version.find(prefix)
+ if i == -1:
+ return sys.platform
+ j = sys.version.find(")", i)
+ look = sys.version[i+len(prefix):j].lower()
+ if look == 'amd64':
+ return 'win-amd64'
+ if look == 'itanium':
+ return 'win-ia64'
+ return sys.platform
+
+ # Set for cross builds explicitly
+ if "_PYTHON_HOST_PLATFORM" in os.environ:
+ return os.environ["_PYTHON_HOST_PLATFORM"]
+
+ if os.name != "posix" or not hasattr(os, 'uname'):
+ # XXX what about the architecture? NT is Intel or Alpha,
+ # Mac OS is M68k or PPC, etc.
+ return sys.platform
+
+ # Try to distinguish various flavours of Unix
+ osname, host, release, version, machine = os.uname()
+
+ # Convert the OS name to lowercase, remove '/' characters
+ # (to accommodate BSD/OS), and translate spaces (for "Power Macintosh")
+ osname = osname.lower().replace('/', '')
+ machine = machine.replace(' ', '_')
+ machine = machine.replace('/', '-')
+
+ if osname[:5] == "linux":
+ # At least on Linux/Intel, 'machine' is the processor --
+ # i386, etc.
+ # XXX what about Alpha, SPARC, etc?
+ return "%s-%s" % (osname, machine)
+ elif osname[:5] == "sunos":
+ if release[0] >= "5": # SunOS 5 == Solaris 2
+ osname = "solaris"
+ release = "%d.%s" % (int(release[0]) - 3, release[2:])
+ # We can't use "platform.architecture()[0]" because a
+ # bootstrap problem. We use a dict to get an error
+ # if some suspicious happens.
+ bitness = {2147483647:"32bit", 9223372036854775807:"64bit"}
+ machine += ".%s" % bitness[sys.maxint]
+ # fall through to standard osname-release-machine representation
+ elif osname[:4] == "irix": # could be "irix64"!
+ return "%s-%s" % (osname, release)
+ elif osname[:3] == "aix":
+ return "%s-%s.%s" % (osname, version, release)
+ elif osname[:6] == "cygwin":
+ osname = "cygwin"
+ rel_re = re.compile (r'[\d.]+')
+ m = rel_re.match(release)
+ if m:
+ release = m.group()
+ elif osname[:6] == "darwin":
+ import _osx_support
+ osname, release, machine = _osx_support.get_platform_osx(
+ get_config_vars(),
+ osname, release, machine)
+
+ return "%s-%s-%s" % (osname, release, machine)
+
+
+def get_python_version():
+ return _PY_VERSION_SHORT
+
+
+def _print_dict(title, data):
+ for index, (key, value) in enumerate(sorted(data.items())):
+ if index == 0:
+ print '%s: ' % (title)
+ print '\t%s = "%s"' % (key, value)
+
+
+def _main():
+ """Display all information sysconfig detains."""
+ if '--generate-posix-vars' in sys.argv:
+ _generate_posix_vars()
+ return
+ print 'Platform: "%s"' % get_platform()
+ print 'Python version: "%s"' % get_python_version()
+ print 'Current installation scheme: "%s"' % _get_default_scheme()
+ print
+ _print_dict('Paths', get_paths())
+ print
+ _print_dict('Variables', get_config_vars())
+
+
+if __name__ == '__main__':
+ _main()
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
index 0000000000..131de9bdd5
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/textwrap.py
@@ -0,0 +1,425 @@
+"""Text wrapping and filling.
+"""
+
+# Copyright (C) 1999-2001 Gregory P. Ward.
+# Copyright (C) 2002, 2003 Python Software Foundation.
+# Written by Greg Ward <gward@python.net>
+
+__revision__ = "$Id$"
+
+import string, re
+
+try:
+ _unicode = unicode
+except NameError:
+ # If Python is built without Unicode support, the unicode type
+ # will not exist. Fake one.
+ class _unicode(object):
+ pass
+
+# Do the right thing with boolean values for all known Python versions
+# (so this module can be copied to projects that don't depend on Python
+# 2.3, e.g. Optik and Docutils) by uncommenting the block of code below.
+#try:
+# True, False
+#except NameError:
+# (True, False) = (1, 0)
+
+__all__ = ['TextWrapper', 'wrap', 'fill', 'dedent']
+
+# Hardcode the recognized whitespace characters to the US-ASCII
+# whitespace characters. The main reason for doing this is that in
+# ISO-8859-1, 0xa0 is non-breaking whitespace, so in certain locales
+# that character winds up in string.whitespace. Respecting
+# string.whitespace in those cases would 1) make textwrap treat 0xa0 the
+# same as any other whitespace char, which is clearly wrong (it's a
+# *non-breaking* space), 2) possibly cause problems with Unicode,
+# since 0xa0 is not in range(128).
+_whitespace = '\t\n\x0b\x0c\r '
+
+class TextWrapper:
+ """
+ Object for wrapping/filling text. The public interface consists of
+ the wrap() and fill() methods; the other methods are just there for
+ subclasses to override in order to tweak the default behaviour.
+ If you want to completely replace the main wrapping algorithm,
+ you'll probably have to override _wrap_chunks().
+
+ Several instance attributes control various aspects of wrapping:
+ width (default: 70)
+ the maximum width of wrapped lines (unless break_long_words
+ is false)
+ initial_indent (default: "")
+ string that will be prepended to the first line of wrapped
+ output. Counts towards the line's width.
+ subsequent_indent (default: "")
+ string that will be prepended to all lines save the first
+ of wrapped output; also counts towards each line's width.
+ expand_tabs (default: true)
+ Expand tabs in input text to spaces before further processing.
+ Each tab will become 1 .. 8 spaces, depending on its position in
+ its line. If false, each tab is treated as a single character.
+ replace_whitespace (default: true)
+ Replace all whitespace characters in the input text by spaces
+ after tab expansion. Note that if expand_tabs is false and
+ replace_whitespace is true, every tab will be converted to a
+ single space!
+ fix_sentence_endings (default: false)
+ Ensure that sentence-ending punctuation is always followed
+ by two spaces. Off by default because the algorithm is
+ (unavoidably) imperfect.
+ break_long_words (default: true)
+ Break words longer than 'width'. If false, those words will not
+ be broken, and some lines might be longer than 'width'.
+ break_on_hyphens (default: true)
+ Allow breaking hyphenated words. If true, wrapping will occur
+ preferably on whitespaces and right after hyphens part of
+ compound words.
+ drop_whitespace (default: true)
+ Drop leading and trailing whitespace from lines.
+ """
+
+ whitespace_trans = string.maketrans(_whitespace, ' ' * len(_whitespace))
+
+ unicode_whitespace_trans = {}
+ uspace = ord(u' ')
+ for x in map(ord, _whitespace):
+ unicode_whitespace_trans[x] = uspace
+
+ # This funky little regex is just the trick for splitting
+ # text up into word-wrappable chunks. E.g.
+ # "Hello there -- you goof-ball, use the -b option!"
+ # splits into
+ # Hello/ /there/ /--/ /you/ /goof-/ball,/ /use/ /the/ /-b/ /option!
+ # (after stripping out empty strings).
+ wordsep_re = re.compile(
+ r'(\s+|' # any whitespace
+ r'[^\s\w]*\w+[^0-9\W]-(?=\w+[^0-9\W])|' # hyphenated words
+ r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))') # em-dash
+
+ # This less funky little regex just split on recognized spaces. E.g.
+ # "Hello there -- you goof-ball, use the -b option!"
+ # splits into
+ # Hello/ /there/ /--/ /you/ /goof-ball,/ /use/ /the/ /-b/ /option!/
+ wordsep_simple_re = re.compile(r'(\s+)')
+
+ # XXX this is not locale- or charset-aware -- string.lowercase
+ # is US-ASCII only (and therefore English-only)
+ sentence_end_re = re.compile(r'[%s]' # lowercase letter
+ r'[\.\!\?]' # sentence-ending punct.
+ r'[\"\']?' # optional end-of-quote
+ r'\Z' # end of chunk
+ % string.lowercase)
+
+
+ def __init__(self,
+ width=70,
+ initial_indent="",
+ subsequent_indent="",
+ expand_tabs=True,
+ replace_whitespace=True,
+ fix_sentence_endings=False,
+ break_long_words=True,
+ drop_whitespace=True,
+ break_on_hyphens=True):
+ self.width = width
+ self.initial_indent = initial_indent
+ self.subsequent_indent = subsequent_indent
+ self.expand_tabs = expand_tabs
+ self.replace_whitespace = replace_whitespace
+ self.fix_sentence_endings = fix_sentence_endings
+ self.break_long_words = break_long_words
+ self.drop_whitespace = drop_whitespace
+ self.break_on_hyphens = break_on_hyphens
+
+ # recompile the regexes for Unicode mode -- done in this clumsy way for
+ # backwards compatibility because it's rather common to monkey-patch
+ # the TextWrapper class' wordsep_re attribute.
+ self.wordsep_re_uni = re.compile(self.wordsep_re.pattern, re.U)
+ self.wordsep_simple_re_uni = re.compile(
+ self.wordsep_simple_re.pattern, re.U)
+
+
+ # -- Private methods -----------------------------------------------
+ # (possibly useful for subclasses to override)
+
+ def _munge_whitespace(self, text):
+ """_munge_whitespace(text : string) -> string
+
+ Munge whitespace in text: expand tabs and convert all other
+ whitespace characters to spaces. Eg. " foo\\tbar\\n\\nbaz"
+ becomes " foo bar baz".
+ """
+ if self.expand_tabs:
+ text = text.expandtabs()
+ if self.replace_whitespace:
+ if isinstance(text, str):
+ text = text.translate(self.whitespace_trans)
+ elif isinstance(text, _unicode):
+ text = text.translate(self.unicode_whitespace_trans)
+ return text
+
+
+ def _split(self, text):
+ """_split(text : string) -> [string]
+
+ Split the text to wrap into indivisible chunks. Chunks are
+ not quite the same as words; see _wrap_chunks() for full
+ details. As an example, the text
+ Look, goof-ball -- use the -b option!
+ breaks into the following chunks:
+ 'Look,', ' ', 'goof-', 'ball', ' ', '--', ' ',
+ 'use', ' ', 'the', ' ', '-b', ' ', 'option!'
+ if break_on_hyphens is True, or in:
+ 'Look,', ' ', 'goof-ball', ' ', '--', ' ',
+ 'use', ' ', 'the', ' ', '-b', ' ', option!'
+ otherwise.
+ """
+ if isinstance(text, _unicode):
+ if self.break_on_hyphens:
+ pat = self.wordsep_re_uni
+ else:
+ pat = self.wordsep_simple_re_uni
+ else:
+ if self.break_on_hyphens:
+ pat = self.wordsep_re
+ else:
+ pat = self.wordsep_simple_re
+ chunks = pat.split(text)
+ chunks = filter(None, chunks) # remove empty chunks
+ return chunks
+
+ def _fix_sentence_endings(self, chunks):
+ """_fix_sentence_endings(chunks : [string])
+
+ Correct for sentence endings buried in 'chunks'. Eg. when the
+ original text contains "... foo.\\nBar ...", munge_whitespace()
+ and split() will convert that to [..., "foo.", " ", "Bar", ...]
+ which has one too few spaces; this method simply changes the one
+ space to two.
+ """
+ i = 0
+ patsearch = self.sentence_end_re.search
+ while i < len(chunks)-1:
+ if chunks[i+1] == " " and patsearch(chunks[i]):
+ chunks[i+1] = " "
+ i += 2
+ else:
+ i += 1
+
+ def _handle_long_word(self, reversed_chunks, cur_line, cur_len, width):
+ """_handle_long_word(chunks : [string],
+ cur_line : [string],
+ cur_len : int, width : int)
+
+ Handle a chunk of text (most likely a word, not whitespace) that
+ is too long to fit in any line.
+ """
+ # Figure out when indent is larger than the specified width, and make
+ # sure at least one character is stripped off on every pass
+ if width < 1:
+ space_left = 1
+ else:
+ space_left = width - cur_len
+
+ # If we're allowed to break long words, then do so: put as much
+ # of the next chunk onto the current line as will fit.
+ if self.break_long_words:
+ cur_line.append(reversed_chunks[-1][:space_left])
+ reversed_chunks[-1] = reversed_chunks[-1][space_left:]
+
+ # Otherwise, we have to preserve the long word intact. Only add
+ # it to the current line if there's nothing already there --
+ # that minimizes how much we violate the width constraint.
+ elif not cur_line:
+ cur_line.append(reversed_chunks.pop())
+
+ # If we're not allowed to break long words, and there's already
+ # text on the current line, do nothing. Next time through the
+ # main loop of _wrap_chunks(), we'll wind up here again, but
+ # cur_len will be zero, so the next line will be entirely
+ # devoted to the long word that we can't handle right now.
+
+ def _wrap_chunks(self, chunks):
+ """_wrap_chunks(chunks : [string]) -> [string]
+
+ Wrap a sequence of text chunks and return a list of lines of
+ length 'self.width' or less. (If 'break_long_words' is false,
+ some lines may be longer than this.) Chunks correspond roughly
+ to words and the whitespace between them: each chunk is
+ indivisible (modulo 'break_long_words'), but a line break can
+ come between any two chunks. Chunks should not have internal
+ whitespace; ie. a chunk is either all whitespace or a "word".
+ Whitespace chunks will be removed from the beginning and end of
+ lines, but apart from that whitespace is preserved.
+ """
+ lines = []
+ if self.width <= 0:
+ raise ValueError("invalid width %r (must be > 0)" % self.width)
+
+ # Arrange in reverse order so items can be efficiently popped
+ # from a stack of chucks.
+ chunks.reverse()
+
+ while chunks:
+
+ # Start the list of chunks that will make up the current line.
+ # cur_len is just the length of all the chunks in cur_line.
+ cur_line = []
+ cur_len = 0
+
+ # Figure out which static string will prefix this line.
+ if lines:
+ indent = self.subsequent_indent
+ else:
+ indent = self.initial_indent
+
+ # Maximum width for this line.
+ width = self.width - len(indent)
+
+ # First chunk on line is whitespace -- drop it, unless this
+ # is the very beginning of the text (ie. no lines started yet).
+ if self.drop_whitespace and chunks[-1].strip() == '' and lines:
+ del chunks[-1]
+
+ while chunks:
+ l = len(chunks[-1])
+
+ # Can at least squeeze this chunk onto the current line.
+ if cur_len + l <= width:
+ cur_line.append(chunks.pop())
+ cur_len += l
+
+ # Nope, this line is full.
+ else:
+ break
+
+ # The current line is full, and the next chunk is too big to
+ # fit on *any* line (not just this one).
+ if chunks and len(chunks[-1]) > width:
+ self._handle_long_word(chunks, cur_line, cur_len, width)
+
+ # If the last chunk on this line is all whitespace, drop it.
+ if self.drop_whitespace and cur_line and cur_line[-1].strip() == '':
+ del cur_line[-1]
+
+ # Convert current line back to a string and store it in list
+ # of all lines (return value).
+ if cur_line:
+ lines.append(indent + ''.join(cur_line))
+
+ return lines
+
+
+ # -- Public interface ----------------------------------------------
+
+ def wrap(self, text):
+ """wrap(text : string) -> [string]
+
+ Reformat the single paragraph in 'text' so it fits in lines of
+ no more than 'self.width' columns, and return a list of wrapped
+ lines. Tabs in 'text' are expanded with string.expandtabs(),
+ and all other whitespace characters (including newline) are
+ converted to space.
+ """
+ text = self._munge_whitespace(text)
+ chunks = self._split(text)
+ if self.fix_sentence_endings:
+ self._fix_sentence_endings(chunks)
+ return self._wrap_chunks(chunks)
+
+ def fill(self, text):
+ """fill(text : string) -> string
+
+ Reformat the single paragraph in 'text' to fit in lines of no
+ more than 'self.width' columns, and return a new string
+ containing the entire wrapped paragraph.
+ """
+ return "\n".join(self.wrap(text))
+
+
+# -- Convenience interface ---------------------------------------------
+
+def wrap(text, width=70, **kwargs):
+ """Wrap a single paragraph of text, returning a list of wrapped lines.
+
+ Reformat the single paragraph in 'text' so it fits in lines of no
+ more than 'width' columns, and return a list of wrapped lines. By
+ default, tabs in 'text' are expanded with string.expandtabs(), and
+ all other whitespace characters (including newline) are converted to
+ space. See TextWrapper class for available keyword args to customize
+ wrapping behaviour.
+ """
+ w = TextWrapper(width=width, **kwargs)
+ return w.wrap(text)
+
+def fill(text, width=70, **kwargs):
+ """Fill a single paragraph of text, returning a new string.
+
+ Reformat the single paragraph in 'text' to fit in lines of no more
+ than 'width' columns, and return a new string containing the entire
+ wrapped paragraph. As with wrap(), tabs are expanded and other
+ whitespace characters converted to space. See TextWrapper class for
+ available keyword args to customize wrapping behaviour.
+ """
+ w = TextWrapper(width=width, **kwargs)
+ return w.fill(text)
+
+
+# -- Loosely related functionality -------------------------------------
+
+_whitespace_only_re = re.compile('^[ \t]+$', re.MULTILINE)
+_leading_whitespace_re = re.compile('(^[ \t]*)(?:[^ \t\n])', re.MULTILINE)
+
+def dedent(text):
+ """Remove any common leading whitespace from every line in `text`.
+
+ This can be used to make triple-quoted strings line up with the left
+ edge of the display, while still presenting them in the source code
+ in indented form.
+
+ Note that tabs and spaces are both treated as whitespace, but they
+ are not equal: the lines " hello" and "\\thello" are
+ considered to have no common leading whitespace. (This behaviour is
+ new in Python 2.5; older versions of this module incorrectly
+ expanded tabs before searching for common leading whitespace.)
+ """
+ # Look for the longest leading string of spaces and tabs common to
+ # all lines.
+ margin = None
+ text = _whitespace_only_re.sub('', text)
+ indents = _leading_whitespace_re.findall(text)
+ for indent in indents:
+ if margin is None:
+ margin = indent
+
+ # Current line more deeply indented than previous winner:
+ # no change (previous winner is still on top).
+ elif indent.startswith(margin):
+ pass
+
+ # Current line consistent with and no deeper than previous winner:
+ # it's the new winner.
+ elif margin.startswith(indent):
+ margin = indent
+
+ # Current line and previous winner have no common whitespace:
+ # there is no margin.
+ else:
+ margin = ""
+ break
+
+ # sanity check (testing/debugging only)
+ if 0 and margin:
+ for line in text.split("\n"):
+ assert not line or line.startswith(margin), \
+ "line = %r, margin = %r" % (line, margin)
+
+ if margin:
+ text = re.sub(r'(?m)^' + margin, '', text)
+ return text
+
+if __name__ == "__main__":
+ #print dedent("\tfoo\n\tbar")
+ #print dedent(" \thello there\n \t how are you?")
+ print dedent("Hello there.\n This is indented.")
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
index 0000000000..7808128ca4
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/token.py
@@ -0,0 +1,140 @@
+"""Token constants (from "token.h")."""
+
+# This file is automatically generated; please don't muck it up!
+#
+# To update the symbols in this file, 'cd' to the top directory of
+# the python source tree after building the interpreter and run:
+#
+# ./python Lib/token.py
+
+#--start constants--
+ENDMARKER = 0
+NAME = 1
+NUMBER = 2
+STRING = 3
+NEWLINE = 4
+INDENT = 5
+DEDENT = 6
+LPAR = 7
+RPAR = 8
+LSQB = 9
+RSQB = 10
+COLON = 11
+COMMA = 12
+SEMI = 13
+PLUS = 14
+MINUS = 15
+STAR = 16
+SLASH = 17
+VBAR = 18
+AMPER = 19
+LESS = 20
+GREATER = 21
+EQUAL = 22
+DOT = 23
+PERCENT = 24
+BACKQUOTE = 25
+LBRACE = 26
+RBRACE = 27
+EQEQUAL = 28
+NOTEQUAL = 29
+LESSEQUAL = 30
+GREATEREQUAL = 31
+TILDE = 32
+CIRCUMFLEX = 33
+LEFTSHIFT = 34
+RIGHTSHIFT = 35
+DOUBLESTAR = 36
+PLUSEQUAL = 37
+MINEQUAL = 38
+STAREQUAL = 39
+SLASHEQUAL = 40
+PERCENTEQUAL = 41
+AMPEREQUAL = 42
+VBAREQUAL = 43
+CIRCUMFLEXEQUAL = 44
+LEFTSHIFTEQUAL = 45
+RIGHTSHIFTEQUAL = 46
+DOUBLESTAREQUAL = 47
+DOUBLESLASH = 48
+DOUBLESLASHEQUAL = 49
+AT = 50
+OP = 51
+ERRORTOKEN = 52
+N_TOKENS = 53
+NT_OFFSET = 256
+#--end constants--
+
+tok_name = {}
+for _name, _value in globals().items():
+ if type(_value) is type(0):
+ tok_name[_value] = _name
+del _name, _value
+
+
+def ISTERMINAL(x):
+ return x < NT_OFFSET
+
+def ISNONTERMINAL(x):
+ return x >= NT_OFFSET
+
+def ISEOF(x):
+ return x == ENDMARKER
+
+
+def main():
+ import re
+ import sys
+ args = sys.argv[1:]
+ inFileName = args and args[0] or "Include/token.h"
+ outFileName = "Lib/token.py"
+ if len(args) > 1:
+ outFileName = args[1]
+ try:
+ fp = open(inFileName)
+ except IOError, err:
+ sys.stdout.write("I/O error: %s\n" % str(err))
+ sys.exit(1)
+ lines = fp.read().split("\n")
+ fp.close()
+ prog = re.compile(
+ "#define[ \t][ \t]*([A-Z0-9][A-Z0-9_]*)[ \t][ \t]*([0-9][0-9]*)",
+ re.IGNORECASE)
+ tokens = {}
+ for line in lines:
+ match = prog.match(line)
+ if match:
+ name, val = match.group(1, 2)
+ val = int(val)
+ tokens[val] = name # reverse so we can sort them...
+ keys = tokens.keys()
+ keys.sort()
+ # load the output skeleton from the target:
+ try:
+ fp = open(outFileName)
+ except IOError, err:
+ sys.stderr.write("I/O error: %s\n" % str(err))
+ sys.exit(2)
+ format = fp.read().split("\n")
+ fp.close()
+ try:
+ start = format.index("#--start constants--") + 1
+ end = format.index("#--end constants--")
+ except ValueError:
+ sys.stderr.write("target does not contain format markers")
+ sys.exit(3)
+ lines = []
+ for val in keys:
+ lines.append("%s = %d" % (tokens[val], val))
+ format[start:end] = lines
+ try:
+ fp = open(outFileName, 'w')
+ except IOError, err:
+ sys.stderr.write("I/O error: %s\n" % str(err))
+ sys.exit(4)
+ fp.write("\n".join(format))
+ fp.close()
+
+
+if __name__ == "__main__":
+ main()
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
index 0000000000..9e7e1dc917
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/tokenize.py
@@ -0,0 +1,432 @@
+"""Tokenization help for Python programs.
+
+generate_tokens(readline) is a generator that breaks a stream of
+text into Python tokens. It accepts a readline-like method which is called
+repeatedly to get the next line of input (or "" for EOF). It generates
+5-tuples with these members:
+
+ the token type (see token.py)
+ the token (a string)
+ the starting (row, column) indices of the token (a 2-tuple of ints)
+ the ending (row, column) indices of the token (a 2-tuple of ints)
+ the original line (string)
+
+It is designed to match the working of the Python tokenizer exactly, except
+that it produces COMMENT tokens for comments and gives type OP for all
+operators
+
+Older entry points
+ tokenize_loop(readline, tokeneater)
+ tokenize(readline, tokeneater=printtoken)
+are the same, except instead of generating tokens, tokeneater is a callback
+function to which the 5 fields described above are passed as 5 arguments,
+each time a new token is found."""
+
+__author__ = 'Ka-Ping Yee <ping@lfw.org>'
+__credits__ = ('GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, '
+ 'Skip Montanaro, Raymond Hettinger')
+
+from itertools import chain
+import string, re
+from token import *
+
+import token
+__all__ = [x for x in dir(token) if not x.startswith("_")]
+__all__ += ["COMMENT", "tokenize", "generate_tokens", "NL", "untokenize"]
+del x
+del token
+
+COMMENT = N_TOKENS
+tok_name[COMMENT] = 'COMMENT'
+NL = N_TOKENS + 1
+tok_name[NL] = 'NL'
+N_TOKENS += 2
+
+def group(*choices): return '(' + '|'.join(choices) + ')'
+def any(*choices): return group(*choices) + '*'
+def maybe(*choices): return group(*choices) + '?'
+
+Whitespace = r'[ \f\t]*'
+Comment = r'#[^\r\n]*'
+Ignore = Whitespace + any(r'\\\r?\n' + Whitespace) + maybe(Comment)
+Name = r'[a-zA-Z_]\w*'
+
+Hexnumber = r'0[xX][\da-fA-F]+[lL]?'
+Octnumber = r'(0[oO][0-7]+)|(0[0-7]*)[lL]?'
+Binnumber = r'0[bB][01]+[lL]?'
+Decnumber = r'[1-9]\d*[lL]?'
+Intnumber = group(Hexnumber, Binnumber, Octnumber, Decnumber)
+Exponent = r'[eE][-+]?\d+'
+Pointfloat = group(r'\d+\.\d*', r'\.\d+') + maybe(Exponent)
+Expfloat = r'\d+' + Exponent
+Floatnumber = group(Pointfloat, Expfloat)
+Imagnumber = group(r'\d+[jJ]', Floatnumber + r'[jJ]')
+Number = group(Imagnumber, Floatnumber, Intnumber)
+
+# Tail end of ' string.
+Single = r"[^'\\]*(?:\\.[^'\\]*)*'"
+# Tail end of " string.
+Double = r'[^"\\]*(?:\\.[^"\\]*)*"'
+# Tail end of ''' string.
+Single3 = r"[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''"
+# Tail end of """ string.
+Double3 = r'[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""'
+Triple = group("[uUbB]?[rR]?'''", '[uUbB]?[rR]?"""')
+# Single-line ' or " string.
+String = group(r"[uUbB]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*'",
+ r'[uUbB]?[rR]?"[^\n"\\]*(?:\\.[^\n"\\]*)*"')
+
+# Because of leftmost-then-longest match semantics, be sure to put the
+# longest operators first (e.g., if = came before ==, == would get
+# recognized as two instances of =).
+Operator = group(r"\*\*=?", r">>=?", r"<<=?", r"<>", r"!=",
+ r"//=?",
+ r"[+\-*/%&|^=<>]=?",
+ r"~")
+
+Bracket = '[][(){}]'
+Special = group(r'\r?\n', r'[:;.,`@]')
+Funny = group(Operator, Bracket, Special)
+
+PlainToken = group(Number, Funny, String, Name)
+Token = Ignore + PlainToken
+
+# First (or only) line of ' or " string.
+ContStr = group(r"[uUbB]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*" +
+ group("'", r'\\\r?\n'),
+ r'[uUbB]?[rR]?"[^\n"\\]*(?:\\.[^\n"\\]*)*' +
+ group('"', r'\\\r?\n'))
+PseudoExtras = group(r'\\\r?\n|\Z', Comment, Triple)
+PseudoToken = Whitespace + group(PseudoExtras, Number, Funny, ContStr, Name)
+
+tokenprog, pseudoprog, single3prog, double3prog = map(
+ re.compile, (Token, PseudoToken, Single3, Double3))
+endprogs = {"'": re.compile(Single), '"': re.compile(Double),
+ "'''": single3prog, '"""': double3prog,
+ "r'''": single3prog, 'r"""': double3prog,
+ "u'''": single3prog, 'u"""': double3prog,
+ "ur'''": single3prog, 'ur"""': double3prog,
+ "R'''": single3prog, 'R"""': double3prog,
+ "U'''": single3prog, 'U"""': double3prog,
+ "uR'''": single3prog, 'uR"""': double3prog,
+ "Ur'''": single3prog, 'Ur"""': double3prog,
+ "UR'''": single3prog, 'UR"""': double3prog,
+ "b'''": single3prog, 'b"""': double3prog,
+ "br'''": single3prog, 'br"""': double3prog,
+ "B'''": single3prog, 'B"""': double3prog,
+ "bR'''": single3prog, 'bR"""': double3prog,
+ "Br'''": single3prog, 'Br"""': double3prog,
+ "BR'''": single3prog, 'BR"""': double3prog,
+ 'r': None, 'R': None, 'u': None, 'U': None,
+ 'b': None, 'B': None}
+
+triple_quoted = {}
+for t in ("'''", '"""',
+ "r'''", 'r"""', "R'''", 'R"""',
+ "u'''", 'u"""', "U'''", 'U"""',
+ "ur'''", 'ur"""', "Ur'''", 'Ur"""',
+ "uR'''", 'uR"""', "UR'''", 'UR"""',
+ "b'''", 'b"""', "B'''", 'B"""',
+ "br'''", 'br"""', "Br'''", 'Br"""',
+ "bR'''", 'bR"""', "BR'''", 'BR"""'):
+ triple_quoted[t] = t
+single_quoted = {}
+for t in ("'", '"',
+ "r'", 'r"', "R'", 'R"',
+ "u'", 'u"', "U'", 'U"',
+ "ur'", 'ur"', "Ur'", 'Ur"',
+ "uR'", 'uR"', "UR'", 'UR"',
+ "b'", 'b"', "B'", 'B"',
+ "br'", 'br"', "Br'", 'Br"',
+ "bR'", 'bR"', "BR'", 'BR"' ):
+ single_quoted[t] = t
+
+tabsize = 8
+
+class TokenError(Exception): pass
+
+class StopTokenizing(Exception): pass
+
+def printtoken(type, token, srow_scol, erow_ecol, line): # for testing
+ srow, scol = srow_scol
+ erow, ecol = erow_ecol
+ print "%d,%d-%d,%d:\t%s\t%s" % \
+ (srow, scol, erow, ecol, tok_name[type], repr(token))
+
+def tokenize(readline, tokeneater=printtoken):
+ """
+ The tokenize() function accepts two parameters: one representing the
+ input stream, and one providing an output mechanism for tokenize().
+
+ The first parameter, readline, must be a callable object which provides
+ the same interface as the readline() method of built-in file objects.
+ Each call to the function should return one line of input as a string.
+
+ The second parameter, tokeneater, must also be a callable object. It is
+ called once for each token, with five arguments, corresponding to the
+ tuples generated by generate_tokens().
+ """
+ try:
+ tokenize_loop(readline, tokeneater)
+ except StopTokenizing:
+ pass
+
+# backwards compatible interface
+def tokenize_loop(readline, tokeneater):
+ for token_info in generate_tokens(readline):
+ tokeneater(*token_info)
+
+class Untokenizer:
+
+ def __init__(self):
+ self.tokens = []
+ self.prev_row = 1
+ self.prev_col = 0
+
+ def add_whitespace(self, start):
+ row, col = start
+ if row < self.prev_row or row == self.prev_row and col < self.prev_col:
+ raise ValueError("start ({},{}) precedes previous end ({},{})"
+ .format(row, col, self.prev_row, self.prev_col))
+ row_offset = row - self.prev_row
+ if row_offset:
+ self.tokens.append("\\\n" * row_offset)
+ self.prev_col = 0
+ col_offset = col - self.prev_col
+ if col_offset:
+ self.tokens.append(" " * col_offset)
+
+ def untokenize(self, iterable):
+ it = iter(iterable)
+ for t in it:
+ if len(t) == 2:
+ self.compat(t, it)
+ break
+ tok_type, token, start, end, line = t
+ if tok_type == ENDMARKER:
+ break
+ self.add_whitespace(start)
+ self.tokens.append(token)
+ self.prev_row, self.prev_col = end
+ if tok_type in (NEWLINE, NL):
+ self.prev_row += 1
+ self.prev_col = 0
+ return "".join(self.tokens)
+
+ def compat(self, token, iterable):
+ indents = []
+ toks_append = self.tokens.append
+ startline = token[0] in (NEWLINE, NL)
+ prevstring = False
+
+ for tok in chain([token], iterable):
+ toknum, tokval = tok[:2]
+
+ if toknum in (NAME, NUMBER):
+ tokval += ' '
+
+ # Insert a space between two consecutive strings
+ if toknum == STRING:
+ if prevstring:
+ tokval = ' ' + tokval
+ prevstring = True
+ else:
+ prevstring = False
+
+ if toknum == INDENT:
+ indents.append(tokval)
+ continue
+ elif toknum == DEDENT:
+ indents.pop()
+ continue
+ elif toknum in (NEWLINE, NL):
+ startline = True
+ elif startline and indents:
+ toks_append(indents[-1])
+ startline = False
+ toks_append(tokval)
+
+def untokenize(iterable):
+ """Transform tokens back into Python source code.
+
+ Each element returned by the iterable must be a token sequence
+ with at least two elements, a token number and token value. If
+ only two tokens are passed, the resulting output is poor.
+
+ Round-trip invariant for full input:
+ Untokenized source will match input source exactly
+
+ Round-trip invariant for limited intput:
+ # Output text will tokenize the back to the input
+ t1 = [tok[:2] for tok in generate_tokens(f.readline)]
+ newcode = untokenize(t1)
+ readline = iter(newcode.splitlines(1)).next
+ t2 = [tok[:2] for tok in generate_tokens(readline)]
+ assert t1 == t2
+ """
+ ut = Untokenizer()
+ return ut.untokenize(iterable)
+
+def generate_tokens(readline):
+ """
+ The generate_tokens() generator requires one argument, readline, which
+ must be a callable object which provides the same interface as the
+ readline() method of built-in file objects. Each call to the function
+ should return one line of input as a string. Alternately, readline
+ can be a callable function terminating with StopIteration:
+ readline = open(myfile).next # Example of alternate readline
+
+ The generator produces 5-tuples with these members: the token type; the
+ token string; a 2-tuple (srow, scol) of ints specifying the row and
+ column where the token begins in the source; a 2-tuple (erow, ecol) of
+ ints specifying the row and column where the token ends in the source;
+ and the line on which the token was found. The line passed is the
+ logical line; continuation lines are included.
+ """
+ lnum = parenlev = continued = 0
+ namechars, numchars = string.ascii_letters + '_', '0123456789'
+ contstr, needcont = '', 0
+ contline = None
+ indents = [0]
+
+ while 1: # loop over lines in stream
+ try:
+ line = readline()
+ except StopIteration:
+ line = ''
+ lnum += 1
+ pos, max = 0, len(line)
+
+ if contstr: # continued string
+ if not line:
+ raise TokenError, ("EOF in multi-line string", strstart)
+ endmatch = endprog.match(line)
+ if endmatch:
+ pos = end = endmatch.end(0)
+ yield (STRING, contstr + line[:end],
+ strstart, (lnum, end), contline + line)
+ contstr, needcont = '', 0
+ contline = None
+ elif needcont and line[-2:] != '\\\n' and line[-3:] != '\\\r\n':
+ yield (ERRORTOKEN, contstr + line,
+ strstart, (lnum, len(line)), contline)
+ contstr = ''
+ contline = None
+ continue
+ else:
+ contstr = contstr + line
+ contline = contline + line
+ continue
+
+ elif parenlev == 0 and not continued: # new statement
+ if not line: break
+ column = 0
+ while pos < max: # measure leading whitespace
+ if line[pos] == ' ':
+ column += 1
+ elif line[pos] == '\t':
+ column = (column//tabsize + 1)*tabsize
+ elif line[pos] == '\f':
+ column = 0
+ else:
+ break
+ pos += 1
+ if pos == max:
+ break
+
+ if line[pos] in '#\r\n': # skip comments or blank lines
+ if line[pos] == '#':
+ comment_token = line[pos:].rstrip('\r\n')
+ nl_pos = pos + len(comment_token)
+ yield (COMMENT, comment_token,
+ (lnum, pos), (lnum, pos + len(comment_token)), line)
+ yield (NL, line[nl_pos:],
+ (lnum, nl_pos), (lnum, len(line)), line)
+ else:
+ yield ((NL, COMMENT)[line[pos] == '#'], line[pos:],
+ (lnum, pos), (lnum, len(line)), line)
+ continue
+
+ if column > indents[-1]: # count indents or dedents
+ indents.append(column)
+ yield (INDENT, line[:pos], (lnum, 0), (lnum, pos), line)
+ while column < indents[-1]:
+ if column not in indents:
+ raise IndentationError(
+ "unindent does not match any outer indentation level",
+ ("<tokenize>", lnum, pos, line))
+ indents = indents[:-1]
+ yield (DEDENT, '', (lnum, pos), (lnum, pos), line)
+
+ else: # continued statement
+ if not line:
+ raise TokenError, ("EOF in multi-line statement", (lnum, 0))
+ continued = 0
+
+ while pos < max:
+ pseudomatch = pseudoprog.match(line, pos)
+ if pseudomatch: # scan for tokens
+ start, end = pseudomatch.span(1)
+ spos, epos, pos = (lnum, start), (lnum, end), end
+ if start == end:
+ continue
+ token, initial = line[start:end], line[start]
+
+ if initial in numchars or \
+ (initial == '.' and token != '.'): # ordinary number
+ yield (NUMBER, token, spos, epos, line)
+ elif initial in '\r\n':
+ yield (NL if parenlev > 0 else NEWLINE,
+ token, spos, epos, line)
+ elif initial == '#':
+ assert not token.endswith("\n")
+ yield (COMMENT, token, spos, epos, line)
+ elif token in triple_quoted:
+ endprog = endprogs[token]
+ endmatch = endprog.match(line, pos)
+ if endmatch: # all on one line
+ pos = endmatch.end(0)
+ token = line[start:pos]
+ yield (STRING, token, spos, (lnum, pos), line)
+ else:
+ strstart = (lnum, start) # multiple lines
+ contstr = line[start:]
+ contline = line
+ break
+ elif initial in single_quoted or \
+ token[:2] in single_quoted or \
+ token[:3] in single_quoted:
+ if token[-1] == '\n': # continued string
+ strstart = (lnum, start)
+ endprog = (endprogs[initial] or endprogs[token[1]] or
+ endprogs[token[2]])
+ contstr, needcont = line[start:], 1
+ contline = line
+ break
+ else: # ordinary string
+ yield (STRING, token, spos, epos, line)
+ elif initial in namechars: # ordinary name
+ yield (NAME, token, spos, epos, line)
+ elif initial == '\\': # continued stmt
+ continued = 1
+ else:
+ if initial in '([{':
+ parenlev += 1
+ elif initial in ')]}':
+ parenlev -= 1
+ yield (OP, token, spos, epos, line)
+ else:
+ yield (ERRORTOKEN, line[pos],
+ (lnum, pos), (lnum, pos+1), line)
+ pos += 1
+
+ for indent in indents[1:]: # pop remaining indent levels
+ yield (DEDENT, '', (lnum, 0), (lnum, 0), '')
+ yield (ENDMARKER, '', (lnum, 0), (lnum, 0), '')
+
+if __name__ == '__main__': # testing
+ import sys
+ if len(sys.argv) > 1:
+ tokenize(open(sys.argv[1]).readline)
+ else:
+ tokenize(sys.stdin.readline)
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
index 0000000000..4e2b29188d
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/traceback.py
@@ -0,0 +1,320 @@
+"""Extract, format and print information about Python stack traces."""
+
+import linecache
+import sys
+import types
+
+__all__ = ['extract_stack', 'extract_tb', 'format_exception',
+ 'format_exception_only', 'format_list', 'format_stack',
+ 'format_tb', 'print_exc', 'format_exc', 'print_exception',
+ 'print_last', 'print_stack', 'print_tb', 'tb_lineno']
+
+def _print(file, str='', terminator='\n'):
+ file.write(str+terminator)
+
+
+def print_list(extracted_list, file=None):
+ """Print the list of tuples as returned by extract_tb() or
+ extract_stack() as a formatted stack trace to the given file."""
+ if file is None:
+ file = sys.stderr
+ for filename, lineno, name, line in extracted_list:
+ _print(file,
+ ' File "%s", line %d, in %s' % (filename,lineno,name))
+ if line:
+ _print(file, ' %s' % line.strip())
+
+def format_list(extracted_list):
+ """Format a list of traceback entry tuples for printing.
+
+ Given a list of tuples as returned by extract_tb() or
+ extract_stack(), return a list of strings ready for printing.
+ Each string in the resulting list corresponds to the item with the
+ same index in the argument list. Each string ends in a newline;
+ the strings may contain internal newlines as well, for those items
+ whose source text line is not None.
+ """
+ list = []
+ for filename, lineno, name, line in extracted_list:
+ item = ' File "%s", line %d, in %s\n' % (filename,lineno,name)
+ if line:
+ item = item + ' %s\n' % line.strip()
+ list.append(item)
+ return list
+
+
+def print_tb(tb, limit=None, file=None):
+ """Print up to 'limit' stack trace entries from the traceback 'tb'.
+
+ If 'limit' is omitted or None, all entries are printed. If 'file'
+ is omitted or None, the output goes to sys.stderr; otherwise
+ 'file' should be an open file or file-like object with a write()
+ method.
+ """
+ if file is None:
+ file = sys.stderr
+ if limit is None:
+ if hasattr(sys, 'tracebacklimit'):
+ limit = sys.tracebacklimit
+ n = 0
+ while tb is not None and (limit is None or n < limit):
+ f = tb.tb_frame
+ lineno = tb.tb_lineno
+ co = f.f_code
+ filename = co.co_filename
+ name = co.co_name
+ _print(file,
+ ' File "%s", line %d, in %s' % (filename, lineno, name))
+ linecache.checkcache(filename)
+ line = linecache.getline(filename, lineno, f.f_globals)
+ if line: _print(file, ' ' + line.strip())
+ tb = tb.tb_next
+ n = n+1
+
+def format_tb(tb, limit = None):
+ """A shorthand for 'format_list(extract_tb(tb, limit))'."""
+ return format_list(extract_tb(tb, limit))
+
+def extract_tb(tb, limit = None):
+ """Return list of up to limit pre-processed entries from traceback.
+
+ This is useful for alternate formatting of stack traces. If
+ 'limit' is omitted or None, all entries are extracted. A
+ pre-processed stack trace entry is a quadruple (filename, line
+ number, function name, text) representing the information that is
+ usually printed for a stack trace. The text is a string with
+ leading and trailing whitespace stripped; if the source is not
+ available it is None.
+ """
+ if limit is None:
+ if hasattr(sys, 'tracebacklimit'):
+ limit = sys.tracebacklimit
+ list = []
+ n = 0
+ while tb is not None and (limit is None or n < limit):
+ f = tb.tb_frame
+ lineno = tb.tb_lineno
+ co = f.f_code
+ filename = co.co_filename
+ name = co.co_name
+ linecache.checkcache(filename)
+ line = linecache.getline(filename, lineno, f.f_globals)
+ if line: line = line.strip()
+ else: line = None
+ list.append((filename, lineno, name, line))
+ tb = tb.tb_next
+ n = n+1
+ return list
+
+
+def print_exception(etype, value, tb, limit=None, file=None):
+ """Print exception up to 'limit' stack trace entries from 'tb' to 'file'.
+
+ This differs from print_tb() in the following ways: (1) if
+ traceback is not None, it prints a header "Traceback (most recent
+ call last):"; (2) it prints the exception type and value after the
+ stack trace; (3) if type is SyntaxError and value has the
+ appropriate format, it prints the line where the syntax error
+ occurred with a caret on the next line indicating the approximate
+ position of the error.
+ """
+ if file is None:
+ file = sys.stderr
+ if tb:
+ _print(file, 'Traceback (most recent call last):')
+ print_tb(tb, limit, file)
+ lines = format_exception_only(etype, value)
+ for line in lines:
+ _print(file, line, '')
+
+def format_exception(etype, value, tb, limit = None):
+ """Format a stack trace and the exception information.
+
+ The arguments have the same meaning as the corresponding arguments
+ to print_exception(). The return value is a list of strings, each
+ ending in a newline and some containing internal newlines. When
+ these lines are concatenated and printed, exactly the same text is
+ printed as does print_exception().
+ """
+ if tb:
+ list = ['Traceback (most recent call last):\n']
+ list = list + format_tb(tb, limit)
+ else:
+ list = []
+ list = list + format_exception_only(etype, value)
+ return list
+
+def format_exception_only(etype, value):
+ """Format the exception part of a traceback.
+
+ The arguments are the exception type and value such as given by
+ sys.last_type and sys.last_value. The return value is a list of
+ strings, each ending in a newline.
+
+ Normally, the list contains a single string; however, for
+ SyntaxError exceptions, it contains several lines that (when
+ printed) display detailed information about where the syntax
+ error occurred.
+
+ The message indicating which exception occurred is always the last
+ string in the list.
+
+ """
+
+ # An instance should not have a meaningful value parameter, but
+ # sometimes does, particularly for string exceptions, such as
+ # >>> raise string1, string2 # deprecated
+ #
+ # Clear these out first because issubtype(string1, SyntaxError)
+ # would raise another exception and mask the original problem.
+ if (isinstance(etype, BaseException) or
+ isinstance(etype, types.InstanceType) or
+ etype is None or type(etype) is str):
+ return [_format_final_exc_line(etype, value)]
+
+ stype = etype.__name__
+
+ if not issubclass(etype, SyntaxError):
+ return [_format_final_exc_line(stype, value)]
+
+ # It was a syntax error; show exactly where the problem was found.
+ lines = []
+ try:
+ msg, (filename, lineno, offset, badline) = value.args
+ except Exception:
+ pass
+ else:
+ filename = filename or "<string>"
+ lines.append(' File "%s", line %d\n' % (filename, lineno))
+ if badline is not None:
+ lines.append(' %s\n' % badline.strip())
+ if offset is not None:
+ caretspace = badline.rstrip('\n')
+ offset = min(len(caretspace), offset) - 1
+ caretspace = caretspace[:offset].lstrip()
+ # non-space whitespace (likes tabs) must be kept for alignment
+ caretspace = ((c.isspace() and c or ' ') for c in caretspace)
+ lines.append(' %s^\n' % ''.join(caretspace))
+ value = msg
+
+ lines.append(_format_final_exc_line(stype, value))
+ return lines
+
+def _format_final_exc_line(etype, value):
+ """Return a list of a single line -- normal case for format_exception_only"""
+ valuestr = _some_str(value)
+ if value is None or not valuestr:
+ line = "%s\n" % etype
+ else:
+ line = "%s: %s\n" % (etype, valuestr)
+ return line
+
+def _some_str(value):
+ try:
+ return str(value)
+ except Exception:
+ pass
+ try:
+ value = unicode(value)
+ return value.encode("ascii", "backslashreplace")
+ except Exception:
+ pass
+ return '<unprintable %s object>' % type(value).__name__
+
+
+def print_exc(limit=None, file=None):
+ """Shorthand for 'print_exception(sys.exc_type, sys.exc_value, sys.exc_traceback, limit, file)'.
+ (In fact, it uses sys.exc_info() to retrieve the same information
+ in a thread-safe way.)"""
+ if file is None:
+ file = sys.stderr
+ try:
+ etype, value, tb = sys.exc_info()
+ print_exception(etype, value, tb, limit, file)
+ finally:
+ etype = value = tb = None
+
+
+def format_exc(limit=None):
+ """Like print_exc() but return a string."""
+ try:
+ etype, value, tb = sys.exc_info()
+ return ''.join(format_exception(etype, value, tb, limit))
+ finally:
+ etype = value = tb = None
+
+
+def print_last(limit=None, file=None):
+ """This is a shorthand for 'print_exception(sys.last_type,
+ sys.last_value, sys.last_traceback, limit, file)'."""
+ if not hasattr(sys, "last_type"):
+ raise ValueError("no last exception")
+ if file is None:
+ file = sys.stderr
+ print_exception(sys.last_type, sys.last_value, sys.last_traceback,
+ limit, file)
+
+
+def print_stack(f=None, limit=None, file=None):
+ """Print a stack trace from its invocation point.
+
+ The optional 'f' argument can be used to specify an alternate
+ stack frame at which to start. The optional 'limit' and 'file'
+ arguments have the same meaning as for print_exception().
+ """
+ if f is None:
+ try:
+ raise ZeroDivisionError
+ except ZeroDivisionError:
+ f = sys.exc_info()[2].tb_frame.f_back
+ print_list(extract_stack(f, limit), file)
+
+def format_stack(f=None, limit=None):
+ """Shorthand for 'format_list(extract_stack(f, limit))'."""
+ if f is None:
+ try:
+ raise ZeroDivisionError
+ except ZeroDivisionError:
+ f = sys.exc_info()[2].tb_frame.f_back
+ return format_list(extract_stack(f, limit))
+
+def extract_stack(f=None, limit = None):
+ """Extract the raw traceback from the current stack frame.
+
+ The return value has the same format as for extract_tb(). The
+ optional 'f' and 'limit' arguments have the same meaning as for
+ print_stack(). Each item in the list is a quadruple (filename,
+ line number, function name, text), and the entries are in order
+ from oldest to newest stack frame.
+ """
+ if f is None:
+ try:
+ raise ZeroDivisionError
+ except ZeroDivisionError:
+ f = sys.exc_info()[2].tb_frame.f_back
+ if limit is None:
+ if hasattr(sys, 'tracebacklimit'):
+ limit = sys.tracebacklimit
+ list = []
+ n = 0
+ while f is not None and (limit is None or n < limit):
+ lineno = f.f_lineno
+ co = f.f_code
+ filename = co.co_filename
+ name = co.co_name
+ linecache.checkcache(filename)
+ line = linecache.getline(filename, lineno, f.f_globals)
+ if line: line = line.strip()
+ else: line = None
+ list.append((filename, lineno, name, line))
+ f = f.f_back
+ n = n+1
+ list.reverse()
+ return list
+
+def tb_lineno(tb):
+ """Calculate correct line number of traceback given in tb.
+
+ Obsolete in 2.3.
+ """
+ return tb.tb_lineno
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
index 0000000000..f1f18c71a8
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/types.py
@@ -0,0 +1,86 @@
+"""Define names for all type symbols known in the standard interpreter.
+
+Types that are part of optional modules (e.g. array) are not listed.
+"""
+import sys
+
+# Iterators in Python aren't a matter of type but of protocol. A large
+# and changing number of builtin types implement *some* flavor of
+# iterator. Don't check the type! Use hasattr to check for both
+# "__iter__" and "next" attributes instead.
+
+NoneType = type(None)
+TypeType = type
+ObjectType = object
+
+IntType = int
+LongType = long
+FloatType = float
+BooleanType = bool
+try:
+ ComplexType = complex
+except NameError:
+ pass
+
+StringType = str
+
+# StringTypes is already outdated. Instead of writing "type(x) in
+# types.StringTypes", you should use "isinstance(x, basestring)". But
+# we keep around for compatibility with Python 2.2.
+try:
+ UnicodeType = unicode
+ StringTypes = (StringType, UnicodeType)
+except NameError:
+ StringTypes = (StringType,)
+
+BufferType = buffer
+
+TupleType = tuple
+ListType = list
+DictType = DictionaryType = dict
+
+def _f(): pass
+FunctionType = type(_f)
+LambdaType = type(lambda: None) # Same as FunctionType
+CodeType = type(_f.func_code)
+
+def _g():
+ yield 1
+GeneratorType = type(_g())
+
+class _C:
+ def _m(self): pass
+ClassType = type(_C)
+UnboundMethodType = type(_C._m) # Same as MethodType
+_x = _C()
+InstanceType = type(_x)
+MethodType = type(_x._m)
+
+BuiltinFunctionType = type(len)
+BuiltinMethodType = type([].append) # Same as BuiltinFunctionType
+
+ModuleType = type(sys)
+FileType = file
+XRangeType = xrange
+
+try:
+ raise TypeError
+except TypeError:
+ tb = sys.exc_info()[2]
+ TracebackType = type(tb)
+ FrameType = type(tb.tb_frame)
+ del tb
+
+SliceType = slice
+EllipsisType = type(Ellipsis)
+
+DictProxyType = type(TypeType.__dict__)
+NotImplementedType = type(NotImplemented)
+
+# For Jython, the following two types are identical
+GetSetDescriptorType = type(FunctionType.func_code)
+MemberDescriptorType = type(FunctionType.func_globals)
+
+del sys, _f, _g, _C, _x # Not for export
+
+__all__ = list(n for n in globals() if n[:1] != '_')
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
index 0000000000..c4de785024
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/urlparse.py
@@ -0,0 +1,428 @@
+"""Parse (absolute and relative) URLs.
+
+urlparse module is based upon the following RFC specifications.
+
+RFC 3986 (STD66): "Uniform Resource Identifiers" by T. Berners-Lee, R. Fielding
+and L. Masinter, January 2005.
+
+RFC 2732 : "Format for Literal IPv6 Addresses in URL's by R.Hinden, B.Carpenter
+and L.Masinter, December 1999.
+
+RFC 2396: "Uniform Resource Identifiers (URI)": Generic Syntax by T.
+Berners-Lee, R. Fielding, and L. Masinter, August 1998.
+
+RFC 2368: "The mailto URL scheme", by P.Hoffman , L Masinter, J. Zwinski, July 1998.
+
+RFC 1808: "Relative Uniform Resource Locators", by R. Fielding, UC Irvine, June
+1995.
+
+RFC 1738: "Uniform Resource Locators (URL)" by T. Berners-Lee, L. Masinter, M.
+McCahill, December 1994
+
+RFC 3986 is considered the current standard and any future changes to
+urlparse module should conform with it. The urlparse module is
+currently not entirely compliant with this RFC due to defacto
+scenarios for parsing, and for backward compatibility purposes, some
+parsing quirks from older RFCs are retained. The testcases in
+test_urlparse.py provides a good indicator of parsing behavior.
+
+"""
+
+import re
+
+__all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag",
+ "urlsplit", "urlunsplit", "parse_qs", "parse_qsl"]
+
+# A classification of schemes ('' means apply by default)
+uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap',
+ 'wais', 'file', 'https', 'shttp', 'mms',
+ 'prospero', 'rtsp', 'rtspu', '', 'sftp',
+ 'svn', 'svn+ssh']
+uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet',
+ 'imap', 'wais', 'file', 'mms', 'https', 'shttp',
+ 'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', '',
+ 'svn', 'svn+ssh', 'sftp','nfs','git', 'git+ssh']
+uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap',
+ 'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips',
+ 'mms', '', 'sftp', 'tel']
+
+# These are not actually used anymore, but should stay for backwards
+# compatibility. (They are undocumented, but have a public-looking name.)
+non_hierarchical = ['gopher', 'hdl', 'mailto', 'news',
+ 'telnet', 'wais', 'imap', 'snews', 'sip', 'sips']
+uses_query = ['http', 'wais', 'imap', 'https', 'shttp', 'mms',
+ 'gopher', 'rtsp', 'rtspu', 'sip', 'sips', '']
+uses_fragment = ['ftp', 'hdl', 'http', 'gopher', 'news',
+ 'nntp', 'wais', 'https', 'shttp', 'snews',
+ 'file', 'prospero', '']
+
+# Characters valid in scheme names
+scheme_chars = ('abcdefghijklmnopqrstuvwxyz'
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ '0123456789'
+ '+-.')
+
+MAX_CACHE_SIZE = 20
+_parse_cache = {}
+
+def clear_cache():
+ """Clear the parse cache."""
+ _parse_cache.clear()
+
+
+class ResultMixin(object):
+ """Shared methods for the parsed result objects."""
+
+ @property
+ def username(self):
+ netloc = self.netloc
+ if "@" in netloc:
+ userinfo = netloc.rsplit("@", 1)[0]
+ if ":" in userinfo:
+ userinfo = userinfo.split(":", 1)[0]
+ return userinfo
+ return None
+
+ @property
+ def password(self):
+ netloc = self.netloc
+ if "@" in netloc:
+ userinfo = netloc.rsplit("@", 1)[0]
+ if ":" in userinfo:
+ return userinfo.split(":", 1)[1]
+ return None
+
+ @property
+ def hostname(self):
+ netloc = self.netloc.split('@')[-1]
+ if '[' in netloc and ']' in netloc:
+ return netloc.split(']')[0][1:].lower()
+ elif ':' in netloc:
+ return netloc.split(':')[0].lower()
+ elif netloc == '':
+ return None
+ else:
+ return netloc.lower()
+
+ @property
+ def port(self):
+ netloc = self.netloc.split('@')[-1].split(']')[-1]
+ if ':' in netloc:
+ port = netloc.split(':')[1]
+ if port:
+ port = int(port, 10)
+ # verify legal port
+ if (0 <= port <= 65535):
+ return port
+ return None
+
+from collections import namedtuple
+
+class SplitResult(namedtuple('SplitResult', 'scheme netloc path query fragment'), ResultMixin):
+
+ __slots__ = ()
+
+ def geturl(self):
+ return urlunsplit(self)
+
+
+class ParseResult(namedtuple('ParseResult', 'scheme netloc path params query fragment'), ResultMixin):
+
+ __slots__ = ()
+
+ def geturl(self):
+ return urlunparse(self)
+
+
+def urlparse(url, scheme='', allow_fragments=True):
+ """Parse a URL into 6 components:
+ <scheme>://<netloc>/<path>;<params>?<query>#<fragment>
+ Return a 6-tuple: (scheme, netloc, path, params, query, fragment).
+ Note that we don't break the components up in smaller bits
+ (e.g. netloc is a single string) and we don't expand % escapes."""
+ tuple = urlsplit(url, scheme, allow_fragments)
+ scheme, netloc, url, query, fragment = tuple
+ if scheme in uses_params and ';' in url:
+ url, params = _splitparams(url)
+ else:
+ params = ''
+ return ParseResult(scheme, netloc, url, params, query, fragment)
+
+def _splitparams(url):
+ if '/' in url:
+ i = url.find(';', url.rfind('/'))
+ if i < 0:
+ return url, ''
+ else:
+ i = url.find(';')
+ return url[:i], url[i+1:]
+
+def _splitnetloc(url, start=0):
+ delim = len(url) # position of end of domain part of url, default is end
+ for c in '/?#': # look for delimiters; the order is NOT important
+ wdelim = url.find(c, start) # find first of this delim
+ if wdelim >= 0: # if found
+ delim = min(delim, wdelim) # use earliest delim position
+ return url[start:delim], url[delim:] # return (domain, rest)
+
+def urlsplit(url, scheme='', allow_fragments=True):
+ """Parse a URL into 5 components:
+ <scheme>://<netloc>/<path>?<query>#<fragment>
+ Return a 5-tuple: (scheme, netloc, path, query, fragment).
+ Note that we don't break the components up in smaller bits
+ (e.g. netloc is a single string) and we don't expand % escapes."""
+ allow_fragments = bool(allow_fragments)
+ key = url, scheme, allow_fragments, type(url), type(scheme)
+ cached = _parse_cache.get(key, None)
+ if cached:
+ return cached
+ if len(_parse_cache) >= MAX_CACHE_SIZE: # avoid runaway growth
+ clear_cache()
+ netloc = query = fragment = ''
+ i = url.find(':')
+ if i > 0:
+ if url[:i] == 'http': # optimize the common case
+ scheme = url[:i].lower()
+ url = url[i+1:]
+ if url[:2] == '//':
+ netloc, url = _splitnetloc(url, 2)
+ if (('[' in netloc and ']' not in netloc) or
+ (']' in netloc and '[' not in netloc)):
+ raise ValueError("Invalid IPv6 URL")
+ if allow_fragments and '#' in url:
+ url, fragment = url.split('#', 1)
+ if '?' in url:
+ url, query = url.split('?', 1)
+ v = SplitResult(scheme, netloc, url, query, fragment)
+ _parse_cache[key] = v
+ return v
+ for c in url[:i]:
+ if c not in scheme_chars:
+ break
+ else:
+ # make sure "url" is not actually a port number (in which case
+ # "scheme" is really part of the path)
+ rest = url[i+1:]
+ if not rest or any(c not in '0123456789' for c in rest):
+ # not a port number
+ scheme, url = url[:i].lower(), rest
+
+ if url[:2] == '//':
+ netloc, url = _splitnetloc(url, 2)
+ if (('[' in netloc and ']' not in netloc) or
+ (']' in netloc and '[' not in netloc)):
+ raise ValueError("Invalid IPv6 URL")
+ if allow_fragments and '#' in url:
+ url, fragment = url.split('#', 1)
+ if '?' in url:
+ url, query = url.split('?', 1)
+ v = SplitResult(scheme, netloc, url, query, fragment)
+ _parse_cache[key] = v
+ return v
+
+def urlunparse(data):
+ """Put a parsed URL back together again. This may result in a
+ slightly different, but equivalent URL, if the URL that was parsed
+ originally had redundant delimiters, e.g. a ? with an empty query
+ (the draft states that these are equivalent)."""
+ scheme, netloc, url, params, query, fragment = data
+ if params:
+ url = "%s;%s" % (url, params)
+ return urlunsplit((scheme, netloc, url, query, fragment))
+
+def urlunsplit(data):
+ """Combine the elements of a tuple as returned by urlsplit() into a
+ complete URL as a string. The data argument can be any five-item iterable.
+ This may result in a slightly different, but equivalent URL, if the URL that
+ was parsed originally had unnecessary delimiters (for example, a ? with an
+ empty query; the RFC states that these are equivalent)."""
+ scheme, netloc, url, query, fragment = data
+ if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'):
+ if url and url[:1] != '/': url = '/' + url
+ url = '//' + (netloc or '') + url
+ if scheme:
+ url = scheme + ':' + url
+ if query:
+ url = url + '?' + query
+ if fragment:
+ url = url + '#' + fragment
+ return url
+
+def urljoin(base, url, allow_fragments=True):
+ """Join a base URL and a possibly relative URL to form an absolute
+ interpretation of the latter."""
+ if not base:
+ return url
+ if not url:
+ return base
+ bscheme, bnetloc, bpath, bparams, bquery, bfragment = \
+ urlparse(base, '', allow_fragments)
+ scheme, netloc, path, params, query, fragment = \
+ urlparse(url, bscheme, allow_fragments)
+ if scheme != bscheme or scheme not in uses_relative:
+ return url
+ if scheme in uses_netloc:
+ if netloc:
+ return urlunparse((scheme, netloc, path,
+ params, query, fragment))
+ netloc = bnetloc
+ if path[:1] == '/':
+ return urlunparse((scheme, netloc, path,
+ params, query, fragment))
+ if not path and not params:
+ path = bpath
+ params = bparams
+ if not query:
+ query = bquery
+ return urlunparse((scheme, netloc, path,
+ params, query, fragment))
+ segments = bpath.split('/')[:-1] + path.split('/')
+ # XXX The stuff below is bogus in various ways...
+ if segments[-1] == '.':
+ segments[-1] = ''
+ while '.' in segments:
+ segments.remove('.')
+ while 1:
+ i = 1
+ n = len(segments) - 1
+ while i < n:
+ if (segments[i] == '..'
+ and segments[i-1] not in ('', '..')):
+ del segments[i-1:i+1]
+ break
+ i = i+1
+ else:
+ break
+ if segments == ['', '..']:
+ segments[-1] = ''
+ elif len(segments) >= 2 and segments[-1] == '..':
+ segments[-2:] = ['']
+ return urlunparse((scheme, netloc, '/'.join(segments),
+ params, query, fragment))
+
+def urldefrag(url):
+ """Removes any existing fragment from URL.
+
+ Returns a tuple of the defragmented URL and the fragment. If
+ the URL contained no fragments, the second element is the
+ empty string.
+ """
+ if '#' in url:
+ s, n, p, a, q, frag = urlparse(url)
+ defrag = urlunparse((s, n, p, a, q, ''))
+ return defrag, frag
+ else:
+ return url, ''
+
+try:
+ unicode
+except NameError:
+ def _is_unicode(x):
+ return 0
+else:
+ def _is_unicode(x):
+ return isinstance(x, unicode)
+
+# unquote method for parse_qs and parse_qsl
+# Cannot use directly from urllib as it would create a circular reference
+# because urllib uses urlparse methods (urljoin). If you update this function,
+# update it also in urllib. This code duplication does not existin in Python3.
+
+_hexdig = '0123456789ABCDEFabcdef'
+_hextochr = dict((a+b, chr(int(a+b,16)))
+ for a in _hexdig for b in _hexdig)
+_asciire = re.compile('([\x00-\x7f]+)')
+
+def unquote(s):
+ """unquote('abc%20def') -> 'abc def'."""
+ if _is_unicode(s):
+ if '%' not in s:
+ return s
+ bits = _asciire.split(s)
+ res = [bits[0]]
+ append = res.append
+ for i in range(1, len(bits), 2):
+ append(unquote(str(bits[i])).decode('latin1'))
+ append(bits[i + 1])
+ return ''.join(res)
+
+ bits = s.split('%')
+ # fastpath
+ if len(bits) == 1:
+ return s
+ res = [bits[0]]
+ append = res.append
+ for item in bits[1:]:
+ try:
+ append(_hextochr[item[:2]])
+ append(item[2:])
+ except KeyError:
+ append('%')
+ append(item)
+ return ''.join(res)
+
+def parse_qs(qs, keep_blank_values=0, strict_parsing=0):
+ """Parse a query given as a string argument.
+
+ Arguments:
+
+ qs: percent-encoded query string to be parsed
+
+ keep_blank_values: flag indicating whether blank values in
+ percent-encoded queries should be treated as blank strings.
+ A true value indicates that blanks should be retained as
+ blank strings. The default false value indicates that
+ blank values are to be ignored and treated as if they were
+ not included.
+
+ strict_parsing: flag indicating what to do with parsing errors.
+ If false (the default), errors are silently ignored.
+ If true, errors raise a ValueError exception.
+ """
+ dict = {}
+ for name, value in parse_qsl(qs, keep_blank_values, strict_parsing):
+ if name in dict:
+ dict[name].append(value)
+ else:
+ dict[name] = [value]
+ return dict
+
+def parse_qsl(qs, keep_blank_values=0, strict_parsing=0):
+ """Parse a query given as a string argument.
+
+ Arguments:
+
+ qs: percent-encoded query string to be parsed
+
+ keep_blank_values: flag indicating whether blank values in
+ percent-encoded queries should be treated as blank strings. A
+ true value indicates that blanks should be retained as blank
+ strings. The default false value indicates that blank values
+ are to be ignored and treated as if they were not included.
+
+ strict_parsing: flag indicating what to do with parsing errors. If
+ false (the default), errors are silently ignored. If true,
+ errors raise a ValueError exception.
+
+ Returns a list, as G-d intended.
+ """
+ pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')]
+ r = []
+ for name_value in pairs:
+ if not name_value and not strict_parsing:
+ continue
+ nv = name_value.split('=', 1)
+ if len(nv) != 2:
+ if strict_parsing:
+ raise ValueError, "bad query field: %r" % (name_value,)
+ # Handle case of a control-name with no equal sign
+ if keep_blank_values:
+ nv.append('')
+ else:
+ continue
+ if len(nv[1]) or keep_blank_values:
+ name = unquote(nv[0].replace('+', ' '))
+ value = unquote(nv[1].replace('+', ' '))
+ r.append((name, value))
+
+ return 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
index 0000000000..8098c6e635
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/warnings.py
@@ -0,0 +1,404 @@
+"""Python part of the warnings subsystem."""
+
+# Note: function level imports should *not* be used
+# in this module as it may cause import lock deadlock.
+# See bug 683658.
+import linecache
+import sys
+import types
+
+__all__ = ["warn", "warn_explicit", "showwarning",
+ "formatwarning", "filterwarnings", "simplefilter",
+ "resetwarnings", "catch_warnings"]
+
+
+def warnpy3k(message, category=None, stacklevel=1):
+ """Issue a deprecation warning for Python 3.x related changes.
+
+ Warnings are omitted unless Python is started with the -3 option.
+ """
+ if sys.py3kwarning:
+ if category is None:
+ category = DeprecationWarning
+ warn(message, category, stacklevel+1)
+
+def _show_warning(message, category, filename, lineno, file=None, line=None):
+ """Hook to write a warning to a file; replace if you like."""
+ if file is None:
+ file = sys.stderr
+ if file is None:
+ # sys.stderr is None - warnings get lost
+ return
+ try:
+ file.write(formatwarning(message, category, filename, lineno, line))
+ except IOError:
+ pass # the file (probably stderr) is invalid - this warning gets lost.
+# Keep a working version around in case the deprecation of the old API is
+# triggered.
+showwarning = _show_warning
+
+def formatwarning(message, category, filename, lineno, line=None):
+ """Function to format a warning the standard way."""
+ s = "%s:%s: %s: %s\n" % (filename, lineno, category.__name__, message)
+ line = linecache.getline(filename, lineno) if line is None else line
+ if line:
+ line = line.strip()
+ s += " %s\n" % line
+ return s
+
+def filterwarnings(action, message="", category=Warning, module="", lineno=0,
+ append=0):
+ """Insert an entry into the list of warnings filters (at the front).
+
+ 'action' -- one of "error", "ignore", "always", "default", "module",
+ or "once"
+ 'message' -- a regex that the warning message must match
+ 'category' -- a class that the warning must be a subclass of
+ 'module' -- a regex that the module name must match
+ 'lineno' -- an integer line number, 0 matches all warnings
+ 'append' -- if true, append to the list of filters
+ """
+ import re
+ assert action in ("error", "ignore", "always", "default", "module",
+ "once"), "invalid action: %r" % (action,)
+ assert isinstance(message, basestring), "message must be a string"
+ assert isinstance(category, (type, types.ClassType)), \
+ "category must be a class"
+ assert issubclass(category, Warning), "category must be a Warning subclass"
+ assert isinstance(module, basestring), "module must be a string"
+ assert isinstance(lineno, int) and lineno >= 0, \
+ "lineno must be an int >= 0"
+ item = (action, re.compile(message, re.I), category,
+ re.compile(module), lineno)
+ if append:
+ filters.append(item)
+ else:
+ filters.insert(0, item)
+
+def simplefilter(action, category=Warning, lineno=0, append=0):
+ """Insert a simple entry into the list of warnings filters (at the front).
+
+ A simple filter matches all modules and messages.
+ 'action' -- one of "error", "ignore", "always", "default", "module",
+ or "once"
+ 'category' -- a class that the warning must be a subclass of
+ 'lineno' -- an integer line number, 0 matches all warnings
+ 'append' -- if true, append to the list of filters
+ """
+ assert action in ("error", "ignore", "always", "default", "module",
+ "once"), "invalid action: %r" % (action,)
+ assert isinstance(lineno, int) and lineno >= 0, \
+ "lineno must be an int >= 0"
+ item = (action, None, category, None, lineno)
+ if append:
+ filters.append(item)
+ else:
+ filters.insert(0, item)
+
+def resetwarnings():
+ """Clear the list of warning filters, so that no filters are active."""
+ filters[:] = []
+
+class _OptionError(Exception):
+ """Exception used by option processing helpers."""
+ pass
+
+# Helper to process -W options passed via sys.warnoptions
+def _processoptions(args):
+ for arg in args:
+ try:
+ _setoption(arg)
+ except _OptionError, msg:
+ print >>sys.stderr, "Invalid -W option ignored:", msg
+
+# Helper for _processoptions()
+def _setoption(arg):
+ import re
+ parts = arg.split(':')
+ if len(parts) > 5:
+ raise _OptionError("too many fields (max 5): %r" % (arg,))
+ while len(parts) < 5:
+ parts.append('')
+ action, message, category, module, lineno = [s.strip()
+ for s in parts]
+ action = _getaction(action)
+ message = re.escape(message)
+ category = _getcategory(category)
+ module = re.escape(module)
+ if module:
+ module = module + '$'
+ if lineno:
+ try:
+ lineno = int(lineno)
+ if lineno < 0:
+ raise ValueError
+ except (ValueError, OverflowError):
+ raise _OptionError("invalid lineno %r" % (lineno,))
+ else:
+ lineno = 0
+ filterwarnings(action, message, category, module, lineno)
+
+# Helper for _setoption()
+def _getaction(action):
+ if not action:
+ return "default"
+ if action == "all": return "always" # Alias
+ for a in ('default', 'always', 'ignore', 'module', 'once', 'error'):
+ if a.startswith(action):
+ return a
+ raise _OptionError("invalid action: %r" % (action,))
+
+# Helper for _setoption()
+def _getcategory(category):
+ import re
+ if not category:
+ return Warning
+ if re.match("^[a-zA-Z0-9_]+$", category):
+ try:
+ cat = eval(category)
+ except NameError:
+ raise _OptionError("unknown warning category: %r" % (category,))
+ else:
+ i = category.rfind(".")
+ module = category[:i]
+ klass = category[i+1:]
+ try:
+ m = __import__(module, None, None, [klass])
+ except ImportError:
+ raise _OptionError("invalid module name: %r" % (module,))
+ try:
+ cat = getattr(m, klass)
+ except AttributeError:
+ raise _OptionError("unknown warning category: %r" % (category,))
+ if not issubclass(cat, Warning):
+ raise _OptionError("invalid warning category: %r" % (category,))
+ return cat
+
+
+# Code typically replaced by _warnings
+def warn(message, category=None, stacklevel=1):
+ """Issue a warning, or maybe ignore it or raise an exception."""
+ # Check if message is already a Warning object
+ if isinstance(message, Warning):
+ category = message.__class__
+ # Check category argument
+ if category is None:
+ category = UserWarning
+ assert issubclass(category, Warning)
+ # Get context information
+ try:
+ caller = sys._getframe(stacklevel)
+ except ValueError:
+ globals = sys.__dict__
+ lineno = 1
+ else:
+ globals = caller.f_globals
+ lineno = caller.f_lineno
+ if '__name__' in globals:
+ module = globals['__name__']
+ else:
+ module = "<string>"
+ filename = globals.get('__file__')
+ if filename:
+ fnl = filename.lower()
+ if fnl.endswith((".pyc", ".pyo")):
+ filename = filename[:-1]
+ else:
+ if module == "__main__":
+ try:
+ filename = sys.argv[0]
+ except AttributeError:
+ # embedded interpreters don't have sys.argv, see bug #839151
+ filename = '__main__'
+ if not filename:
+ filename = module
+ registry = globals.setdefault("__warningregistry__", {})
+ warn_explicit(message, category, filename, lineno, module, registry,
+ globals)
+
+def warn_explicit(message, category, filename, lineno,
+ module=None, registry=None, module_globals=None):
+ lineno = int(lineno)
+ if module is None:
+ module = filename or "<unknown>"
+ if module[-3:].lower() == ".py":
+ module = module[:-3] # XXX What about leading pathname?
+ if registry is None:
+ registry = {}
+ if isinstance(message, Warning):
+ text = str(message)
+ category = message.__class__
+ else:
+ text = message
+ message = category(message)
+ key = (text, category, lineno)
+ # Quick test for common case
+ if registry.get(key):
+ return
+ # Search the filters
+ for item in filters:
+ action, msg, cat, mod, ln = item
+ if ((msg is None or msg.match(text)) and
+ issubclass(category, cat) and
+ (mod is None or mod.match(module)) and
+ (ln == 0 or lineno == ln)):
+ break
+ else:
+ action = defaultaction
+ # Early exit actions
+ if action == "ignore":
+ registry[key] = 1
+ return
+
+ # Prime the linecache for formatting, in case the
+ # "file" is actually in a zipfile or something.
+ linecache.getlines(filename, module_globals)
+
+ if action == "error":
+ raise message
+ # Other actions
+ if action == "once":
+ registry[key] = 1
+ oncekey = (text, category)
+ if onceregistry.get(oncekey):
+ return
+ onceregistry[oncekey] = 1
+ elif action == "always":
+ pass
+ elif action == "module":
+ registry[key] = 1
+ altkey = (text, category, 0)
+ if registry.get(altkey):
+ return
+ registry[altkey] = 1
+ elif action == "default":
+ registry[key] = 1
+ else:
+ # Unrecognized actions are errors
+ raise RuntimeError(
+ "Unrecognized action (%r) in warnings.filters:\n %s" %
+ (action, item))
+ # Print message and context
+ showwarning(message, category, filename, lineno)
+
+
+class WarningMessage(object):
+
+ """Holds the result of a single showwarning() call."""
+
+ _WARNING_DETAILS = ("message", "category", "filename", "lineno", "file",
+ "line")
+
+ def __init__(self, message, category, filename, lineno, file=None,
+ line=None):
+ local_values = locals()
+ for attr in self._WARNING_DETAILS:
+ setattr(self, attr, local_values[attr])
+ self._category_name = category.__name__ if category else None
+
+ def __str__(self):
+ return ("{message : %r, category : %r, filename : %r, lineno : %s, "
+ "line : %r}" % (self.message, self._category_name,
+ self.filename, self.lineno, self.line))
+
+
+class catch_warnings(object):
+
+ """A context manager that copies and restores the warnings filter upon
+ exiting the context.
+
+ The 'record' argument specifies whether warnings should be captured by a
+ custom implementation of warnings.showwarning() and be appended to a list
+ returned by the context manager. Otherwise None is returned by the context
+ manager. The objects appended to the list are arguments whose attributes
+ mirror the arguments to showwarning().
+
+ The 'module' argument is to specify an alternative module to the module
+ named 'warnings' and imported under that name. This argument is only useful
+ when testing the warnings module itself.
+
+ """
+
+ def __init__(self, record=False, module=None):
+ """Specify whether to record warnings and if an alternative module
+ should be used other than sys.modules['warnings'].
+
+ For compatibility with Python 3.0, please consider all arguments to be
+ keyword-only.
+
+ """
+ self._record = record
+ self._module = sys.modules['warnings'] if module is None else module
+ self._entered = False
+
+ def __repr__(self):
+ args = []
+ if self._record:
+ args.append("record=True")
+ if self._module is not sys.modules['warnings']:
+ args.append("module=%r" % self._module)
+ name = type(self).__name__
+ return "%s(%s)" % (name, ", ".join(args))
+
+ def __enter__(self):
+ if self._entered:
+ raise RuntimeError("Cannot enter %r twice" % self)
+ self._entered = True
+ self._filters = self._module.filters
+ self._module.filters = self._filters[:]
+ self._showwarning = self._module.showwarning
+ if self._record:
+ log = []
+ def showwarning(*args, **kwargs):
+ log.append(WarningMessage(*args, **kwargs))
+ self._module.showwarning = showwarning
+ return log
+ else:
+ return None
+
+ def __exit__(self, *exc_info):
+ if not self._entered:
+ raise RuntimeError("Cannot exit %r without entering first" % self)
+ self._module.filters = self._filters
+ self._module.showwarning = self._showwarning
+
+
+# filters contains a sequence of filter 5-tuples
+# The components of the 5-tuple are:
+# - an action: error, ignore, always, default, module, or once
+# - a compiled regex that must match the warning message
+# - a class representing the warning category
+# - a compiled regex that must match the module that is being warned
+# - a line number for the line being warning, or 0 to mean any line
+# If either if the compiled regexs are None, match anything.
+_warnings_defaults = False
+try:
+ from _warnings import (filters, default_action, once_registry,
+ warn, warn_explicit)
+ defaultaction = default_action
+ onceregistry = once_registry
+ _warnings_defaults = True
+except ImportError:
+ filters = []
+ defaultaction = "default"
+ onceregistry = {}
+
+
+# Module initialization
+_processoptions(sys.warnoptions)
+if not _warnings_defaults:
+ silence = [ImportWarning, PendingDeprecationWarning]
+ # Don't silence DeprecationWarning if -3 or -Q was used.
+ if not sys.py3kwarning and not sys.flags.division_warning:
+ silence.append(DeprecationWarning)
+ for cls in silence:
+ simplefilter("ignore", category=cls)
+ bytes_warning = sys.flags.bytes_warning
+ if bytes_warning > 1:
+ bytes_action = "error"
+ elif bytes_warning:
+ bytes_action = "default"
+ else:
+ bytes_action = "ignore"
+ simplefilter(bytes_action, category=BytesWarning, append=1)
+del _warnings_defaults
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
index 0000000000..dc6dbf050b
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/weakref.py
@@ -0,0 +1,443 @@
+"""Weak reference support for Python.
+
+This module is an implementation of PEP 205:
+
+http://www.python.org/dev/peps/pep-0205/
+"""
+
+# Naming convention: Variables named "wr" are weak reference objects;
+# they are called this instead of "ref" to avoid name collisions with
+# the module-global ref() function imported from _weakref.
+
+import UserDict
+
+from _weakref import (
+ getweakrefcount,
+ getweakrefs,
+ ref,
+ proxy,
+ CallableProxyType,
+ ProxyType,
+ ReferenceType)
+
+from _weakrefset import WeakSet, _IterationGuard
+
+from exceptions import ReferenceError
+
+
+ProxyTypes = (ProxyType, CallableProxyType)
+
+__all__ = ["ref", "proxy", "getweakrefcount", "getweakrefs",
+ "WeakKeyDictionary", "ReferenceError", "ReferenceType", "ProxyType",
+ "CallableProxyType", "ProxyTypes", "WeakValueDictionary", 'WeakSet']
+
+
+class WeakValueDictionary(UserDict.UserDict):
+ """Mapping class that references values weakly.
+
+ Entries in the dictionary will be discarded when no strong
+ reference to the value exists anymore
+ """
+ # We inherit the constructor without worrying about the input
+ # dictionary; since it uses our .update() method, we get the right
+ # checks (if the other dictionary is a WeakValueDictionary,
+ # objects are unwrapped on the way out, and we always wrap on the
+ # way in).
+
+ def __init__(self, *args, **kw):
+ def remove(wr, selfref=ref(self)):
+ self = selfref()
+ if self is not None:
+ if self._iterating:
+ self._pending_removals.append(wr.key)
+ else:
+ del self.data[wr.key]
+ self._remove = remove
+ # A list of keys to be removed
+ self._pending_removals = []
+ self._iterating = set()
+ UserDict.UserDict.__init__(self, *args, **kw)
+
+ def _commit_removals(self):
+ l = self._pending_removals
+ d = self.data
+ # We shouldn't encounter any KeyError, because this method should
+ # always be called *before* mutating the dict.
+ while l:
+ del d[l.pop()]
+
+ def __getitem__(self, key):
+ o = self.data[key]()
+ if o is None:
+ raise KeyError, key
+ else:
+ return o
+
+ def __delitem__(self, key):
+ if self._pending_removals:
+ self._commit_removals()
+ del self.data[key]
+
+ def __contains__(self, key):
+ try:
+ o = self.data[key]()
+ except KeyError:
+ return False
+ return o is not None
+
+ def has_key(self, key):
+ try:
+ o = self.data[key]()
+ except KeyError:
+ return False
+ return o is not None
+
+ def __repr__(self):
+ return "<WeakValueDictionary at %s>" % id(self)
+
+ def __setitem__(self, key, value):
+ if self._pending_removals:
+ self._commit_removals()
+ self.data[key] = KeyedRef(value, self._remove, key)
+
+ def clear(self):
+ if self._pending_removals:
+ self._commit_removals()
+ self.data.clear()
+
+ def copy(self):
+ new = WeakValueDictionary()
+ for key, wr in self.data.items():
+ o = wr()
+ if o is not None:
+ new[key] = o
+ return new
+
+ __copy__ = copy
+
+ def __deepcopy__(self, memo):
+ from copy import deepcopy
+ new = self.__class__()
+ for key, wr in self.data.items():
+ o = wr()
+ if o is not None:
+ new[deepcopy(key, memo)] = o
+ return new
+
+ def get(self, key, default=None):
+ try:
+ wr = self.data[key]
+ except KeyError:
+ return default
+ else:
+ o = wr()
+ if o is None:
+ # This should only happen
+ return default
+ else:
+ return o
+
+ def items(self):
+ L = []
+ for key, wr in self.data.items():
+ o = wr()
+ if o is not None:
+ L.append((key, o))
+ return L
+
+ def iteritems(self):
+ with _IterationGuard(self):
+ for wr in self.data.itervalues():
+ value = wr()
+ if value is not None:
+ yield wr.key, value
+
+ def iterkeys(self):
+ with _IterationGuard(self):
+ for k in self.data.iterkeys():
+ yield k
+
+ __iter__ = iterkeys
+
+ def itervaluerefs(self):
+ """Return an iterator that yields the weak references to the values.
+
+ The references are not guaranteed to be 'live' at the time
+ they are used, so the result of calling the references needs
+ to be checked before being used. This can be used to avoid
+ creating references that will cause the garbage collector to
+ keep the values around longer than needed.
+
+ """
+ with _IterationGuard(self):
+ for wr in self.data.itervalues():
+ yield wr
+
+ def itervalues(self):
+ with _IterationGuard(self):
+ for wr in self.data.itervalues():
+ obj = wr()
+ if obj is not None:
+ yield obj
+
+ def popitem(self):
+ if self._pending_removals:
+ self._commit_removals()
+ while 1:
+ key, wr = self.data.popitem()
+ o = wr()
+ if o is not None:
+ return key, o
+
+ def pop(self, key, *args):
+ if self._pending_removals:
+ self._commit_removals()
+ try:
+ o = self.data.pop(key)()
+ except KeyError:
+ if args:
+ return args[0]
+ raise
+ if o is None:
+ raise KeyError, key
+ else:
+ return o
+
+ def setdefault(self, key, default=None):
+ try:
+ wr = self.data[key]
+ except KeyError:
+ if self._pending_removals:
+ self._commit_removals()
+ self.data[key] = KeyedRef(default, self._remove, key)
+ return default
+ else:
+ return wr()
+
+ def update(self, dict=None, **kwargs):
+ if self._pending_removals:
+ self._commit_removals()
+ d = self.data
+ if dict is not None:
+ if not hasattr(dict, "items"):
+ dict = type({})(dict)
+ for key, o in dict.items():
+ d[key] = KeyedRef(o, self._remove, key)
+ if len(kwargs):
+ self.update(kwargs)
+
+ def valuerefs(self):
+ """Return a list of weak references to the values.
+
+ The references are not guaranteed to be 'live' at the time
+ they are used, so the result of calling the references needs
+ to be checked before being used. This can be used to avoid
+ creating references that will cause the garbage collector to
+ keep the values around longer than needed.
+
+ """
+ return self.data.values()
+
+ def values(self):
+ L = []
+ for wr in self.data.values():
+ o = wr()
+ if o is not None:
+ L.append(o)
+ return L
+
+
+class KeyedRef(ref):
+ """Specialized reference that includes a key corresponding to the value.
+
+ This is used in the WeakValueDictionary to avoid having to create
+ a function object for each key stored in the mapping. A shared
+ callback object can use the 'key' attribute of a KeyedRef instead
+ of getting a reference to the key from an enclosing scope.
+
+ """
+
+ __slots__ = "key",
+
+ def __new__(type, ob, callback, key):
+ self = ref.__new__(type, ob, callback)
+ self.key = key
+ return self
+
+ def __init__(self, ob, callback, key):
+ super(KeyedRef, self).__init__(ob, callback)
+
+
+class WeakKeyDictionary(UserDict.UserDict):
+ """ Mapping class that references keys weakly.
+
+ Entries in the dictionary will be discarded when there is no
+ longer a strong reference to the key. This can be used to
+ associate additional data with an object owned by other parts of
+ an application without adding attributes to those objects. This
+ can be especially useful with objects that override attribute
+ accesses.
+ """
+
+ def __init__(self, dict=None):
+ self.data = {}
+ def remove(k, selfref=ref(self)):
+ self = selfref()
+ if self is not None:
+ if self._iterating:
+ self._pending_removals.append(k)
+ else:
+ del self.data[k]
+ self._remove = remove
+ # A list of dead weakrefs (keys to be removed)
+ self._pending_removals = []
+ self._iterating = set()
+ if dict is not None:
+ self.update(dict)
+
+ def _commit_removals(self):
+ # NOTE: We don't need to call this method before mutating the dict,
+ # because a dead weakref never compares equal to a live weakref,
+ # even if they happened to refer to equal objects.
+ # However, it means keys may already have been removed.
+ l = self._pending_removals
+ d = self.data
+ while l:
+ try:
+ del d[l.pop()]
+ except KeyError:
+ pass
+
+ def __delitem__(self, key):
+ del self.data[ref(key)]
+
+ def __getitem__(self, key):
+ return self.data[ref(key)]
+
+ def __repr__(self):
+ return "<WeakKeyDictionary at %s>" % id(self)
+
+ def __setitem__(self, key, value):
+ self.data[ref(key, self._remove)] = value
+
+ def copy(self):
+ new = WeakKeyDictionary()
+ for key, value in self.data.items():
+ o = key()
+ if o is not None:
+ new[o] = value
+ return new
+
+ __copy__ = copy
+
+ def __deepcopy__(self, memo):
+ from copy import deepcopy
+ new = self.__class__()
+ for key, value in self.data.items():
+ o = key()
+ if o is not None:
+ new[o] = deepcopy(value, memo)
+ return new
+
+ def get(self, key, default=None):
+ return self.data.get(ref(key),default)
+
+ def has_key(self, key):
+ try:
+ wr = ref(key)
+ except TypeError:
+ return 0
+ return wr in self.data
+
+ def __contains__(self, key):
+ try:
+ wr = ref(key)
+ except TypeError:
+ return 0
+ return wr in self.data
+
+ def items(self):
+ L = []
+ for key, value in self.data.items():
+ o = key()
+ if o is not None:
+ L.append((o, value))
+ return L
+
+ def iteritems(self):
+ with _IterationGuard(self):
+ for wr, value in self.data.iteritems():
+ key = wr()
+ if key is not None:
+ yield key, value
+
+ def iterkeyrefs(self):
+ """Return an iterator that yields the weak references to the keys.
+
+ The references are not guaranteed to be 'live' at the time
+ they are used, so the result of calling the references needs
+ to be checked before being used. This can be used to avoid
+ creating references that will cause the garbage collector to
+ keep the keys around longer than needed.
+
+ """
+ with _IterationGuard(self):
+ for wr in self.data.iterkeys():
+ yield wr
+
+ def iterkeys(self):
+ with _IterationGuard(self):
+ for wr in self.data.iterkeys():
+ obj = wr()
+ if obj is not None:
+ yield obj
+
+ __iter__ = iterkeys
+
+ def itervalues(self):
+ with _IterationGuard(self):
+ for value in self.data.itervalues():
+ yield value
+
+ def keyrefs(self):
+ """Return a list of weak references to the keys.
+
+ The references are not guaranteed to be 'live' at the time
+ they are used, so the result of calling the references needs
+ to be checked before being used. This can be used to avoid
+ creating references that will cause the garbage collector to
+ keep the keys around longer than needed.
+
+ """
+ return self.data.keys()
+
+ def keys(self):
+ L = []
+ for wr in self.data.keys():
+ o = wr()
+ if o is not None:
+ L.append(o)
+ return L
+
+ def popitem(self):
+ while 1:
+ key, value = self.data.popitem()
+ o = key()
+ if o is not None:
+ return o, value
+
+ def pop(self, key, *args):
+ return self.data.pop(ref(key), *args)
+
+ def setdefault(self, key, default=None):
+ return self.data.setdefault(ref(key, self._remove),default)
+
+ def update(self, dict=None, **kwargs):
+ d = self.data
+ if dict is not None:
+ if not hasattr(dict, "items"):
+ dict = type({})(dict)
+ for key, value in dict.items():
+ d[ref(key, self._remove)] = value
+ if len(kwargs):
+ self.update(kwargs)
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
index 0000000000..086543a694
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/__init__.py
@@ -0,0 +1,41 @@
+"""Core XML support for Python.
+
+This package contains four sub-packages:
+
+dom -- The W3C Document Object Model. This supports DOM Level 1 +
+ Namespaces.
+
+parsers -- Python wrappers for XML parsers (currently only supports Expat).
+
+sax -- The Simple API for XML, developed by XML-Dev, led by David
+ Megginson and ported to Python by Lars Marius Garshol. This
+ supports the SAX 2 API.
+
+etree -- The ElementTree XML library. This is a subset of the full
+ ElementTree XML release.
+
+"""
+
+
+__all__ = ["dom", "parsers", "sax", "etree"]
+
+_MINIMUM_XMLPLUS_VERSION = (0, 8, 4)
+
+
+try:
+ import _xmlplus
+except ImportError:
+ pass
+else:
+ try:
+ v = _xmlplus.version_info
+ except AttributeError:
+ # _xmlplus is too old; ignore it
+ pass
+ else:
+ if v >= _MINIMUM_XMLPLUS_VERSION:
+ import sys
+ _xmlplus.__path__.extend(__path__)
+ sys.modules[__name__] = _xmlplus
+ else:
+ del v
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
index 0000000000..07886e057c
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/NodeFilter.py
@@ -0,0 +1,27 @@
+# This is the Python mapping for interface NodeFilter from
+# DOM2-Traversal-Range. It contains only constants.
+
+class NodeFilter:
+ """
+ This is the DOM2 NodeFilter interface. It contains only constants.
+ """
+ FILTER_ACCEPT = 1
+ FILTER_REJECT = 2
+ FILTER_SKIP = 3
+
+ SHOW_ALL = 0xFFFFFFFFL
+ SHOW_ELEMENT = 0x00000001
+ SHOW_ATTRIBUTE = 0x00000002
+ SHOW_TEXT = 0x00000004
+ SHOW_CDATA_SECTION = 0x00000008
+ SHOW_ENTITY_REFERENCE = 0x00000010
+ SHOW_ENTITY = 0x00000020
+ SHOW_PROCESSING_INSTRUCTION = 0x00000040
+ SHOW_COMMENT = 0x00000080
+ SHOW_DOCUMENT = 0x00000100
+ SHOW_DOCUMENT_TYPE = 0x00000200
+ SHOW_DOCUMENT_FRAGMENT = 0x00000400
+ SHOW_NOTATION = 0x00000800
+
+ def acceptNode(self, node):
+ raise NotImplementedError
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
index 0000000000..5da489d18c
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/__init__.py
@@ -0,0 +1,139 @@
+"""W3C Document Object Model implementation for Python.
+
+The Python mapping of the Document Object Model is documented in the
+Python Library Reference in the section on the xml.dom package.
+
+This package contains the following modules:
+
+minidom -- A simple implementation of the Level 1 DOM with namespace
+ support added (based on the Level 2 specification) and other
+ minor Level 2 functionality.
+
+pulldom -- DOM builder supporting on-demand tree-building for selected
+ subtrees of the document.
+
+"""
+
+
+class Node:
+ """Class giving the NodeType constants."""
+
+ # DOM implementations may use this as a base class for their own
+ # Node implementations. If they don't, the constants defined here
+ # should still be used as the canonical definitions as they match
+ # the values given in the W3C recommendation. Client code can
+ # safely refer to these values in all tests of Node.nodeType
+ # values.
+
+ ELEMENT_NODE = 1
+ ATTRIBUTE_NODE = 2
+ TEXT_NODE = 3
+ CDATA_SECTION_NODE = 4
+ ENTITY_REFERENCE_NODE = 5
+ ENTITY_NODE = 6
+ PROCESSING_INSTRUCTION_NODE = 7
+ COMMENT_NODE = 8
+ DOCUMENT_NODE = 9
+ DOCUMENT_TYPE_NODE = 10
+ DOCUMENT_FRAGMENT_NODE = 11
+ NOTATION_NODE = 12
+
+
+#ExceptionCode
+INDEX_SIZE_ERR = 1
+DOMSTRING_SIZE_ERR = 2
+HIERARCHY_REQUEST_ERR = 3
+WRONG_DOCUMENT_ERR = 4
+INVALID_CHARACTER_ERR = 5
+NO_DATA_ALLOWED_ERR = 6
+NO_MODIFICATION_ALLOWED_ERR = 7
+NOT_FOUND_ERR = 8
+NOT_SUPPORTED_ERR = 9
+INUSE_ATTRIBUTE_ERR = 10
+INVALID_STATE_ERR = 11
+SYNTAX_ERR = 12
+INVALID_MODIFICATION_ERR = 13
+NAMESPACE_ERR = 14
+INVALID_ACCESS_ERR = 15
+VALIDATION_ERR = 16
+
+
+class DOMException(Exception):
+ """Abstract base class for DOM exceptions.
+ Exceptions with specific codes are specializations of this class."""
+
+ def __init__(self, *args, **kw):
+ if self.__class__ is DOMException:
+ raise RuntimeError(
+ "DOMException should not be instantiated directly")
+ Exception.__init__(self, *args, **kw)
+
+ def _get_code(self):
+ return self.code
+
+
+class IndexSizeErr(DOMException):
+ code = INDEX_SIZE_ERR
+
+class DomstringSizeErr(DOMException):
+ code = DOMSTRING_SIZE_ERR
+
+class HierarchyRequestErr(DOMException):
+ code = HIERARCHY_REQUEST_ERR
+
+class WrongDocumentErr(DOMException):
+ code = WRONG_DOCUMENT_ERR
+
+class InvalidCharacterErr(DOMException):
+ code = INVALID_CHARACTER_ERR
+
+class NoDataAllowedErr(DOMException):
+ code = NO_DATA_ALLOWED_ERR
+
+class NoModificationAllowedErr(DOMException):
+ code = NO_MODIFICATION_ALLOWED_ERR
+
+class NotFoundErr(DOMException):
+ code = NOT_FOUND_ERR
+
+class NotSupportedErr(DOMException):
+ code = NOT_SUPPORTED_ERR
+
+class InuseAttributeErr(DOMException):
+ code = INUSE_ATTRIBUTE_ERR
+
+class InvalidStateErr(DOMException):
+ code = INVALID_STATE_ERR
+
+class SyntaxErr(DOMException):
+ code = SYNTAX_ERR
+
+class InvalidModificationErr(DOMException):
+ code = INVALID_MODIFICATION_ERR
+
+class NamespaceErr(DOMException):
+ code = NAMESPACE_ERR
+
+class InvalidAccessErr(DOMException):
+ code = INVALID_ACCESS_ERR
+
+class ValidationErr(DOMException):
+ code = VALIDATION_ERR
+
+class UserDataHandler:
+ """Class giving the operation constants for UserDataHandler.handle()."""
+
+ # Based on DOM Level 3 (WD 9 April 2002)
+
+ NODE_CLONED = 1
+ NODE_IMPORTED = 2
+ NODE_DELETED = 3
+ NODE_RENAMED = 4
+
+XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace"
+XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/"
+XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml"
+EMPTY_NAMESPACE = None
+EMPTY_PREFIX = None
+
+from domreg import getDOMImplementation,registerDOMImplementation
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
index 0000000000..751f54ac81
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/domreg.py
@@ -0,0 +1,99 @@
+"""Registration facilities for DOM. This module should not be used
+directly. Instead, the functions getDOMImplementation and
+registerDOMImplementation should be imported from xml.dom."""
+
+from xml.dom.minicompat import * # isinstance, StringTypes
+
+# This is a list of well-known implementations. Well-known names
+# should be published by posting to xml-sig@python.org, and are
+# subsequently recorded in this file.
+
+well_known_implementations = {
+ 'minidom':'xml.dom.minidom',
+ '4DOM': 'xml.dom.DOMImplementation',
+ }
+
+# DOM implementations not officially registered should register
+# themselves with their
+
+registered = {}
+
+def registerDOMImplementation(name, factory):
+ """registerDOMImplementation(name, factory)
+
+ Register the factory function with the name. The factory function
+ should return an object which implements the DOMImplementation
+ interface. The factory function can either return the same object,
+ or a new one (e.g. if that implementation supports some
+ customization)."""
+
+ registered[name] = factory
+
+def _good_enough(dom, features):
+ "_good_enough(dom, features) -> Return 1 if the dom offers the features"
+ for f,v in features:
+ if not dom.hasFeature(f,v):
+ return 0
+ return 1
+
+def getDOMImplementation(name = None, features = ()):
+ """getDOMImplementation(name = None, features = ()) -> DOM implementation.
+
+ Return a suitable DOM implementation. The name is either
+ well-known, the module name of a DOM implementation, or None. If
+ it is not None, imports the corresponding module and returns
+ DOMImplementation object if the import succeeds.
+
+ If name is not given, consider the available implementations to
+ find one with the required feature set. If no implementation can
+ be found, raise an ImportError. The features list must be a sequence
+ of (feature, version) pairs which are passed to hasFeature."""
+
+ import os
+ creator = None
+ mod = well_known_implementations.get(name)
+ if mod:
+ mod = __import__(mod, {}, {}, ['getDOMImplementation'])
+ return mod.getDOMImplementation()
+ elif name:
+ return registered[name]()
+ elif "PYTHON_DOM" in os.environ:
+ return getDOMImplementation(name = os.environ["PYTHON_DOM"])
+
+ # User did not specify a name, try implementations in arbitrary
+ # order, returning the one that has the required features
+ if isinstance(features, StringTypes):
+ features = _parse_feature_string(features)
+ for creator in registered.values():
+ dom = creator()
+ if _good_enough(dom, features):
+ return dom
+
+ for creator in well_known_implementations.keys():
+ try:
+ dom = getDOMImplementation(name = creator)
+ except StandardError: # typically ImportError, or AttributeError
+ continue
+ if _good_enough(dom, features):
+ return dom
+
+ raise ImportError,"no suitable DOM implementation found"
+
+def _parse_feature_string(s):
+ features = []
+ parts = s.split()
+ i = 0
+ length = len(parts)
+ while i < length:
+ feature = parts[i]
+ if feature[0] in "0123456789":
+ raise ValueError, "bad feature name: %r" % (feature,)
+ i = i + 1
+ version = None
+ if i < length:
+ v = parts[i]
+ if v[0] in "0123456789":
+ i = i + 1
+ version = v
+ features.append((feature, version))
+ return tuple(features)
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
index 0000000000..95c23a0a17
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/expatbuilder.py
@@ -0,0 +1,983 @@
+"""Facility to use the Expat parser to load a minidom instance
+from a string or file.
+
+This avoids all the overhead of SAX and pulldom to gain performance.
+"""
+
+# Warning!
+#
+# This module is tightly bound to the implementation details of the
+# minidom DOM and can't be used with other DOM implementations. This
+# is due, in part, to a lack of appropriate methods in the DOM (there is
+# no way to create Entity and Notation nodes via the DOM Level 2
+# interface), and for performance. The later is the cause of some fairly
+# cryptic code.
+#
+# Performance hacks:
+#
+# - .character_data_handler() has an extra case in which continuing
+# data is appended to an existing Text node; this can be a
+# speedup since pyexpat can break up character data into multiple
+# callbacks even though we set the buffer_text attribute on the
+# parser. This also gives us the advantage that we don't need a
+# separate normalization pass.
+#
+# - Determining that a node exists is done using an identity comparison
+# with None rather than a truth test; this avoids searching for and
+# calling any methods on the node object if it exists. (A rather
+# nice speedup is achieved this way as well!)
+
+from xml.dom import xmlbuilder, minidom, Node
+from xml.dom import EMPTY_NAMESPACE, EMPTY_PREFIX, XMLNS_NAMESPACE
+from xml.parsers import expat
+from xml.dom.minidom import _append_child, _set_attribute_node
+from xml.dom.NodeFilter import NodeFilter
+
+from xml.dom.minicompat import *
+
+TEXT_NODE = Node.TEXT_NODE
+CDATA_SECTION_NODE = Node.CDATA_SECTION_NODE
+DOCUMENT_NODE = Node.DOCUMENT_NODE
+
+FILTER_ACCEPT = xmlbuilder.DOMBuilderFilter.FILTER_ACCEPT
+FILTER_REJECT = xmlbuilder.DOMBuilderFilter.FILTER_REJECT
+FILTER_SKIP = xmlbuilder.DOMBuilderFilter.FILTER_SKIP
+FILTER_INTERRUPT = xmlbuilder.DOMBuilderFilter.FILTER_INTERRUPT
+
+theDOMImplementation = minidom.getDOMImplementation()
+
+# Expat typename -> TypeInfo
+_typeinfo_map = {
+ "CDATA": minidom.TypeInfo(None, "cdata"),
+ "ENUM": minidom.TypeInfo(None, "enumeration"),
+ "ENTITY": minidom.TypeInfo(None, "entity"),
+ "ENTITIES": minidom.TypeInfo(None, "entities"),
+ "ID": minidom.TypeInfo(None, "id"),
+ "IDREF": minidom.TypeInfo(None, "idref"),
+ "IDREFS": minidom.TypeInfo(None, "idrefs"),
+ "NMTOKEN": minidom.TypeInfo(None, "nmtoken"),
+ "NMTOKENS": minidom.TypeInfo(None, "nmtokens"),
+ }
+
+class ElementInfo(object):
+ __slots__ = '_attr_info', '_model', 'tagName'
+
+ def __init__(self, tagName, model=None):
+ self.tagName = tagName
+ self._attr_info = []
+ self._model = model
+
+ def __getstate__(self):
+ return self._attr_info, self._model, self.tagName
+
+ def __setstate__(self, state):
+ self._attr_info, self._model, self.tagName = state
+
+ def getAttributeType(self, aname):
+ for info in self._attr_info:
+ if info[1] == aname:
+ t = info[-2]
+ if t[0] == "(":
+ return _typeinfo_map["ENUM"]
+ else:
+ return _typeinfo_map[info[-2]]
+ return minidom._no_type
+
+ def getAttributeTypeNS(self, namespaceURI, localName):
+ return minidom._no_type
+
+ def isElementContent(self):
+ if self._model:
+ type = self._model[0]
+ return type not in (expat.model.XML_CTYPE_ANY,
+ expat.model.XML_CTYPE_MIXED)
+ else:
+ return False
+
+ def isEmpty(self):
+ if self._model:
+ return self._model[0] == expat.model.XML_CTYPE_EMPTY
+ else:
+ return False
+
+ def isId(self, aname):
+ for info in self._attr_info:
+ if info[1] == aname:
+ return info[-2] == "ID"
+ return False
+
+ def isIdNS(self, euri, ename, auri, aname):
+ # not sure this is meaningful
+ return self.isId((auri, aname))
+
+def _intern(builder, s):
+ return builder._intern_setdefault(s, s)
+
+def _parse_ns_name(builder, name):
+ assert ' ' in name
+ parts = name.split(' ')
+ intern = builder._intern_setdefault
+ if len(parts) == 3:
+ uri, localname, prefix = parts
+ prefix = intern(prefix, prefix)
+ qname = "%s:%s" % (prefix, localname)
+ qname = intern(qname, qname)
+ localname = intern(localname, localname)
+ else:
+ uri, localname = parts
+ prefix = EMPTY_PREFIX
+ qname = localname = intern(localname, localname)
+ return intern(uri, uri), localname, prefix, qname
+
+
+class ExpatBuilder:
+ """Document builder that uses Expat to build a ParsedXML.DOM document
+ instance."""
+
+ def __init__(self, options=None):
+ if options is None:
+ options = xmlbuilder.Options()
+ self._options = options
+ if self._options.filter is not None:
+ self._filter = FilterVisibilityController(self._options.filter)
+ else:
+ self._filter = None
+ # This *really* doesn't do anything in this case, so
+ # override it with something fast & minimal.
+ self._finish_start_element = id
+ self._parser = None
+ self.reset()
+
+ def createParser(self):
+ """Create a new parser object."""
+ return expat.ParserCreate()
+
+ def getParser(self):
+ """Return the parser object, creating a new one if needed."""
+ if not self._parser:
+ self._parser = self.createParser()
+ self._intern_setdefault = self._parser.intern.setdefault
+ self._parser.buffer_text = True
+ self._parser.ordered_attributes = True
+ self._parser.specified_attributes = True
+ self.install(self._parser)
+ return self._parser
+
+ def reset(self):
+ """Free all data structures used during DOM construction."""
+ self.document = theDOMImplementation.createDocument(
+ EMPTY_NAMESPACE, None, None)
+ self.curNode = self.document
+ self._elem_info = self.document._elem_info
+ self._cdata = False
+
+ def install(self, parser):
+ """Install the callbacks needed to build the DOM into the parser."""
+ # This creates circular references!
+ parser.StartDoctypeDeclHandler = self.start_doctype_decl_handler
+ parser.StartElementHandler = self.first_element_handler
+ parser.EndElementHandler = self.end_element_handler
+ parser.ProcessingInstructionHandler = self.pi_handler
+ if self._options.entities:
+ parser.EntityDeclHandler = self.entity_decl_handler
+ parser.NotationDeclHandler = self.notation_decl_handler
+ if self._options.comments:
+ parser.CommentHandler = self.comment_handler
+ if self._options.cdata_sections:
+ parser.StartCdataSectionHandler = self.start_cdata_section_handler
+ parser.EndCdataSectionHandler = self.end_cdata_section_handler
+ parser.CharacterDataHandler = self.character_data_handler_cdata
+ else:
+ parser.CharacterDataHandler = self.character_data_handler
+ parser.ExternalEntityRefHandler = self.external_entity_ref_handler
+ parser.XmlDeclHandler = self.xml_decl_handler
+ parser.ElementDeclHandler = self.element_decl_handler
+ parser.AttlistDeclHandler = self.attlist_decl_handler
+
+ def parseFile(self, file):
+ """Parse a document from a file object, returning the document
+ node."""
+ parser = self.getParser()
+ first_buffer = True
+ try:
+ while 1:
+ buffer = file.read(16*1024)
+ if not buffer:
+ break
+ parser.Parse(buffer, 0)
+ if first_buffer and self.document.documentElement:
+ self._setup_subset(buffer)
+ first_buffer = False
+ parser.Parse("", True)
+ except ParseEscape:
+ pass
+ doc = self.document
+ self.reset()
+ self._parser = None
+ return doc
+
+ def parseString(self, string):
+ """Parse a document from a string, returning the document node."""
+ parser = self.getParser()
+ try:
+ parser.Parse(string, True)
+ self._setup_subset(string)
+ except ParseEscape:
+ pass
+ doc = self.document
+ self.reset()
+ self._parser = None
+ return doc
+
+ def _setup_subset(self, buffer):
+ """Load the internal subset if there might be one."""
+ if self.document.doctype:
+ extractor = InternalSubsetExtractor()
+ extractor.parseString(buffer)
+ subset = extractor.getSubset()
+ self.document.doctype.internalSubset = subset
+
+ def start_doctype_decl_handler(self, doctypeName, systemId, publicId,
+ has_internal_subset):
+ doctype = self.document.implementation.createDocumentType(
+ doctypeName, publicId, systemId)
+ doctype.ownerDocument = self.document
+ _append_child(self.document, doctype)
+ self.document.doctype = doctype
+ if self._filter and self._filter.acceptNode(doctype) == FILTER_REJECT:
+ self.document.doctype = None
+ del self.document.childNodes[-1]
+ doctype = None
+ self._parser.EntityDeclHandler = None
+ self._parser.NotationDeclHandler = None
+ if has_internal_subset:
+ if doctype is not None:
+ doctype.entities._seq = []
+ doctype.notations._seq = []
+ self._parser.CommentHandler = None
+ self._parser.ProcessingInstructionHandler = None
+ self._parser.EndDoctypeDeclHandler = self.end_doctype_decl_handler
+
+ def end_doctype_decl_handler(self):
+ if self._options.comments:
+ self._parser.CommentHandler = self.comment_handler
+ self._parser.ProcessingInstructionHandler = self.pi_handler
+ if not (self._elem_info or self._filter):
+ self._finish_end_element = id
+
+ def pi_handler(self, target, data):
+ node = self.document.createProcessingInstruction(target, data)
+ _append_child(self.curNode, node)
+ if self._filter and self._filter.acceptNode(node) == FILTER_REJECT:
+ self.curNode.removeChild(node)
+
+ def character_data_handler_cdata(self, data):
+ childNodes = self.curNode.childNodes
+ if self._cdata:
+ if ( self._cdata_continue
+ and childNodes[-1].nodeType == CDATA_SECTION_NODE):
+ childNodes[-1].appendData(data)
+ return
+ node = self.document.createCDATASection(data)
+ self._cdata_continue = True
+ elif childNodes and childNodes[-1].nodeType == TEXT_NODE:
+ node = childNodes[-1]
+ value = node.data + data
+ d = node.__dict__
+ d['data'] = d['nodeValue'] = value
+ return
+ else:
+ node = minidom.Text()
+ d = node.__dict__
+ d['data'] = d['nodeValue'] = data
+ d['ownerDocument'] = self.document
+ _append_child(self.curNode, node)
+
+ def character_data_handler(self, data):
+ childNodes = self.curNode.childNodes
+ if childNodes and childNodes[-1].nodeType == TEXT_NODE:
+ node = childNodes[-1]
+ d = node.__dict__
+ d['data'] = d['nodeValue'] = node.data + data
+ return
+ node = minidom.Text()
+ d = node.__dict__
+ d['data'] = d['nodeValue'] = node.data + data
+ d['ownerDocument'] = self.document
+ _append_child(self.curNode, node)
+
+ def entity_decl_handler(self, entityName, is_parameter_entity, value,
+ base, systemId, publicId, notationName):
+ if is_parameter_entity:
+ # we don't care about parameter entities for the DOM
+ return
+ if not self._options.entities:
+ return
+ node = self.document._create_entity(entityName, publicId,
+ systemId, notationName)
+ if value is not None:
+ # internal entity
+ # node *should* be readonly, but we'll cheat
+ child = self.document.createTextNode(value)
+ node.childNodes.append(child)
+ self.document.doctype.entities._seq.append(node)
+ if self._filter and self._filter.acceptNode(node) == FILTER_REJECT:
+ del self.document.doctype.entities._seq[-1]
+
+ def notation_decl_handler(self, notationName, base, systemId, publicId):
+ node = self.document._create_notation(notationName, publicId, systemId)
+ self.document.doctype.notations._seq.append(node)
+ if self._filter and self._filter.acceptNode(node) == FILTER_ACCEPT:
+ del self.document.doctype.notations._seq[-1]
+
+ def comment_handler(self, data):
+ node = self.document.createComment(data)
+ _append_child(self.curNode, node)
+ if self._filter and self._filter.acceptNode(node) == FILTER_REJECT:
+ self.curNode.removeChild(node)
+
+ def start_cdata_section_handler(self):
+ self._cdata = True
+ self._cdata_continue = False
+
+ def end_cdata_section_handler(self):
+ self._cdata = False
+ self._cdata_continue = False
+
+ def external_entity_ref_handler(self, context, base, systemId, publicId):
+ return 1
+
+ def first_element_handler(self, name, attributes):
+ if self._filter is None and not self._elem_info:
+ self._finish_end_element = id
+ self.getParser().StartElementHandler = self.start_element_handler
+ self.start_element_handler(name, attributes)
+
+ def start_element_handler(self, name, attributes):
+ node = self.document.createElement(name)
+ _append_child(self.curNode, node)
+ self.curNode = node
+
+ if attributes:
+ for i in range(0, len(attributes), 2):
+ a = minidom.Attr(attributes[i], EMPTY_NAMESPACE,
+ None, EMPTY_PREFIX)
+ value = attributes[i+1]
+ d = a.childNodes[0].__dict__
+ d['data'] = d['nodeValue'] = value
+ d = a.__dict__
+ d['value'] = d['nodeValue'] = value
+ d['ownerDocument'] = self.document
+ _set_attribute_node(node, a)
+
+ if node is not self.document.documentElement:
+ self._finish_start_element(node)
+
+ def _finish_start_element(self, node):
+ if self._filter:
+ # To be general, we'd have to call isSameNode(), but this
+ # is sufficient for minidom:
+ if node is self.document.documentElement:
+ return
+ filt = self._filter.startContainer(node)
+ if filt == FILTER_REJECT:
+ # ignore this node & all descendents
+ Rejecter(self)
+ elif filt == FILTER_SKIP:
+ # ignore this node, but make it's children become
+ # children of the parent node
+ Skipper(self)
+ else:
+ return
+ self.curNode = node.parentNode
+ node.parentNode.removeChild(node)
+ node.unlink()
+
+ # If this ever changes, Namespaces.end_element_handler() needs to
+ # be changed to match.
+ #
+ def end_element_handler(self, name):
+ curNode = self.curNode
+ self.curNode = curNode.parentNode
+ self._finish_end_element(curNode)
+
+ def _finish_end_element(self, curNode):
+ info = self._elem_info.get(curNode.tagName)
+ if info:
+ self._handle_white_text_nodes(curNode, info)
+ if self._filter:
+ if curNode is self.document.documentElement:
+ return
+ if self._filter.acceptNode(curNode) == FILTER_REJECT:
+ self.curNode.removeChild(curNode)
+ curNode.unlink()
+
+ def _handle_white_text_nodes(self, node, info):
+ if (self._options.whitespace_in_element_content
+ or not info.isElementContent()):
+ return
+
+ # We have element type information and should remove ignorable
+ # whitespace; identify for text nodes which contain only
+ # whitespace.
+ L = []
+ for child in node.childNodes:
+ if child.nodeType == TEXT_NODE and not child.data.strip():
+ L.append(child)
+
+ # Remove ignorable whitespace from the tree.
+ for child in L:
+ node.removeChild(child)
+
+ def element_decl_handler(self, name, model):
+ info = self._elem_info.get(name)
+ if info is None:
+ self._elem_info[name] = ElementInfo(name, model)
+ else:
+ assert info._model is None
+ info._model = model
+
+ def attlist_decl_handler(self, elem, name, type, default, required):
+ info = self._elem_info.get(elem)
+ if info is None:
+ info = ElementInfo(elem)
+ self._elem_info[elem] = info
+ info._attr_info.append(
+ [None, name, None, None, default, 0, type, required])
+
+ def xml_decl_handler(self, version, encoding, standalone):
+ self.document.version = version
+ self.document.encoding = encoding
+ # This is still a little ugly, thanks to the pyexpat API. ;-(
+ if standalone >= 0:
+ if standalone:
+ self.document.standalone = True
+ else:
+ self.document.standalone = False
+
+
+# Don't include FILTER_INTERRUPT, since that's checked separately
+# where allowed.
+_ALLOWED_FILTER_RETURNS = (FILTER_ACCEPT, FILTER_REJECT, FILTER_SKIP)
+
+class FilterVisibilityController(object):
+ """Wrapper around a DOMBuilderFilter which implements the checks
+ to make the whatToShow filter attribute work."""
+
+ __slots__ = 'filter',
+
+ def __init__(self, filter):
+ self.filter = filter
+
+ def startContainer(self, node):
+ mask = self._nodetype_mask[node.nodeType]
+ if self.filter.whatToShow & mask:
+ val = self.filter.startContainer(node)
+ if val == FILTER_INTERRUPT:
+ raise ParseEscape
+ if val not in _ALLOWED_FILTER_RETURNS:
+ raise ValueError, \
+ "startContainer() returned illegal value: " + repr(val)
+ return val
+ else:
+ return FILTER_ACCEPT
+
+ def acceptNode(self, node):
+ mask = self._nodetype_mask[node.nodeType]
+ if self.filter.whatToShow & mask:
+ val = self.filter.acceptNode(node)
+ if val == FILTER_INTERRUPT:
+ raise ParseEscape
+ if val == FILTER_SKIP:
+ # move all child nodes to the parent, and remove this node
+ parent = node.parentNode
+ for child in node.childNodes[:]:
+ parent.appendChild(child)
+ # node is handled by the caller
+ return FILTER_REJECT
+ if val not in _ALLOWED_FILTER_RETURNS:
+ raise ValueError, \
+ "acceptNode() returned illegal value: " + repr(val)
+ return val
+ else:
+ return FILTER_ACCEPT
+
+ _nodetype_mask = {
+ Node.ELEMENT_NODE: NodeFilter.SHOW_ELEMENT,
+ Node.ATTRIBUTE_NODE: NodeFilter.SHOW_ATTRIBUTE,
+ Node.TEXT_NODE: NodeFilter.SHOW_TEXT,
+ Node.CDATA_SECTION_NODE: NodeFilter.SHOW_CDATA_SECTION,
+ Node.ENTITY_REFERENCE_NODE: NodeFilter.SHOW_ENTITY_REFERENCE,
+ Node.ENTITY_NODE: NodeFilter.SHOW_ENTITY,
+ Node.PROCESSING_INSTRUCTION_NODE: NodeFilter.SHOW_PROCESSING_INSTRUCTION,
+ Node.COMMENT_NODE: NodeFilter.SHOW_COMMENT,
+ Node.DOCUMENT_NODE: NodeFilter.SHOW_DOCUMENT,
+ Node.DOCUMENT_TYPE_NODE: NodeFilter.SHOW_DOCUMENT_TYPE,
+ Node.DOCUMENT_FRAGMENT_NODE: NodeFilter.SHOW_DOCUMENT_FRAGMENT,
+ Node.NOTATION_NODE: NodeFilter.SHOW_NOTATION,
+ }
+
+
+class FilterCrutch(object):
+ __slots__ = '_builder', '_level', '_old_start', '_old_end'
+
+ def __init__(self, builder):
+ self._level = 0
+ self._builder = builder
+ parser = builder._parser
+ self._old_start = parser.StartElementHandler
+ self._old_end = parser.EndElementHandler
+ parser.StartElementHandler = self.start_element_handler
+ parser.EndElementHandler = self.end_element_handler
+
+class Rejecter(FilterCrutch):
+ __slots__ = ()
+
+ def __init__(self, builder):
+ FilterCrutch.__init__(self, builder)
+ parser = builder._parser
+ for name in ("ProcessingInstructionHandler",
+ "CommentHandler",
+ "CharacterDataHandler",
+ "StartCdataSectionHandler",
+ "EndCdataSectionHandler",
+ "ExternalEntityRefHandler",
+ ):
+ setattr(parser, name, None)
+
+ def start_element_handler(self, *args):
+ self._level = self._level + 1
+
+ def end_element_handler(self, *args):
+ if self._level == 0:
+ # restore the old handlers
+ parser = self._builder._parser
+ self._builder.install(parser)
+ parser.StartElementHandler = self._old_start
+ parser.EndElementHandler = self._old_end
+ else:
+ self._level = self._level - 1
+
+class Skipper(FilterCrutch):
+ __slots__ = ()
+
+ def start_element_handler(self, *args):
+ node = self._builder.curNode
+ self._old_start(*args)
+ if self._builder.curNode is not node:
+ self._level = self._level + 1
+
+ def end_element_handler(self, *args):
+ if self._level == 0:
+ # We're popping back out of the node we're skipping, so we
+ # shouldn't need to do anything but reset the handlers.
+ self._builder._parser.StartElementHandler = self._old_start
+ self._builder._parser.EndElementHandler = self._old_end
+ self._builder = None
+ else:
+ self._level = self._level - 1
+ self._old_end(*args)
+
+
+# framework document used by the fragment builder.
+# Takes a string for the doctype, subset string, and namespace attrs string.
+
+_FRAGMENT_BUILDER_INTERNAL_SYSTEM_ID = \
+ "http://xml.python.org/entities/fragment-builder/internal"
+
+_FRAGMENT_BUILDER_TEMPLATE = (
+ '''\
+<!DOCTYPE wrapper
+ %%s [
+ <!ENTITY fragment-builder-internal
+ SYSTEM "%s">
+%%s
+]>
+<wrapper %%s
+>&fragment-builder-internal;</wrapper>'''
+ % _FRAGMENT_BUILDER_INTERNAL_SYSTEM_ID)
+
+
+class FragmentBuilder(ExpatBuilder):
+ """Builder which constructs document fragments given XML source
+ text and a context node.
+
+ The context node is expected to provide information about the
+ namespace declarations which are in scope at the start of the
+ fragment.
+ """
+
+ def __init__(self, context, options=None):
+ if context.nodeType == DOCUMENT_NODE:
+ self.originalDocument = context
+ self.context = context
+ else:
+ self.originalDocument = context.ownerDocument
+ self.context = context
+ ExpatBuilder.__init__(self, options)
+
+ def reset(self):
+ ExpatBuilder.reset(self)
+ self.fragment = None
+
+ def parseFile(self, file):
+ """Parse a document fragment from a file object, returning the
+ fragment node."""
+ return self.parseString(file.read())
+
+ def parseString(self, string):
+ """Parse a document fragment from a string, returning the
+ fragment node."""
+ self._source = string
+ parser = self.getParser()
+ doctype = self.originalDocument.doctype
+ ident = ""
+ if doctype:
+ subset = doctype.internalSubset or self._getDeclarations()
+ if doctype.publicId:
+ ident = ('PUBLIC "%s" "%s"'
+ % (doctype.publicId, doctype.systemId))
+ elif doctype.systemId:
+ ident = 'SYSTEM "%s"' % doctype.systemId
+ else:
+ subset = ""
+ nsattrs = self._getNSattrs() # get ns decls from node's ancestors
+ document = _FRAGMENT_BUILDER_TEMPLATE % (ident, subset, nsattrs)
+ try:
+ parser.Parse(document, 1)
+ except:
+ self.reset()
+ raise
+ fragment = self.fragment
+ self.reset()
+## self._parser = None
+ return fragment
+
+ def _getDeclarations(self):
+ """Re-create the internal subset from the DocumentType node.
+
+ This is only needed if we don't already have the
+ internalSubset as a string.
+ """
+ doctype = self.context.ownerDocument.doctype
+ s = ""
+ if doctype:
+ for i in range(doctype.notations.length):
+ notation = doctype.notations.item(i)
+ if s:
+ s = s + "\n "
+ s = "%s<!NOTATION %s" % (s, notation.nodeName)
+ if notation.publicId:
+ s = '%s PUBLIC "%s"\n "%s">' \
+ % (s, notation.publicId, notation.systemId)
+ else:
+ s = '%s SYSTEM "%s">' % (s, notation.systemId)
+ for i in range(doctype.entities.length):
+ entity = doctype.entities.item(i)
+ if s:
+ s = s + "\n "
+ s = "%s<!ENTITY %s" % (s, entity.nodeName)
+ if entity.publicId:
+ s = '%s PUBLIC "%s"\n "%s"' \
+ % (s, entity.publicId, entity.systemId)
+ elif entity.systemId:
+ s = '%s SYSTEM "%s"' % (s, entity.systemId)
+ else:
+ s = '%s "%s"' % (s, entity.firstChild.data)
+ if entity.notationName:
+ s = "%s NOTATION %s" % (s, entity.notationName)
+ s = s + ">"
+ return s
+
+ def _getNSattrs(self):
+ return ""
+
+ def external_entity_ref_handler(self, context, base, systemId, publicId):
+ if systemId == _FRAGMENT_BUILDER_INTERNAL_SYSTEM_ID:
+ # this entref is the one that we made to put the subtree
+ # in; all of our given input is parsed in here.
+ old_document = self.document
+ old_cur_node = self.curNode
+ parser = self._parser.ExternalEntityParserCreate(context)
+ # put the real document back, parse into the fragment to return
+ self.document = self.originalDocument
+ self.fragment = self.document.createDocumentFragment()
+ self.curNode = self.fragment
+ try:
+ parser.Parse(self._source, 1)
+ finally:
+ self.curNode = old_cur_node
+ self.document = old_document
+ self._source = None
+ return -1
+ else:
+ return ExpatBuilder.external_entity_ref_handler(
+ self, context, base, systemId, publicId)
+
+
+class Namespaces:
+ """Mix-in class for builders; adds support for namespaces."""
+
+ def _initNamespaces(self):
+ # list of (prefix, uri) ns declarations. Namespace attrs are
+ # constructed from this and added to the element's attrs.
+ self._ns_ordered_prefixes = []
+
+ def createParser(self):
+ """Create a new namespace-handling parser."""
+ parser = expat.ParserCreate(namespace_separator=" ")
+ parser.namespace_prefixes = True
+ return parser
+
+ def install(self, parser):
+ """Insert the namespace-handlers onto the parser."""
+ ExpatBuilder.install(self, parser)
+ if self._options.namespace_declarations:
+ parser.StartNamespaceDeclHandler = (
+ self.start_namespace_decl_handler)
+
+ def start_namespace_decl_handler(self, prefix, uri):
+ """Push this namespace declaration on our storage."""
+ self._ns_ordered_prefixes.append((prefix, uri))
+
+ def start_element_handler(self, name, attributes):
+ if ' ' in name:
+ uri, localname, prefix, qname = _parse_ns_name(self, name)
+ else:
+ uri = EMPTY_NAMESPACE
+ qname = name
+ localname = None
+ prefix = EMPTY_PREFIX
+ node = minidom.Element(qname, uri, prefix, localname)
+ node.ownerDocument = self.document
+ _append_child(self.curNode, node)
+ self.curNode = node
+
+ if self._ns_ordered_prefixes:
+ for prefix, uri in self._ns_ordered_prefixes:
+ if prefix:
+ a = minidom.Attr(_intern(self, 'xmlns:' + prefix),
+ XMLNS_NAMESPACE, prefix, "xmlns")
+ else:
+ a = minidom.Attr("xmlns", XMLNS_NAMESPACE,
+ "xmlns", EMPTY_PREFIX)
+ d = a.childNodes[0].__dict__
+ d['data'] = d['nodeValue'] = uri
+ d = a.__dict__
+ d['value'] = d['nodeValue'] = uri
+ d['ownerDocument'] = self.document
+ _set_attribute_node(node, a)
+ del self._ns_ordered_prefixes[:]
+
+ if attributes:
+ _attrs = node._attrs
+ _attrsNS = node._attrsNS
+ for i in range(0, len(attributes), 2):
+ aname = attributes[i]
+ value = attributes[i+1]
+ if ' ' in aname:
+ uri, localname, prefix, qname = _parse_ns_name(self, aname)
+ a = minidom.Attr(qname, uri, localname, prefix)
+ _attrs[qname] = a
+ _attrsNS[(uri, localname)] = a
+ else:
+ a = minidom.Attr(aname, EMPTY_NAMESPACE,
+ aname, EMPTY_PREFIX)
+ _attrs[aname] = a
+ _attrsNS[(EMPTY_NAMESPACE, aname)] = a
+ d = a.childNodes[0].__dict__
+ d['data'] = d['nodeValue'] = value
+ d = a.__dict__
+ d['ownerDocument'] = self.document
+ d['value'] = d['nodeValue'] = value
+ d['ownerElement'] = node
+
+ if __debug__:
+ # This only adds some asserts to the original
+ # end_element_handler(), so we only define this when -O is not
+ # used. If changing one, be sure to check the other to see if
+ # it needs to be changed as well.
+ #
+ def end_element_handler(self, name):
+ curNode = self.curNode
+ if ' ' in name:
+ uri, localname, prefix, qname = _parse_ns_name(self, name)
+ assert (curNode.namespaceURI == uri
+ and curNode.localName == localname
+ and curNode.prefix == prefix), \
+ "element stack messed up! (namespace)"
+ else:
+ assert curNode.nodeName == name, \
+ "element stack messed up - bad nodeName"
+ assert curNode.namespaceURI == EMPTY_NAMESPACE, \
+ "element stack messed up - bad namespaceURI"
+ self.curNode = curNode.parentNode
+ self._finish_end_element(curNode)
+
+
+class ExpatBuilderNS(Namespaces, ExpatBuilder):
+ """Document builder that supports namespaces."""
+
+ def reset(self):
+ ExpatBuilder.reset(self)
+ self._initNamespaces()
+
+
+class FragmentBuilderNS(Namespaces, FragmentBuilder):
+ """Fragment builder that supports namespaces."""
+
+ def reset(self):
+ FragmentBuilder.reset(self)
+ self._initNamespaces()
+
+ def _getNSattrs(self):
+ """Return string of namespace attributes from this element and
+ ancestors."""
+ # XXX This needs to be re-written to walk the ancestors of the
+ # context to build up the namespace information from
+ # declarations, elements, and attributes found in context.
+ # Otherwise we have to store a bunch more data on the DOM
+ # (though that *might* be more reliable -- not clear).
+ attrs = ""
+ context = self.context
+ L = []
+ while context:
+ if hasattr(context, '_ns_prefix_uri'):
+ for prefix, uri in context._ns_prefix_uri.items():
+ # add every new NS decl from context to L and attrs string
+ if prefix in L:
+ continue
+ L.append(prefix)
+ if prefix:
+ declname = "xmlns:" + prefix
+ else:
+ declname = "xmlns"
+ if attrs:
+ attrs = "%s\n %s='%s'" % (attrs, declname, uri)
+ else:
+ attrs = " %s='%s'" % (declname, uri)
+ context = context.parentNode
+ return attrs
+
+
+class ParseEscape(Exception):
+ """Exception raised to short-circuit parsing in InternalSubsetExtractor."""
+ pass
+
+class InternalSubsetExtractor(ExpatBuilder):
+ """XML processor which can rip out the internal document type subset."""
+
+ subset = None
+
+ def getSubset(self):
+ """Return the internal subset as a string."""
+ return self.subset
+
+ def parseFile(self, file):
+ try:
+ ExpatBuilder.parseFile(self, file)
+ except ParseEscape:
+ pass
+
+ def parseString(self, string):
+ try:
+ ExpatBuilder.parseString(self, string)
+ except ParseEscape:
+ pass
+
+ def install(self, parser):
+ parser.StartDoctypeDeclHandler = self.start_doctype_decl_handler
+ parser.StartElementHandler = self.start_element_handler
+
+ def start_doctype_decl_handler(self, name, publicId, systemId,
+ has_internal_subset):
+ if has_internal_subset:
+ parser = self.getParser()
+ self.subset = []
+ parser.DefaultHandler = self.subset.append
+ parser.EndDoctypeDeclHandler = self.end_doctype_decl_handler
+ else:
+ raise ParseEscape()
+
+ def end_doctype_decl_handler(self):
+ s = ''.join(self.subset).replace('\r\n', '\n').replace('\r', '\n')
+ self.subset = s
+ raise ParseEscape()
+
+ def start_element_handler(self, name, attrs):
+ raise ParseEscape()
+
+
+def parse(file, namespaces=True):
+ """Parse a document, returning the resulting Document node.
+
+ 'file' may be either a file name or an open file object.
+ """
+ if namespaces:
+ builder = ExpatBuilderNS()
+ else:
+ builder = ExpatBuilder()
+
+ if isinstance(file, StringTypes):
+ fp = open(file, 'rb')
+ try:
+ result = builder.parseFile(fp)
+ finally:
+ fp.close()
+ else:
+ result = builder.parseFile(file)
+ return result
+
+
+def parseString(string, namespaces=True):
+ """Parse a document from a string, returning the resulting
+ Document node.
+ """
+ if namespaces:
+ builder = ExpatBuilderNS()
+ else:
+ builder = ExpatBuilder()
+ return builder.parseString(string)
+
+
+def parseFragment(file, context, namespaces=True):
+ """Parse a fragment of a document, given the context from which it
+ was originally extracted. context should be the parent of the
+ node(s) which are in the fragment.
+
+ 'file' may be either a file name or an open file object.
+ """
+ if namespaces:
+ builder = FragmentBuilderNS(context)
+ else:
+ builder = FragmentBuilder(context)
+
+ if isinstance(file, StringTypes):
+ fp = open(file, 'rb')
+ try:
+ result = builder.parseFile(fp)
+ finally:
+ fp.close()
+ else:
+ result = builder.parseFile(file)
+ return result
+
+
+def parseFragmentString(string, context, namespaces=True):
+ """Parse a fragment of a document from a string, given the context
+ from which it was originally extracted. context should be the
+ parent of the node(s) which are in the fragment.
+ """
+ if namespaces:
+ builder = FragmentBuilderNS(context)
+ else:
+ builder = FragmentBuilder(context)
+ return builder.parseString(string)
+
+
+def makeBuilder(options):
+ """Create a builder based on an Options object."""
+ if options.namespaces:
+ return ExpatBuilderNS(options)
+ else:
+ return ExpatBuilder(options)
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
index 0000000000..a5fcee0aac
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/minicompat.py
@@ -0,0 +1,110 @@
+"""Python version compatibility support for minidom."""
+
+# This module should only be imported using "import *".
+#
+# The following names are defined:
+#
+# NodeList -- lightest possible NodeList implementation
+#
+# EmptyNodeList -- lightest possible NodeList that is guaranteed to
+# remain empty (immutable)
+#
+# StringTypes -- tuple of defined string types
+#
+# defproperty -- function used in conjunction with GetattrMagic;
+# using these together is needed to make them work
+# as efficiently as possible in both Python 2.2+
+# and older versions. For example:
+#
+# class MyClass(GetattrMagic):
+# def _get_myattr(self):
+# return something
+#
+# defproperty(MyClass, "myattr",
+# "return some value")
+#
+# For Python 2.2 and newer, this will construct a
+# property object on the class, which avoids
+# needing to override __getattr__(). It will only
+# work for read-only attributes.
+#
+# For older versions of Python, inheriting from
+# GetattrMagic will use the traditional
+# __getattr__() hackery to achieve the same effect,
+# but less efficiently.
+#
+# defproperty() should be used for each version of
+# the relevant _get_<property>() function.
+
+__all__ = ["NodeList", "EmptyNodeList", "StringTypes", "defproperty"]
+
+import xml.dom
+
+try:
+ unicode
+except NameError:
+ StringTypes = type(''),
+else:
+ StringTypes = type(''), type(unicode(''))
+
+
+class NodeList(list):
+ __slots__ = ()
+
+ def item(self, index):
+ if 0 <= index < len(self):
+ return self[index]
+
+ def _get_length(self):
+ return len(self)
+
+ def _set_length(self, value):
+ raise xml.dom.NoModificationAllowedErr(
+ "attempt to modify read-only attribute 'length'")
+
+ length = property(_get_length, _set_length,
+ doc="The number of nodes in the NodeList.")
+
+ def __getstate__(self):
+ return list(self)
+
+ def __setstate__(self, state):
+ self[:] = state
+
+
+class EmptyNodeList(tuple):
+ __slots__ = ()
+
+ def __add__(self, other):
+ NL = NodeList()
+ NL.extend(other)
+ return NL
+
+ def __radd__(self, other):
+ NL = NodeList()
+ NL.extend(other)
+ return NL
+
+ def item(self, index):
+ return None
+
+ def _get_length(self):
+ return 0
+
+ def _set_length(self, value):
+ raise xml.dom.NoModificationAllowedErr(
+ "attempt to modify read-only attribute 'length'")
+
+ length = property(_get_length, _set_length,
+ doc="The number of nodes in the NodeList.")
+
+
+def defproperty(klass, name, doc):
+ get = getattr(klass, ("_get_" + name)).im_func
+ def set(self, value, name=name):
+ raise xml.dom.NoModificationAllowedErr(
+ "attempt to modify read-only attribute " + repr(name))
+ assert not hasattr(klass, "_set_" + name), \
+ "expected not to find _set_" + name
+ prop = property(get, set, doc=doc)
+ setattr(klass, name, prop)
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
index 0000000000..54b41c45c9
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/minidom.py
@@ -0,0 +1,1941 @@
+"""Simple implementation of the Level 1 DOM.
+
+Namespaces and other minor Level 2 features are also supported.
+
+parse("foo.xml")
+
+parseString("<foo><bar/></foo>")
+
+Todo:
+=====
+ * convenience methods for getting elements and text.
+ * more testing
+ * bring some of the writer and linearizer code into conformance with this
+ interface
+ * SAX 2 namespaces
+"""
+
+import xml.dom
+
+from xml.dom import EMPTY_NAMESPACE, EMPTY_PREFIX, XMLNS_NAMESPACE, domreg
+from xml.dom.minicompat import *
+from xml.dom.xmlbuilder import DOMImplementationLS, DocumentLS
+
+# This is used by the ID-cache invalidation checks; the list isn't
+# actually complete, since the nodes being checked will never be the
+# DOCUMENT_NODE or DOCUMENT_FRAGMENT_NODE. (The node being checked is
+# the node being added or removed, not the node being modified.)
+#
+_nodeTypes_with_children = (xml.dom.Node.ELEMENT_NODE,
+ xml.dom.Node.ENTITY_REFERENCE_NODE)
+
+
+class Node(xml.dom.Node):
+ namespaceURI = None # this is non-null only for elements and attributes
+ parentNode = None
+ ownerDocument = None
+ nextSibling = None
+ previousSibling = None
+
+ prefix = EMPTY_PREFIX # non-null only for NS elements and attributes
+
+ def __nonzero__(self):
+ return True
+
+ def toxml(self, encoding = None):
+ return self.toprettyxml("", "", encoding)
+
+ def toprettyxml(self, indent="\t", newl="\n", encoding = None):
+ # indent = the indentation string to prepend, per level
+ # newl = the newline string to append
+ writer = _get_StringIO()
+ if encoding is not None:
+ import codecs
+ # Can't use codecs.getwriter to preserve 2.0 compatibility
+ writer = codecs.lookup(encoding)[3](writer)
+ if self.nodeType == Node.DOCUMENT_NODE:
+ # Can pass encoding only to document, to put it into XML header
+ self.writexml(writer, "", indent, newl, encoding)
+ else:
+ self.writexml(writer, "", indent, newl)
+ return writer.getvalue()
+
+ def hasChildNodes(self):
+ if self.childNodes:
+ return True
+ else:
+ return False
+
+ def _get_childNodes(self):
+ return self.childNodes
+
+ def _get_firstChild(self):
+ if self.childNodes:
+ return self.childNodes[0]
+
+ def _get_lastChild(self):
+ if self.childNodes:
+ return self.childNodes[-1]
+
+ def insertBefore(self, newChild, refChild):
+ if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE:
+ for c in tuple(newChild.childNodes):
+ self.insertBefore(c, refChild)
+ ### The DOM does not clearly specify what to return in this case
+ return newChild
+ if newChild.nodeType not in self._child_node_types:
+ raise xml.dom.HierarchyRequestErr(
+ "%s cannot be child of %s" % (repr(newChild), repr(self)))
+ if newChild.parentNode is not None:
+ newChild.parentNode.removeChild(newChild)
+ if refChild is None:
+ self.appendChild(newChild)
+ else:
+ try:
+ index = self.childNodes.index(refChild)
+ except ValueError:
+ raise xml.dom.NotFoundErr()
+ if newChild.nodeType in _nodeTypes_with_children:
+ _clear_id_cache(self)
+ self.childNodes.insert(index, newChild)
+ newChild.nextSibling = refChild
+ refChild.previousSibling = newChild
+ if index:
+ node = self.childNodes[index-1]
+ node.nextSibling = newChild
+ newChild.previousSibling = node
+ else:
+ newChild.previousSibling = None
+ newChild.parentNode = self
+ return newChild
+
+ def appendChild(self, node):
+ if node.nodeType == self.DOCUMENT_FRAGMENT_NODE:
+ for c in tuple(node.childNodes):
+ self.appendChild(c)
+ ### The DOM does not clearly specify what to return in this case
+ return node
+ if node.nodeType not in self._child_node_types:
+ raise xml.dom.HierarchyRequestErr(
+ "%s cannot be child of %s" % (repr(node), repr(self)))
+ elif node.nodeType in _nodeTypes_with_children:
+ _clear_id_cache(self)
+ if node.parentNode is not None:
+ node.parentNode.removeChild(node)
+ _append_child(self, node)
+ node.nextSibling = None
+ return node
+
+ def replaceChild(self, newChild, oldChild):
+ if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE:
+ refChild = oldChild.nextSibling
+ self.removeChild(oldChild)
+ return self.insertBefore(newChild, refChild)
+ if newChild.nodeType not in self._child_node_types:
+ raise xml.dom.HierarchyRequestErr(
+ "%s cannot be child of %s" % (repr(newChild), repr(self)))
+ if newChild is oldChild:
+ return
+ if newChild.parentNode is not None:
+ newChild.parentNode.removeChild(newChild)
+ try:
+ index = self.childNodes.index(oldChild)
+ except ValueError:
+ raise xml.dom.NotFoundErr()
+ self.childNodes[index] = newChild
+ newChild.parentNode = self
+ oldChild.parentNode = None
+ if (newChild.nodeType in _nodeTypes_with_children
+ or oldChild.nodeType in _nodeTypes_with_children):
+ _clear_id_cache(self)
+ newChild.nextSibling = oldChild.nextSibling
+ newChild.previousSibling = oldChild.previousSibling
+ oldChild.nextSibling = None
+ oldChild.previousSibling = None
+ if newChild.previousSibling:
+ newChild.previousSibling.nextSibling = newChild
+ if newChild.nextSibling:
+ newChild.nextSibling.previousSibling = newChild
+ return oldChild
+
+ def removeChild(self, oldChild):
+ try:
+ self.childNodes.remove(oldChild)
+ except ValueError:
+ raise xml.dom.NotFoundErr()
+ if oldChild.nextSibling is not None:
+ oldChild.nextSibling.previousSibling = oldChild.previousSibling
+ if oldChild.previousSibling is not None:
+ oldChild.previousSibling.nextSibling = oldChild.nextSibling
+ oldChild.nextSibling = oldChild.previousSibling = None
+ if oldChild.nodeType in _nodeTypes_with_children:
+ _clear_id_cache(self)
+
+ oldChild.parentNode = None
+ return oldChild
+
+ def normalize(self):
+ L = []
+ for child in self.childNodes:
+ if child.nodeType == Node.TEXT_NODE:
+ if not child.data:
+ # empty text node; discard
+ if L:
+ L[-1].nextSibling = child.nextSibling
+ if child.nextSibling:
+ child.nextSibling.previousSibling = child.previousSibling
+ child.unlink()
+ elif L and L[-1].nodeType == child.nodeType:
+ # collapse text node
+ node = L[-1]
+ node.data = node.data + child.data
+ node.nextSibling = child.nextSibling
+ if child.nextSibling:
+ child.nextSibling.previousSibling = node
+ child.unlink()
+ else:
+ L.append(child)
+ else:
+ L.append(child)
+ if child.nodeType == Node.ELEMENT_NODE:
+ child.normalize()
+ self.childNodes[:] = L
+
+ def cloneNode(self, deep):
+ return _clone_node(self, deep, self.ownerDocument or self)
+
+ def isSupported(self, feature, version):
+ return self.ownerDocument.implementation.hasFeature(feature, version)
+
+ def _get_localName(self):
+ # Overridden in Element and Attr where localName can be Non-Null
+ return None
+
+ # Node interfaces from Level 3 (WD 9 April 2002)
+
+ def isSameNode(self, other):
+ return self is other
+
+ def getInterface(self, feature):
+ if self.isSupported(feature, None):
+ return self
+ else:
+ return None
+
+ # The "user data" functions use a dictionary that is only present
+ # if some user data has been set, so be careful not to assume it
+ # exists.
+
+ def getUserData(self, key):
+ try:
+ return self._user_data[key][0]
+ except (AttributeError, KeyError):
+ return None
+
+ def setUserData(self, key, data, handler):
+ old = None
+ try:
+ d = self._user_data
+ except AttributeError:
+ d = {}
+ self._user_data = d
+ if key in d:
+ old = d[key][0]
+ if data is None:
+ # ignore handlers passed for None
+ handler = None
+ if old is not None:
+ del d[key]
+ else:
+ d[key] = (data, handler)
+ return old
+
+ def _call_user_data_handler(self, operation, src, dst):
+ if hasattr(self, "_user_data"):
+ for key, (data, handler) in self._user_data.items():
+ if handler is not None:
+ handler.handle(operation, key, data, src, dst)
+
+ # minidom-specific API:
+
+ def unlink(self):
+ self.parentNode = self.ownerDocument = None
+ if self.childNodes:
+ for child in self.childNodes:
+ child.unlink()
+ self.childNodes = NodeList()
+ self.previousSibling = None
+ self.nextSibling = None
+
+defproperty(Node, "firstChild", doc="First child node, or None.")
+defproperty(Node, "lastChild", doc="Last child node, or None.")
+defproperty(Node, "localName", doc="Namespace-local name of this node.")
+
+
+def _append_child(self, node):
+ # fast path with less checks; usable by DOM builders if careful
+ childNodes = self.childNodes
+ if childNodes:
+ last = childNodes[-1]
+ node.__dict__["previousSibling"] = last
+ last.__dict__["nextSibling"] = node
+ childNodes.append(node)
+ node.__dict__["parentNode"] = self
+
+def _in_document(node):
+ # return True iff node is part of a document tree
+ while node is not None:
+ if node.nodeType == Node.DOCUMENT_NODE:
+ return True
+ node = node.parentNode
+ return False
+
+def _write_data(writer, data):
+ "Writes datachars to writer."
+ if data:
+ data = data.replace("&", "&amp;").replace("<", "&lt;"). \
+ replace("\"", "&quot;").replace(">", "&gt;")
+ writer.write(data)
+
+def _get_elements_by_tagName_helper(parent, name, rc):
+ for node in parent.childNodes:
+ if node.nodeType == Node.ELEMENT_NODE and \
+ (name == "*" or node.tagName == name):
+ rc.append(node)
+ _get_elements_by_tagName_helper(node, name, rc)
+ return rc
+
+def _get_elements_by_tagName_ns_helper(parent, nsURI, localName, rc):
+ for node in parent.childNodes:
+ if node.nodeType == Node.ELEMENT_NODE:
+ if ((localName == "*" or node.localName == localName) and
+ (nsURI == "*" or node.namespaceURI == nsURI)):
+ rc.append(node)
+ _get_elements_by_tagName_ns_helper(node, nsURI, localName, rc)
+ return rc
+
+class DocumentFragment(Node):
+ nodeType = Node.DOCUMENT_FRAGMENT_NODE
+ nodeName = "#document-fragment"
+ nodeValue = None
+ attributes = None
+ parentNode = None
+ _child_node_types = (Node.ELEMENT_NODE,
+ Node.TEXT_NODE,
+ Node.CDATA_SECTION_NODE,
+ Node.ENTITY_REFERENCE_NODE,
+ Node.PROCESSING_INSTRUCTION_NODE,
+ Node.COMMENT_NODE,
+ Node.NOTATION_NODE)
+
+ def __init__(self):
+ self.childNodes = NodeList()
+
+
+class Attr(Node):
+ nodeType = Node.ATTRIBUTE_NODE
+ attributes = None
+ ownerElement = None
+ specified = False
+ _is_id = False
+
+ _child_node_types = (Node.TEXT_NODE, Node.ENTITY_REFERENCE_NODE)
+
+ def __init__(self, qName, namespaceURI=EMPTY_NAMESPACE, localName=None,
+ prefix=None):
+ # skip setattr for performance
+ d = self.__dict__
+ d["nodeName"] = d["name"] = qName
+ d["namespaceURI"] = namespaceURI
+ d["prefix"] = prefix
+ d['childNodes'] = NodeList()
+
+ # Add the single child node that represents the value of the attr
+ self.childNodes.append(Text())
+
+ # nodeValue and value are set elsewhere
+
+ def _get_localName(self):
+ return self.nodeName.split(":", 1)[-1]
+
+ def _get_specified(self):
+ return self.specified
+
+ def __setattr__(self, name, value):
+ d = self.__dict__
+ if name in ("value", "nodeValue"):
+ d["value"] = d["nodeValue"] = value
+ d2 = self.childNodes[0].__dict__
+ d2["data"] = d2["nodeValue"] = value
+ if self.ownerElement is not None:
+ _clear_id_cache(self.ownerElement)
+ elif name in ("name", "nodeName"):
+ d["name"] = d["nodeName"] = value
+ if self.ownerElement is not None:
+ _clear_id_cache(self.ownerElement)
+ else:
+ d[name] = value
+
+ def _set_prefix(self, prefix):
+ nsuri = self.namespaceURI
+ if prefix == "xmlns":
+ if nsuri and nsuri != XMLNS_NAMESPACE:
+ raise xml.dom.NamespaceErr(
+ "illegal use of 'xmlns' prefix for the wrong namespace")
+ d = self.__dict__
+ d['prefix'] = prefix
+ if prefix is None:
+ newName = self.localName
+ else:
+ newName = "%s:%s" % (prefix, self.localName)
+ if self.ownerElement:
+ _clear_id_cache(self.ownerElement)
+ d['nodeName'] = d['name'] = newName
+
+ def _set_value(self, value):
+ d = self.__dict__
+ d['value'] = d['nodeValue'] = value
+ if self.ownerElement:
+ _clear_id_cache(self.ownerElement)
+ self.childNodes[0].data = value
+
+ def unlink(self):
+ # This implementation does not call the base implementation
+ # since most of that is not needed, and the expense of the
+ # method call is not warranted. We duplicate the removal of
+ # children, but that's all we needed from the base class.
+ elem = self.ownerElement
+ if elem is not None:
+ del elem._attrs[self.nodeName]
+ del elem._attrsNS[(self.namespaceURI, self.localName)]
+ if self._is_id:
+ self._is_id = False
+ elem._magic_id_nodes -= 1
+ self.ownerDocument._magic_id_count -= 1
+ for child in self.childNodes:
+ child.unlink()
+ del self.childNodes[:]
+
+ def _get_isId(self):
+ if self._is_id:
+ return True
+ doc = self.ownerDocument
+ elem = self.ownerElement
+ if doc is None or elem is None:
+ return False
+
+ info = doc._get_elem_info(elem)
+ if info is None:
+ return False
+ if self.namespaceURI:
+ return info.isIdNS(self.namespaceURI, self.localName)
+ else:
+ return info.isId(self.nodeName)
+
+ def _get_schemaType(self):
+ doc = self.ownerDocument
+ elem = self.ownerElement
+ if doc is None or elem is None:
+ return _no_type
+
+ info = doc._get_elem_info(elem)
+ if info is None:
+ return _no_type
+ if self.namespaceURI:
+ return info.getAttributeTypeNS(self.namespaceURI, self.localName)
+ else:
+ return info.getAttributeType(self.nodeName)
+
+defproperty(Attr, "isId", doc="True if this attribute is an ID.")
+defproperty(Attr, "localName", doc="Namespace-local name of this attribute.")
+defproperty(Attr, "schemaType", doc="Schema type for this attribute.")
+
+
+class NamedNodeMap(object):
+ """The attribute list is a transient interface to the underlying
+ dictionaries. Mutations here will change the underlying element's
+ dictionary.
+
+ Ordering is imposed artificially and does not reflect the order of
+ attributes as found in an input document.
+ """
+
+ __slots__ = ('_attrs', '_attrsNS', '_ownerElement')
+
+ def __init__(self, attrs, attrsNS, ownerElement):
+ self._attrs = attrs
+ self._attrsNS = attrsNS
+ self._ownerElement = ownerElement
+
+ def _get_length(self):
+ return len(self._attrs)
+
+ def item(self, index):
+ try:
+ return self[self._attrs.keys()[index]]
+ except IndexError:
+ return None
+
+ def items(self):
+ L = []
+ for node in self._attrs.values():
+ L.append((node.nodeName, node.value))
+ return L
+
+ def itemsNS(self):
+ L = []
+ for node in self._attrs.values():
+ L.append(((node.namespaceURI, node.localName), node.value))
+ return L
+
+ def has_key(self, key):
+ if isinstance(key, StringTypes):
+ return key in self._attrs
+ else:
+ return key in self._attrsNS
+
+ def keys(self):
+ return self._attrs.keys()
+
+ def keysNS(self):
+ return self._attrsNS.keys()
+
+ def values(self):
+ return self._attrs.values()
+
+ def get(self, name, value=None):
+ return self._attrs.get(name, value)
+
+ __len__ = _get_length
+
+ __hash__ = None # Mutable type can't be correctly hashed
+ def __cmp__(self, other):
+ if self._attrs is getattr(other, "_attrs", None):
+ return 0
+ else:
+ return cmp(id(self), id(other))
+
+ def __getitem__(self, attname_or_tuple):
+ if isinstance(attname_or_tuple, tuple):
+ return self._attrsNS[attname_or_tuple]
+ else:
+ return self._attrs[attname_or_tuple]
+
+ # same as set
+ def __setitem__(self, attname, value):
+ if isinstance(value, StringTypes):
+ try:
+ node = self._attrs[attname]
+ except KeyError:
+ node = Attr(attname)
+ node.ownerDocument = self._ownerElement.ownerDocument
+ self.setNamedItem(node)
+ node.value = value
+ else:
+ if not isinstance(value, Attr):
+ raise TypeError, "value must be a string or Attr object"
+ node = value
+ self.setNamedItem(node)
+
+ def getNamedItem(self, name):
+ try:
+ return self._attrs[name]
+ except KeyError:
+ return None
+
+ def getNamedItemNS(self, namespaceURI, localName):
+ try:
+ return self._attrsNS[(namespaceURI, localName)]
+ except KeyError:
+ return None
+
+ def removeNamedItem(self, name):
+ n = self.getNamedItem(name)
+ if n is not None:
+ _clear_id_cache(self._ownerElement)
+ del self._attrs[n.nodeName]
+ del self._attrsNS[(n.namespaceURI, n.localName)]
+ if 'ownerElement' in n.__dict__:
+ n.__dict__['ownerElement'] = None
+ return n
+ else:
+ raise xml.dom.NotFoundErr()
+
+ def removeNamedItemNS(self, namespaceURI, localName):
+ n = self.getNamedItemNS(namespaceURI, localName)
+ if n is not None:
+ _clear_id_cache(self._ownerElement)
+ del self._attrsNS[(n.namespaceURI, n.localName)]
+ del self._attrs[n.nodeName]
+ if 'ownerElement' in n.__dict__:
+ n.__dict__['ownerElement'] = None
+ return n
+ else:
+ raise xml.dom.NotFoundErr()
+
+ def setNamedItem(self, node):
+ if not isinstance(node, Attr):
+ raise xml.dom.HierarchyRequestErr(
+ "%s cannot be child of %s" % (repr(node), repr(self)))
+ old = self._attrs.get(node.name)
+ if old:
+ old.unlink()
+ self._attrs[node.name] = node
+ self._attrsNS[(node.namespaceURI, node.localName)] = node
+ node.ownerElement = self._ownerElement
+ _clear_id_cache(node.ownerElement)
+ return old
+
+ def setNamedItemNS(self, node):
+ return self.setNamedItem(node)
+
+ def __delitem__(self, attname_or_tuple):
+ node = self[attname_or_tuple]
+ _clear_id_cache(node.ownerElement)
+ node.unlink()
+
+ def __getstate__(self):
+ return self._attrs, self._attrsNS, self._ownerElement
+
+ def __setstate__(self, state):
+ self._attrs, self._attrsNS, self._ownerElement = state
+
+defproperty(NamedNodeMap, "length",
+ doc="Number of nodes in the NamedNodeMap.")
+
+AttributeList = NamedNodeMap
+
+
+class TypeInfo(object):
+ __slots__ = 'namespace', 'name'
+
+ def __init__(self, namespace, name):
+ self.namespace = namespace
+ self.name = name
+
+ def __repr__(self):
+ if self.namespace:
+ return "<TypeInfo %r (from %r)>" % (self.name, self.namespace)
+ else:
+ return "<TypeInfo %r>" % self.name
+
+ def _get_name(self):
+ return self.name
+
+ def _get_namespace(self):
+ return self.namespace
+
+_no_type = TypeInfo(None, None)
+
+class Element(Node):
+ nodeType = Node.ELEMENT_NODE
+ nodeValue = None
+ schemaType = _no_type
+
+ _magic_id_nodes = 0
+
+ _child_node_types = (Node.ELEMENT_NODE,
+ Node.PROCESSING_INSTRUCTION_NODE,
+ Node.COMMENT_NODE,
+ Node.TEXT_NODE,
+ Node.CDATA_SECTION_NODE,
+ Node.ENTITY_REFERENCE_NODE)
+
+ def __init__(self, tagName, namespaceURI=EMPTY_NAMESPACE, prefix=None,
+ localName=None):
+ self.tagName = self.nodeName = tagName
+ self.prefix = prefix
+ self.namespaceURI = namespaceURI
+ self.childNodes = NodeList()
+
+ self._attrs = {} # attributes are double-indexed:
+ self._attrsNS = {} # tagName -> Attribute
+ # URI,localName -> Attribute
+ # in the future: consider lazy generation
+ # of attribute objects this is too tricky
+ # for now because of headaches with
+ # namespaces.
+
+ def _get_localName(self):
+ return self.tagName.split(":", 1)[-1]
+
+ def _get_tagName(self):
+ return self.tagName
+
+ def unlink(self):
+ for attr in self._attrs.values():
+ attr.unlink()
+ self._attrs = None
+ self._attrsNS = None
+ Node.unlink(self)
+
+ def getAttribute(self, attname):
+ try:
+ return self._attrs[attname].value
+ except KeyError:
+ return ""
+
+ def getAttributeNS(self, namespaceURI, localName):
+ try:
+ return self._attrsNS[(namespaceURI, localName)].value
+ except KeyError:
+ return ""
+
+ def setAttribute(self, attname, value):
+ attr = self.getAttributeNode(attname)
+ if attr is None:
+ attr = Attr(attname)
+ # for performance
+ d = attr.__dict__
+ d["value"] = d["nodeValue"] = value
+ d["ownerDocument"] = self.ownerDocument
+ self.setAttributeNode(attr)
+ elif value != attr.value:
+ d = attr.__dict__
+ d["value"] = d["nodeValue"] = value
+ if attr.isId:
+ _clear_id_cache(self)
+
+ def setAttributeNS(self, namespaceURI, qualifiedName, value):
+ prefix, localname = _nssplit(qualifiedName)
+ attr = self.getAttributeNodeNS(namespaceURI, localname)
+ if attr is None:
+ # for performance
+ attr = Attr(qualifiedName, namespaceURI, localname, prefix)
+ d = attr.__dict__
+ d["prefix"] = prefix
+ d["nodeName"] = qualifiedName
+ d["value"] = d["nodeValue"] = value
+ d["ownerDocument"] = self.ownerDocument
+ self.setAttributeNode(attr)
+ else:
+ d = attr.__dict__
+ if value != attr.value:
+ d["value"] = d["nodeValue"] = value
+ if attr.isId:
+ _clear_id_cache(self)
+ if attr.prefix != prefix:
+ d["prefix"] = prefix
+ d["nodeName"] = qualifiedName
+
+ def getAttributeNode(self, attrname):
+ return self._attrs.get(attrname)
+
+ def getAttributeNodeNS(self, namespaceURI, localName):
+ return self._attrsNS.get((namespaceURI, localName))
+
+ def setAttributeNode(self, attr):
+ if attr.ownerElement not in (None, self):
+ raise xml.dom.InuseAttributeErr("attribute node already owned")
+ old1 = self._attrs.get(attr.name, None)
+ if old1 is not None:
+ self.removeAttributeNode(old1)
+ old2 = self._attrsNS.get((attr.namespaceURI, attr.localName), None)
+ if old2 is not None and old2 is not old1:
+ self.removeAttributeNode(old2)
+ _set_attribute_node(self, attr)
+
+ if old1 is not attr:
+ # It might have already been part of this node, in which case
+ # it doesn't represent a change, and should not be returned.
+ return old1
+ if old2 is not attr:
+ return old2
+
+ setAttributeNodeNS = setAttributeNode
+
+ def removeAttribute(self, name):
+ try:
+ attr = self._attrs[name]
+ except KeyError:
+ raise xml.dom.NotFoundErr()
+ self.removeAttributeNode(attr)
+
+ def removeAttributeNS(self, namespaceURI, localName):
+ try:
+ attr = self._attrsNS[(namespaceURI, localName)]
+ except KeyError:
+ raise xml.dom.NotFoundErr()
+ self.removeAttributeNode(attr)
+
+ def removeAttributeNode(self, node):
+ if node is None:
+ raise xml.dom.NotFoundErr()
+ try:
+ self._attrs[node.name]
+ except KeyError:
+ raise xml.dom.NotFoundErr()
+ _clear_id_cache(self)
+ node.unlink()
+ # Restore this since the node is still useful and otherwise
+ # unlinked
+ node.ownerDocument = self.ownerDocument
+
+ removeAttributeNodeNS = removeAttributeNode
+
+ def hasAttribute(self, name):
+ return name in self._attrs
+
+ def hasAttributeNS(self, namespaceURI, localName):
+ return (namespaceURI, localName) in self._attrsNS
+
+ def getElementsByTagName(self, name):
+ return _get_elements_by_tagName_helper(self, name, NodeList())
+
+ def getElementsByTagNameNS(self, namespaceURI, localName):
+ return _get_elements_by_tagName_ns_helper(
+ self, namespaceURI, localName, NodeList())
+
+ def __repr__(self):
+ return "<DOM Element: %s at %#x>" % (self.tagName, id(self))
+
+ def writexml(self, writer, indent="", addindent="", newl=""):
+ # indent = current indentation
+ # addindent = indentation to add to higher levels
+ # newl = newline string
+ writer.write(indent+"<" + self.tagName)
+
+ attrs = self._get_attributes()
+ a_names = attrs.keys()
+ a_names.sort()
+
+ for a_name in a_names:
+ writer.write(" %s=\"" % a_name)
+ _write_data(writer, attrs[a_name].value)
+ writer.write("\"")
+ if self.childNodes:
+ writer.write(">")
+ if (len(self.childNodes) == 1 and
+ self.childNodes[0].nodeType == Node.TEXT_NODE):
+ self.childNodes[0].writexml(writer, '', '', '')
+ else:
+ writer.write(newl)
+ for node in self.childNodes:
+ node.writexml(writer, indent+addindent, addindent, newl)
+ writer.write(indent)
+ writer.write("</%s>%s" % (self.tagName, newl))
+ else:
+ writer.write("/>%s"%(newl))
+
+ def _get_attributes(self):
+ return NamedNodeMap(self._attrs, self._attrsNS, self)
+
+ def hasAttributes(self):
+ if self._attrs:
+ return True
+ else:
+ return False
+
+ # DOM Level 3 attributes, based on the 22 Oct 2002 draft
+
+ def setIdAttribute(self, name):
+ idAttr = self.getAttributeNode(name)
+ self.setIdAttributeNode(idAttr)
+
+ def setIdAttributeNS(self, namespaceURI, localName):
+ idAttr = self.getAttributeNodeNS(namespaceURI, localName)
+ self.setIdAttributeNode(idAttr)
+
+ def setIdAttributeNode(self, idAttr):
+ if idAttr is None or not self.isSameNode(idAttr.ownerElement):
+ raise xml.dom.NotFoundErr()
+ if _get_containing_entref(self) is not None:
+ raise xml.dom.NoModificationAllowedErr()
+ if not idAttr._is_id:
+ idAttr.__dict__['_is_id'] = True
+ self._magic_id_nodes += 1
+ self.ownerDocument._magic_id_count += 1
+ _clear_id_cache(self)
+
+defproperty(Element, "attributes",
+ doc="NamedNodeMap of attributes on the element.")
+defproperty(Element, "localName",
+ doc="Namespace-local name of this element.")
+
+
+def _set_attribute_node(element, attr):
+ _clear_id_cache(element)
+ element._attrs[attr.name] = attr
+ element._attrsNS[(attr.namespaceURI, attr.localName)] = attr
+
+ # This creates a circular reference, but Element.unlink()
+ # breaks the cycle since the references to the attribute
+ # dictionaries are tossed.
+ attr.__dict__['ownerElement'] = element
+
+
+class Childless:
+ """Mixin that makes childless-ness easy to implement and avoids
+ the complexity of the Node methods that deal with children.
+ """
+
+ attributes = None
+ childNodes = EmptyNodeList()
+ firstChild = None
+ lastChild = None
+
+ def _get_firstChild(self):
+ return None
+
+ def _get_lastChild(self):
+ return None
+
+ def appendChild(self, node):
+ raise xml.dom.HierarchyRequestErr(
+ self.nodeName + " nodes cannot have children")
+
+ def hasChildNodes(self):
+ return False
+
+ def insertBefore(self, newChild, refChild):
+ raise xml.dom.HierarchyRequestErr(
+ self.nodeName + " nodes do not have children")
+
+ def removeChild(self, oldChild):
+ raise xml.dom.NotFoundErr(
+ self.nodeName + " nodes do not have children")
+
+ def normalize(self):
+ # For childless nodes, normalize() has nothing to do.
+ pass
+
+ def replaceChild(self, newChild, oldChild):
+ raise xml.dom.HierarchyRequestErr(
+ self.nodeName + " nodes do not have children")
+
+
+class ProcessingInstruction(Childless, Node):
+ nodeType = Node.PROCESSING_INSTRUCTION_NODE
+
+ def __init__(self, target, data):
+ self.target = self.nodeName = target
+ self.data = self.nodeValue = data
+
+ def _get_data(self):
+ return self.data
+ def _set_data(self, value):
+ d = self.__dict__
+ d['data'] = d['nodeValue'] = value
+
+ def _get_target(self):
+ return self.target
+ def _set_target(self, value):
+ d = self.__dict__
+ d['target'] = d['nodeName'] = value
+
+ def __setattr__(self, name, value):
+ if name == "data" or name == "nodeValue":
+ self.__dict__['data'] = self.__dict__['nodeValue'] = value
+ elif name == "target" or name == "nodeName":
+ self.__dict__['target'] = self.__dict__['nodeName'] = value
+ else:
+ self.__dict__[name] = value
+
+ def writexml(self, writer, indent="", addindent="", newl=""):
+ writer.write("%s<?%s %s?>%s" % (indent,self.target, self.data, newl))
+
+
+class CharacterData(Childless, Node):
+ def _get_length(self):
+ return len(self.data)
+ __len__ = _get_length
+
+ def _get_data(self):
+ return self.__dict__['data']
+ def _set_data(self, data):
+ d = self.__dict__
+ d['data'] = d['nodeValue'] = data
+
+ _get_nodeValue = _get_data
+ _set_nodeValue = _set_data
+
+ def __setattr__(self, name, value):
+ if name == "data" or name == "nodeValue":
+ self.__dict__['data'] = self.__dict__['nodeValue'] = value
+ else:
+ self.__dict__[name] = value
+
+ def __repr__(self):
+ data = self.data
+ if len(data) > 10:
+ dotdotdot = "..."
+ else:
+ dotdotdot = ""
+ return '<DOM %s node "%r%s">' % (
+ self.__class__.__name__, data[0:10], dotdotdot)
+
+ def substringData(self, offset, count):
+ if offset < 0:
+ raise xml.dom.IndexSizeErr("offset cannot be negative")
+ if offset >= len(self.data):
+ raise xml.dom.IndexSizeErr("offset cannot be beyond end of data")
+ if count < 0:
+ raise xml.dom.IndexSizeErr("count cannot be negative")
+ return self.data[offset:offset+count]
+
+ def appendData(self, arg):
+ self.data = self.data + arg
+
+ def insertData(self, offset, arg):
+ if offset < 0:
+ raise xml.dom.IndexSizeErr("offset cannot be negative")
+ if offset >= len(self.data):
+ raise xml.dom.IndexSizeErr("offset cannot be beyond end of data")
+ if arg:
+ self.data = "%s%s%s" % (
+ self.data[:offset], arg, self.data[offset:])
+
+ def deleteData(self, offset, count):
+ if offset < 0:
+ raise xml.dom.IndexSizeErr("offset cannot be negative")
+ if offset >= len(self.data):
+ raise xml.dom.IndexSizeErr("offset cannot be beyond end of data")
+ if count < 0:
+ raise xml.dom.IndexSizeErr("count cannot be negative")
+ if count:
+ self.data = self.data[:offset] + self.data[offset+count:]
+
+ def replaceData(self, offset, count, arg):
+ if offset < 0:
+ raise xml.dom.IndexSizeErr("offset cannot be negative")
+ if offset >= len(self.data):
+ raise xml.dom.IndexSizeErr("offset cannot be beyond end of data")
+ if count < 0:
+ raise xml.dom.IndexSizeErr("count cannot be negative")
+ if count:
+ self.data = "%s%s%s" % (
+ self.data[:offset], arg, self.data[offset+count:])
+
+defproperty(CharacterData, "length", doc="Length of the string data.")
+
+
+class Text(CharacterData):
+ # Make sure we don't add an instance __dict__ if we don't already
+ # have one, at least when that's possible:
+ # XXX this does not work, CharacterData is an old-style class
+ # __slots__ = ()
+
+ nodeType = Node.TEXT_NODE
+ nodeName = "#text"
+ attributes = None
+
+ def splitText(self, offset):
+ if offset < 0 or offset > len(self.data):
+ raise xml.dom.IndexSizeErr("illegal offset value")
+ newText = self.__class__()
+ newText.data = self.data[offset:]
+ newText.ownerDocument = self.ownerDocument
+ next = self.nextSibling
+ if self.parentNode and self in self.parentNode.childNodes:
+ if next is None:
+ self.parentNode.appendChild(newText)
+ else:
+ self.parentNode.insertBefore(newText, next)
+ self.data = self.data[:offset]
+ return newText
+
+ def writexml(self, writer, indent="", addindent="", newl=""):
+ _write_data(writer, "%s%s%s" % (indent, self.data, newl))
+
+ # DOM Level 3 (WD 9 April 2002)
+
+ def _get_wholeText(self):
+ L = [self.data]
+ n = self.previousSibling
+ while n is not None:
+ if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE):
+ L.insert(0, n.data)
+ n = n.previousSibling
+ else:
+ break
+ n = self.nextSibling
+ while n is not None:
+ if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE):
+ L.append(n.data)
+ n = n.nextSibling
+ else:
+ break
+ return ''.join(L)
+
+ def replaceWholeText(self, content):
+ # XXX This needs to be seriously changed if minidom ever
+ # supports EntityReference nodes.
+ parent = self.parentNode
+ n = self.previousSibling
+ while n is not None:
+ if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE):
+ next = n.previousSibling
+ parent.removeChild(n)
+ n = next
+ else:
+ break
+ n = self.nextSibling
+ if not content:
+ parent.removeChild(self)
+ while n is not None:
+ if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE):
+ next = n.nextSibling
+ parent.removeChild(n)
+ n = next
+ else:
+ break
+ if content:
+ d = self.__dict__
+ d['data'] = content
+ d['nodeValue'] = content
+ return self
+ else:
+ return None
+
+ def _get_isWhitespaceInElementContent(self):
+ if self.data.strip():
+ return False
+ elem = _get_containing_element(self)
+ if elem is None:
+ return False
+ info = self.ownerDocument._get_elem_info(elem)
+ if info is None:
+ return False
+ else:
+ return info.isElementContent()
+
+defproperty(Text, "isWhitespaceInElementContent",
+ doc="True iff this text node contains only whitespace"
+ " and is in element content.")
+defproperty(Text, "wholeText",
+ doc="The text of all logically-adjacent text nodes.")
+
+
+def _get_containing_element(node):
+ c = node.parentNode
+ while c is not None:
+ if c.nodeType == Node.ELEMENT_NODE:
+ return c
+ c = c.parentNode
+ return None
+
+def _get_containing_entref(node):
+ c = node.parentNode
+ while c is not None:
+ if c.nodeType == Node.ENTITY_REFERENCE_NODE:
+ return c
+ c = c.parentNode
+ return None
+
+
+class Comment(Childless, CharacterData):
+ nodeType = Node.COMMENT_NODE
+ nodeName = "#comment"
+
+ def __init__(self, data):
+ self.data = self.nodeValue = data
+
+ def writexml(self, writer, indent="", addindent="", newl=""):
+ if "--" in self.data:
+ raise ValueError("'--' is not allowed in a comment node")
+ writer.write("%s<!--%s-->%s" % (indent, self.data, newl))
+
+
+class CDATASection(Text):
+ # Make sure we don't add an instance __dict__ if we don't already
+ # have one, at least when that's possible:
+ # XXX this does not work, Text is an old-style class
+ # __slots__ = ()
+
+ nodeType = Node.CDATA_SECTION_NODE
+ nodeName = "#cdata-section"
+
+ def writexml(self, writer, indent="", addindent="", newl=""):
+ if self.data.find("]]>") >= 0:
+ raise ValueError("']]>' not allowed in a CDATA section")
+ writer.write("<![CDATA[%s]]>" % self.data)
+
+
+class ReadOnlySequentialNamedNodeMap(object):
+ __slots__ = '_seq',
+
+ def __init__(self, seq=()):
+ # seq should be a list or tuple
+ self._seq = seq
+
+ def __len__(self):
+ return len(self._seq)
+
+ def _get_length(self):
+ return len(self._seq)
+
+ def getNamedItem(self, name):
+ for n in self._seq:
+ if n.nodeName == name:
+ return n
+
+ def getNamedItemNS(self, namespaceURI, localName):
+ for n in self._seq:
+ if n.namespaceURI == namespaceURI and n.localName == localName:
+ return n
+
+ def __getitem__(self, name_or_tuple):
+ if isinstance(name_or_tuple, tuple):
+ node = self.getNamedItemNS(*name_or_tuple)
+ else:
+ node = self.getNamedItem(name_or_tuple)
+ if node is None:
+ raise KeyError, name_or_tuple
+ return node
+
+ def item(self, index):
+ if index < 0:
+ return None
+ try:
+ return self._seq[index]
+ except IndexError:
+ return None
+
+ def removeNamedItem(self, name):
+ raise xml.dom.NoModificationAllowedErr(
+ "NamedNodeMap instance is read-only")
+
+ def removeNamedItemNS(self, namespaceURI, localName):
+ raise xml.dom.NoModificationAllowedErr(
+ "NamedNodeMap instance is read-only")
+
+ def setNamedItem(self, node):
+ raise xml.dom.NoModificationAllowedErr(
+ "NamedNodeMap instance is read-only")
+
+ def setNamedItemNS(self, node):
+ raise xml.dom.NoModificationAllowedErr(
+ "NamedNodeMap instance is read-only")
+
+ def __getstate__(self):
+ return [self._seq]
+
+ def __setstate__(self, state):
+ self._seq = state[0]
+
+defproperty(ReadOnlySequentialNamedNodeMap, "length",
+ doc="Number of entries in the NamedNodeMap.")
+
+
+class Identified:
+ """Mix-in class that supports the publicId and systemId attributes."""
+
+ # XXX this does not work, this is an old-style class
+ # __slots__ = 'publicId', 'systemId'
+
+ def _identified_mixin_init(self, publicId, systemId):
+ self.publicId = publicId
+ self.systemId = systemId
+
+ def _get_publicId(self):
+ return self.publicId
+
+ def _get_systemId(self):
+ return self.systemId
+
+class DocumentType(Identified, Childless, Node):
+ nodeType = Node.DOCUMENT_TYPE_NODE
+ nodeValue = None
+ name = None
+ publicId = None
+ systemId = None
+ internalSubset = None
+
+ def __init__(self, qualifiedName):
+ self.entities = ReadOnlySequentialNamedNodeMap()
+ self.notations = ReadOnlySequentialNamedNodeMap()
+ if qualifiedName:
+ prefix, localname = _nssplit(qualifiedName)
+ self.name = localname
+ self.nodeName = self.name
+
+ def _get_internalSubset(self):
+ return self.internalSubset
+
+ def cloneNode(self, deep):
+ if self.ownerDocument is None:
+ # it's ok
+ clone = DocumentType(None)
+ clone.name = self.name
+ clone.nodeName = self.name
+ operation = xml.dom.UserDataHandler.NODE_CLONED
+ if deep:
+ clone.entities._seq = []
+ clone.notations._seq = []
+ for n in self.notations._seq:
+ notation = Notation(n.nodeName, n.publicId, n.systemId)
+ clone.notations._seq.append(notation)
+ n._call_user_data_handler(operation, n, notation)
+ for e in self.entities._seq:
+ entity = Entity(e.nodeName, e.publicId, e.systemId,
+ e.notationName)
+ entity.actualEncoding = e.actualEncoding
+ entity.encoding = e.encoding
+ entity.version = e.version
+ clone.entities._seq.append(entity)
+ e._call_user_data_handler(operation, n, entity)
+ self._call_user_data_handler(operation, self, clone)
+ return clone
+ else:
+ return None
+
+ def writexml(self, writer, indent="", addindent="", newl=""):
+ writer.write("<!DOCTYPE ")
+ writer.write(self.name)
+ if self.publicId:
+ writer.write("%s PUBLIC '%s'%s '%s'"
+ % (newl, self.publicId, newl, self.systemId))
+ elif self.systemId:
+ writer.write("%s SYSTEM '%s'" % (newl, self.systemId))
+ if self.internalSubset is not None:
+ writer.write(" [")
+ writer.write(self.internalSubset)
+ writer.write("]")
+ writer.write(">"+newl)
+
+class Entity(Identified, Node):
+ attributes = None
+ nodeType = Node.ENTITY_NODE
+ nodeValue = None
+
+ actualEncoding = None
+ encoding = None
+ version = None
+
+ def __init__(self, name, publicId, systemId, notation):
+ self.nodeName = name
+ self.notationName = notation
+ self.childNodes = NodeList()
+ self._identified_mixin_init(publicId, systemId)
+
+ def _get_actualEncoding(self):
+ return self.actualEncoding
+
+ def _get_encoding(self):
+ return self.encoding
+
+ def _get_version(self):
+ return self.version
+
+ def appendChild(self, newChild):
+ raise xml.dom.HierarchyRequestErr(
+ "cannot append children to an entity node")
+
+ def insertBefore(self, newChild, refChild):
+ raise xml.dom.HierarchyRequestErr(
+ "cannot insert children below an entity node")
+
+ def removeChild(self, oldChild):
+ raise xml.dom.HierarchyRequestErr(
+ "cannot remove children from an entity node")
+
+ def replaceChild(self, newChild, oldChild):
+ raise xml.dom.HierarchyRequestErr(
+ "cannot replace children of an entity node")
+
+class Notation(Identified, Childless, Node):
+ nodeType = Node.NOTATION_NODE
+ nodeValue = None
+
+ def __init__(self, name, publicId, systemId):
+ self.nodeName = name
+ self._identified_mixin_init(publicId, systemId)
+
+
+class DOMImplementation(DOMImplementationLS):
+ _features = [("core", "1.0"),
+ ("core", "2.0"),
+ ("core", None),
+ ("xml", "1.0"),
+ ("xml", "2.0"),
+ ("xml", None),
+ ("ls-load", "3.0"),
+ ("ls-load", None),
+ ]
+
+ def hasFeature(self, feature, version):
+ if version == "":
+ version = None
+ return (feature.lower(), version) in self._features
+
+ def createDocument(self, namespaceURI, qualifiedName, doctype):
+ if doctype and doctype.parentNode is not None:
+ raise xml.dom.WrongDocumentErr(
+ "doctype object owned by another DOM tree")
+ doc = self._create_document()
+
+ add_root_element = not (namespaceURI is None
+ and qualifiedName is None
+ and doctype is None)
+
+ if not qualifiedName and add_root_element:
+ # The spec is unclear what to raise here; SyntaxErr
+ # would be the other obvious candidate. Since Xerces raises
+ # InvalidCharacterErr, and since SyntaxErr is not listed
+ # for createDocument, that seems to be the better choice.
+ # XXX: need to check for illegal characters here and in
+ # createElement.
+
+ # DOM Level III clears this up when talking about the return value
+ # of this function. If namespaceURI, qName and DocType are
+ # Null the document is returned without a document element
+ # Otherwise if doctype or namespaceURI are not None
+ # Then we go back to the above problem
+ raise xml.dom.InvalidCharacterErr("Element with no name")
+
+ if add_root_element:
+ prefix, localname = _nssplit(qualifiedName)
+ if prefix == "xml" \
+ and namespaceURI != "http://www.w3.org/XML/1998/namespace":
+ raise xml.dom.NamespaceErr("illegal use of 'xml' prefix")
+ if prefix and not namespaceURI:
+ raise xml.dom.NamespaceErr(
+ "illegal use of prefix without namespaces")
+ element = doc.createElementNS(namespaceURI, qualifiedName)
+ if doctype:
+ doc.appendChild(doctype)
+ doc.appendChild(element)
+
+ if doctype:
+ doctype.parentNode = doctype.ownerDocument = doc
+
+ doc.doctype = doctype
+ doc.implementation = self
+ return doc
+
+ def createDocumentType(self, qualifiedName, publicId, systemId):
+ doctype = DocumentType(qualifiedName)
+ doctype.publicId = publicId
+ doctype.systemId = systemId
+ return doctype
+
+ # DOM Level 3 (WD 9 April 2002)
+
+ def getInterface(self, feature):
+ if self.hasFeature(feature, None):
+ return self
+ else:
+ return None
+
+ # internal
+ def _create_document(self):
+ return Document()
+
+class ElementInfo(object):
+ """Object that represents content-model information for an element.
+
+ This implementation is not expected to be used in practice; DOM
+ builders should provide implementations which do the right thing
+ using information available to it.
+
+ """
+
+ __slots__ = 'tagName',
+
+ def __init__(self, name):
+ self.tagName = name
+
+ def getAttributeType(self, aname):
+ return _no_type
+
+ def getAttributeTypeNS(self, namespaceURI, localName):
+ return _no_type
+
+ def isElementContent(self):
+ return False
+
+ def isEmpty(self):
+ """Returns true iff this element is declared to have an EMPTY
+ content model."""
+ return False
+
+ def isId(self, aname):
+ """Returns true iff the named attribute is a DTD-style ID."""
+ return False
+
+ def isIdNS(self, namespaceURI, localName):
+ """Returns true iff the identified attribute is a DTD-style ID."""
+ return False
+
+ def __getstate__(self):
+ return self.tagName
+
+ def __setstate__(self, state):
+ self.tagName = state
+
+def _clear_id_cache(node):
+ if node.nodeType == Node.DOCUMENT_NODE:
+ node._id_cache.clear()
+ node._id_search_stack = None
+ elif _in_document(node):
+ node.ownerDocument._id_cache.clear()
+ node.ownerDocument._id_search_stack= None
+
+class Document(Node, DocumentLS):
+ _child_node_types = (Node.ELEMENT_NODE, Node.PROCESSING_INSTRUCTION_NODE,
+ Node.COMMENT_NODE, Node.DOCUMENT_TYPE_NODE)
+
+ nodeType = Node.DOCUMENT_NODE
+ nodeName = "#document"
+ nodeValue = None
+ attributes = None
+ doctype = None
+ parentNode = None
+ previousSibling = nextSibling = None
+
+ implementation = DOMImplementation()
+
+ # Document attributes from Level 3 (WD 9 April 2002)
+
+ actualEncoding = None
+ encoding = None
+ standalone = None
+ version = None
+ strictErrorChecking = False
+ errorHandler = None
+ documentURI = None
+
+ _magic_id_count = 0
+
+ def __init__(self):
+ self.childNodes = NodeList()
+ # mapping of (namespaceURI, localName) -> ElementInfo
+ # and tagName -> ElementInfo
+ self._elem_info = {}
+ self._id_cache = {}
+ self._id_search_stack = None
+
+ def _get_elem_info(self, element):
+ if element.namespaceURI:
+ key = element.namespaceURI, element.localName
+ else:
+ key = element.tagName
+ return self._elem_info.get(key)
+
+ def _get_actualEncoding(self):
+ return self.actualEncoding
+
+ def _get_doctype(self):
+ return self.doctype
+
+ def _get_documentURI(self):
+ return self.documentURI
+
+ def _get_encoding(self):
+ return self.encoding
+
+ def _get_errorHandler(self):
+ return self.errorHandler
+
+ def _get_standalone(self):
+ return self.standalone
+
+ def _get_strictErrorChecking(self):
+ return self.strictErrorChecking
+
+ def _get_version(self):
+ return self.version
+
+ def appendChild(self, node):
+ if node.nodeType not in self._child_node_types:
+ raise xml.dom.HierarchyRequestErr(
+ "%s cannot be child of %s" % (repr(node), repr(self)))
+ if node.parentNode is not None:
+ # This needs to be done before the next test since this
+ # may *be* the document element, in which case it should
+ # end up re-ordered to the end.
+ node.parentNode.removeChild(node)
+
+ if node.nodeType == Node.ELEMENT_NODE \
+ and self._get_documentElement():
+ raise xml.dom.HierarchyRequestErr(
+ "two document elements disallowed")
+ return Node.appendChild(self, node)
+
+ def removeChild(self, oldChild):
+ try:
+ self.childNodes.remove(oldChild)
+ except ValueError:
+ raise xml.dom.NotFoundErr()
+ oldChild.nextSibling = oldChild.previousSibling = None
+ oldChild.parentNode = None
+ if self.documentElement is oldChild:
+ self.documentElement = None
+
+ return oldChild
+
+ def _get_documentElement(self):
+ for node in self.childNodes:
+ if node.nodeType == Node.ELEMENT_NODE:
+ return node
+
+ def unlink(self):
+ if self.doctype is not None:
+ self.doctype.unlink()
+ self.doctype = None
+ Node.unlink(self)
+
+ def cloneNode(self, deep):
+ if not deep:
+ return None
+ clone = self.implementation.createDocument(None, None, None)
+ clone.encoding = self.encoding
+ clone.standalone = self.standalone
+ clone.version = self.version
+ for n in self.childNodes:
+ childclone = _clone_node(n, deep, clone)
+ assert childclone.ownerDocument.isSameNode(clone)
+ clone.childNodes.append(childclone)
+ if childclone.nodeType == Node.DOCUMENT_NODE:
+ assert clone.documentElement is None
+ elif childclone.nodeType == Node.DOCUMENT_TYPE_NODE:
+ assert clone.doctype is None
+ clone.doctype = childclone
+ childclone.parentNode = clone
+ self._call_user_data_handler(xml.dom.UserDataHandler.NODE_CLONED,
+ self, clone)
+ return clone
+
+ def createDocumentFragment(self):
+ d = DocumentFragment()
+ d.ownerDocument = self
+ return d
+
+ def createElement(self, tagName):
+ e = Element(tagName)
+ e.ownerDocument = self
+ return e
+
+ def createTextNode(self, data):
+ if not isinstance(data, StringTypes):
+ raise TypeError, "node contents must be a string"
+ t = Text()
+ t.data = data
+ t.ownerDocument = self
+ return t
+
+ def createCDATASection(self, data):
+ if not isinstance(data, StringTypes):
+ raise TypeError, "node contents must be a string"
+ c = CDATASection()
+ c.data = data
+ c.ownerDocument = self
+ return c
+
+ def createComment(self, data):
+ c = Comment(data)
+ c.ownerDocument = self
+ return c
+
+ def createProcessingInstruction(self, target, data):
+ p = ProcessingInstruction(target, data)
+ p.ownerDocument = self
+ return p
+
+ def createAttribute(self, qName):
+ a = Attr(qName)
+ a.ownerDocument = self
+ a.value = ""
+ return a
+
+ def createElementNS(self, namespaceURI, qualifiedName):
+ prefix, localName = _nssplit(qualifiedName)
+ e = Element(qualifiedName, namespaceURI, prefix)
+ e.ownerDocument = self
+ return e
+
+ def createAttributeNS(self, namespaceURI, qualifiedName):
+ prefix, localName = _nssplit(qualifiedName)
+ a = Attr(qualifiedName, namespaceURI, localName, prefix)
+ a.ownerDocument = self
+ a.value = ""
+ return a
+
+ # A couple of implementation-specific helpers to create node types
+ # not supported by the W3C DOM specs:
+
+ def _create_entity(self, name, publicId, systemId, notationName):
+ e = Entity(name, publicId, systemId, notationName)
+ e.ownerDocument = self
+ return e
+
+ def _create_notation(self, name, publicId, systemId):
+ n = Notation(name, publicId, systemId)
+ n.ownerDocument = self
+ return n
+
+ def getElementById(self, id):
+ if id in self._id_cache:
+ return self._id_cache[id]
+ if not (self._elem_info or self._magic_id_count):
+ return None
+
+ stack = self._id_search_stack
+ if stack is None:
+ # we never searched before, or the cache has been cleared
+ stack = [self.documentElement]
+ self._id_search_stack = stack
+ elif not stack:
+ # Previous search was completed and cache is still valid;
+ # no matching node.
+ return None
+
+ result = None
+ while stack:
+ node = stack.pop()
+ # add child elements to stack for continued searching
+ stack.extend([child for child in node.childNodes
+ if child.nodeType in _nodeTypes_with_children])
+ # check this node
+ info = self._get_elem_info(node)
+ if info:
+ # We have to process all ID attributes before
+ # returning in order to get all the attributes set to
+ # be IDs using Element.setIdAttribute*().
+ for attr in node.attributes.values():
+ if attr.namespaceURI:
+ if info.isIdNS(attr.namespaceURI, attr.localName):
+ self._id_cache[attr.value] = node
+ if attr.value == id:
+ result = node
+ elif not node._magic_id_nodes:
+ break
+ elif info.isId(attr.name):
+ self._id_cache[attr.value] = node
+ if attr.value == id:
+ result = node
+ elif not node._magic_id_nodes:
+ break
+ elif attr._is_id:
+ self._id_cache[attr.value] = node
+ if attr.value == id:
+ result = node
+ elif node._magic_id_nodes == 1:
+ break
+ elif node._magic_id_nodes:
+ for attr in node.attributes.values():
+ if attr._is_id:
+ self._id_cache[attr.value] = node
+ if attr.value == id:
+ result = node
+ if result is not None:
+ break
+ return result
+
+ def getElementsByTagName(self, name):
+ return _get_elements_by_tagName_helper(self, name, NodeList())
+
+ def getElementsByTagNameNS(self, namespaceURI, localName):
+ return _get_elements_by_tagName_ns_helper(
+ self, namespaceURI, localName, NodeList())
+
+ def isSupported(self, feature, version):
+ return self.implementation.hasFeature(feature, version)
+
+ def importNode(self, node, deep):
+ if node.nodeType == Node.DOCUMENT_NODE:
+ raise xml.dom.NotSupportedErr("cannot import document nodes")
+ elif node.nodeType == Node.DOCUMENT_TYPE_NODE:
+ raise xml.dom.NotSupportedErr("cannot import document type nodes")
+ return _clone_node(node, deep, self)
+
+ def writexml(self, writer, indent="", addindent="", newl="",
+ encoding = None):
+ if encoding is None:
+ writer.write('<?xml version="1.0" ?>'+newl)
+ else:
+ writer.write('<?xml version="1.0" encoding="%s"?>%s' % (encoding, newl))
+ for node in self.childNodes:
+ node.writexml(writer, indent, addindent, newl)
+
+ # DOM Level 3 (WD 9 April 2002)
+
+ def renameNode(self, n, namespaceURI, name):
+ if n.ownerDocument is not self:
+ raise xml.dom.WrongDocumentErr(
+ "cannot rename nodes from other documents;\n"
+ "expected %s,\nfound %s" % (self, n.ownerDocument))
+ if n.nodeType not in (Node.ELEMENT_NODE, Node.ATTRIBUTE_NODE):
+ raise xml.dom.NotSupportedErr(
+ "renameNode() only applies to element and attribute nodes")
+ if namespaceURI != EMPTY_NAMESPACE:
+ if ':' in name:
+ prefix, localName = name.split(':', 1)
+ if ( prefix == "xmlns"
+ and namespaceURI != xml.dom.XMLNS_NAMESPACE):
+ raise xml.dom.NamespaceErr(
+ "illegal use of 'xmlns' prefix")
+ else:
+ if ( name == "xmlns"
+ and namespaceURI != xml.dom.XMLNS_NAMESPACE
+ and n.nodeType == Node.ATTRIBUTE_NODE):
+ raise xml.dom.NamespaceErr(
+ "illegal use of the 'xmlns' attribute")
+ prefix = None
+ localName = name
+ else:
+ prefix = None
+ localName = None
+ if n.nodeType == Node.ATTRIBUTE_NODE:
+ element = n.ownerElement
+ if element is not None:
+ is_id = n._is_id
+ element.removeAttributeNode(n)
+ else:
+ element = None
+ # avoid __setattr__
+ d = n.__dict__
+ d['prefix'] = prefix
+ d['localName'] = localName
+ d['namespaceURI'] = namespaceURI
+ d['nodeName'] = name
+ if n.nodeType == Node.ELEMENT_NODE:
+ d['tagName'] = name
+ else:
+ # attribute node
+ d['name'] = name
+ if element is not None:
+ element.setAttributeNode(n)
+ if is_id:
+ element.setIdAttributeNode(n)
+ # It's not clear from a semantic perspective whether we should
+ # call the user data handlers for the NODE_RENAMED event since
+ # we're re-using the existing node. The draft spec has been
+ # interpreted as meaning "no, don't call the handler unless a
+ # new node is created."
+ return n
+
+defproperty(Document, "documentElement",
+ doc="Top-level element of this document.")
+
+
+def _clone_node(node, deep, newOwnerDocument):
+ """
+ Clone a node and give it the new owner document.
+ Called by Node.cloneNode and Document.importNode
+ """
+ if node.ownerDocument.isSameNode(newOwnerDocument):
+ operation = xml.dom.UserDataHandler.NODE_CLONED
+ else:
+ operation = xml.dom.UserDataHandler.NODE_IMPORTED
+ if node.nodeType == Node.ELEMENT_NODE:
+ clone = newOwnerDocument.createElementNS(node.namespaceURI,
+ node.nodeName)
+ for attr in node.attributes.values():
+ clone.setAttributeNS(attr.namespaceURI, attr.nodeName, attr.value)
+ a = clone.getAttributeNodeNS(attr.namespaceURI, attr.localName)
+ a.specified = attr.specified
+
+ if deep:
+ for child in node.childNodes:
+ c = _clone_node(child, deep, newOwnerDocument)
+ clone.appendChild(c)
+
+ elif node.nodeType == Node.DOCUMENT_FRAGMENT_NODE:
+ clone = newOwnerDocument.createDocumentFragment()
+ if deep:
+ for child in node.childNodes:
+ c = _clone_node(child, deep, newOwnerDocument)
+ clone.appendChild(c)
+
+ elif node.nodeType == Node.TEXT_NODE:
+ clone = newOwnerDocument.createTextNode(node.data)
+ elif node.nodeType == Node.CDATA_SECTION_NODE:
+ clone = newOwnerDocument.createCDATASection(node.data)
+ elif node.nodeType == Node.PROCESSING_INSTRUCTION_NODE:
+ clone = newOwnerDocument.createProcessingInstruction(node.target,
+ node.data)
+ elif node.nodeType == Node.COMMENT_NODE:
+ clone = newOwnerDocument.createComment(node.data)
+ elif node.nodeType == Node.ATTRIBUTE_NODE:
+ clone = newOwnerDocument.createAttributeNS(node.namespaceURI,
+ node.nodeName)
+ clone.specified = True
+ clone.value = node.value
+ elif node.nodeType == Node.DOCUMENT_TYPE_NODE:
+ assert node.ownerDocument is not newOwnerDocument
+ operation = xml.dom.UserDataHandler.NODE_IMPORTED
+ clone = newOwnerDocument.implementation.createDocumentType(
+ node.name, node.publicId, node.systemId)
+ clone.ownerDocument = newOwnerDocument
+ if deep:
+ clone.entities._seq = []
+ clone.notations._seq = []
+ for n in node.notations._seq:
+ notation = Notation(n.nodeName, n.publicId, n.systemId)
+ notation.ownerDocument = newOwnerDocument
+ clone.notations._seq.append(notation)
+ if hasattr(n, '_call_user_data_handler'):
+ n._call_user_data_handler(operation, n, notation)
+ for e in node.entities._seq:
+ entity = Entity(e.nodeName, e.publicId, e.systemId,
+ e.notationName)
+ entity.actualEncoding = e.actualEncoding
+ entity.encoding = e.encoding
+ entity.version = e.version
+ entity.ownerDocument = newOwnerDocument
+ clone.entities._seq.append(entity)
+ if hasattr(e, '_call_user_data_handler'):
+ e._call_user_data_handler(operation, n, entity)
+ else:
+ # Note the cloning of Document and DocumentType nodes is
+ # implementation specific. minidom handles those cases
+ # directly in the cloneNode() methods.
+ raise xml.dom.NotSupportedErr("Cannot clone node %s" % repr(node))
+
+ # Check for _call_user_data_handler() since this could conceivably
+ # used with other DOM implementations (one of the FourThought
+ # DOMs, perhaps?).
+ if hasattr(node, '_call_user_data_handler'):
+ node._call_user_data_handler(operation, node, clone)
+ return clone
+
+
+def _nssplit(qualifiedName):
+ fields = qualifiedName.split(':', 1)
+ if len(fields) == 2:
+ return fields
+ else:
+ return (None, fields[0])
+
+
+def _get_StringIO():
+ # we can't use cStringIO since it doesn't support Unicode strings
+ from StringIO import StringIO
+ return StringIO()
+
+def _do_pulldom_parse(func, args, kwargs):
+ events = func(*args, **kwargs)
+ toktype, rootNode = events.getEvent()
+ events.expandNode(rootNode)
+ events.clear()
+ return rootNode
+
+def parse(file, parser=None, bufsize=None):
+ """Parse a file into a DOM by filename or file object."""
+ if parser is None and not bufsize:
+ from xml.dom import expatbuilder
+ return expatbuilder.parse(file)
+ else:
+ from xml.dom import pulldom
+ return _do_pulldom_parse(pulldom.parse, (file,),
+ {'parser': parser, 'bufsize': bufsize})
+
+def parseString(string, parser=None):
+ """Parse a file into a DOM from a string."""
+ if parser is None:
+ from xml.dom import expatbuilder
+ return expatbuilder.parseString(string)
+ else:
+ from xml.dom import pulldom
+ return _do_pulldom_parse(pulldom.parseString, (string,),
+ {'parser': parser})
+
+def getDOMImplementation(features=None):
+ if features:
+ if isinstance(features, StringTypes):
+ features = domreg._parse_feature_string(features)
+ for f, v in features:
+ if not Document.implementation.hasFeature(f, v):
+ return None
+ return Document.implementation
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
index 0000000000..cdec74641b
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/pulldom.py
@@ -0,0 +1,351 @@
+import xml.sax
+import xml.sax.handler
+import types
+
+try:
+ _StringTypes = [types.StringType, types.UnicodeType]
+except AttributeError:
+ _StringTypes = [types.StringType]
+
+START_ELEMENT = "START_ELEMENT"
+END_ELEMENT = "END_ELEMENT"
+COMMENT = "COMMENT"
+START_DOCUMENT = "START_DOCUMENT"
+END_DOCUMENT = "END_DOCUMENT"
+PROCESSING_INSTRUCTION = "PROCESSING_INSTRUCTION"
+IGNORABLE_WHITESPACE = "IGNORABLE_WHITESPACE"
+CHARACTERS = "CHARACTERS"
+
+class PullDOM(xml.sax.ContentHandler):
+ _locator = None
+ document = None
+
+ def __init__(self, documentFactory=None):
+ from xml.dom import XML_NAMESPACE
+ self.documentFactory = documentFactory
+ self.firstEvent = [None, None]
+ self.lastEvent = self.firstEvent
+ self.elementStack = []
+ self.push = self.elementStack.append
+ try:
+ self.pop = self.elementStack.pop
+ except AttributeError:
+ # use class' pop instead
+ pass
+ self._ns_contexts = [{XML_NAMESPACE:'xml'}] # contains uri -> prefix dicts
+ self._current_context = self._ns_contexts[-1]
+ self.pending_events = []
+
+ def pop(self):
+ result = self.elementStack[-1]
+ del self.elementStack[-1]
+ return result
+
+ def setDocumentLocator(self, locator):
+ self._locator = locator
+
+ def startPrefixMapping(self, prefix, uri):
+ if not hasattr(self, '_xmlns_attrs'):
+ self._xmlns_attrs = []
+ self._xmlns_attrs.append((prefix or 'xmlns', uri))
+ self._ns_contexts.append(self._current_context.copy())
+ self._current_context[uri] = prefix or None
+
+ def endPrefixMapping(self, prefix):
+ self._current_context = self._ns_contexts.pop()
+
+ def startElementNS(self, name, tagName , attrs):
+ # Retrieve xml namespace declaration attributes.
+ xmlns_uri = 'http://www.w3.org/2000/xmlns/'
+ xmlns_attrs = getattr(self, '_xmlns_attrs', None)
+ if xmlns_attrs is not None:
+ for aname, value in xmlns_attrs:
+ attrs._attrs[(xmlns_uri, aname)] = value
+ self._xmlns_attrs = []
+ uri, localname = name
+ if uri:
+ # When using namespaces, the reader may or may not
+ # provide us with the original name. If not, create
+ # *a* valid tagName from the current context.
+ if tagName is None:
+ prefix = self._current_context[uri]
+ if prefix:
+ tagName = prefix + ":" + localname
+ else:
+ tagName = localname
+ if self.document:
+ node = self.document.createElementNS(uri, tagName)
+ else:
+ node = self.buildDocument(uri, tagName)
+ else:
+ # When the tagname is not prefixed, it just appears as
+ # localname
+ if self.document:
+ node = self.document.createElement(localname)
+ else:
+ node = self.buildDocument(None, localname)
+
+ for aname,value in attrs.items():
+ a_uri, a_localname = aname
+ if a_uri == xmlns_uri:
+ if a_localname == 'xmlns':
+ qname = a_localname
+ else:
+ qname = 'xmlns:' + a_localname
+ attr = self.document.createAttributeNS(a_uri, qname)
+ node.setAttributeNodeNS(attr)
+ elif a_uri:
+ prefix = self._current_context[a_uri]
+ if prefix:
+ qname = prefix + ":" + a_localname
+ else:
+ qname = a_localname
+ attr = self.document.createAttributeNS(a_uri, qname)
+ node.setAttributeNodeNS(attr)
+ else:
+ attr = self.document.createAttribute(a_localname)
+ node.setAttributeNode(attr)
+ attr.value = value
+
+ self.lastEvent[1] = [(START_ELEMENT, node), None]
+ self.lastEvent = self.lastEvent[1]
+ self.push(node)
+
+ def endElementNS(self, name, tagName):
+ self.lastEvent[1] = [(END_ELEMENT, self.pop()), None]
+ self.lastEvent = self.lastEvent[1]
+
+ def startElement(self, name, attrs):
+ if self.document:
+ node = self.document.createElement(name)
+ else:
+ node = self.buildDocument(None, name)
+
+ for aname,value in attrs.items():
+ attr = self.document.createAttribute(aname)
+ attr.value = value
+ node.setAttributeNode(attr)
+
+ self.lastEvent[1] = [(START_ELEMENT, node), None]
+ self.lastEvent = self.lastEvent[1]
+ self.push(node)
+
+ def endElement(self, name):
+ self.lastEvent[1] = [(END_ELEMENT, self.pop()), None]
+ self.lastEvent = self.lastEvent[1]
+
+ def comment(self, s):
+ if self.document:
+ node = self.document.createComment(s)
+ self.lastEvent[1] = [(COMMENT, node), None]
+ self.lastEvent = self.lastEvent[1]
+ else:
+ event = [(COMMENT, s), None]
+ self.pending_events.append(event)
+
+ def processingInstruction(self, target, data):
+ if self.document:
+ node = self.document.createProcessingInstruction(target, data)
+ self.lastEvent[1] = [(PROCESSING_INSTRUCTION, node), None]
+ self.lastEvent = self.lastEvent[1]
+ else:
+ event = [(PROCESSING_INSTRUCTION, target, data), None]
+ self.pending_events.append(event)
+
+ def ignorableWhitespace(self, chars):
+ node = self.document.createTextNode(chars)
+ self.lastEvent[1] = [(IGNORABLE_WHITESPACE, node), None]
+ self.lastEvent = self.lastEvent[1]
+
+ def characters(self, chars):
+ node = self.document.createTextNode(chars)
+ self.lastEvent[1] = [(CHARACTERS, node), None]
+ self.lastEvent = self.lastEvent[1]
+
+ def startDocument(self):
+ if self.documentFactory is None:
+ import xml.dom.minidom
+ self.documentFactory = xml.dom.minidom.Document.implementation
+
+ def buildDocument(self, uri, tagname):
+ # Can't do that in startDocument, since we need the tagname
+ # XXX: obtain DocumentType
+ node = self.documentFactory.createDocument(uri, tagname, None)
+ self.document = node
+ self.lastEvent[1] = [(START_DOCUMENT, node), None]
+ self.lastEvent = self.lastEvent[1]
+ self.push(node)
+ # Put everything we have seen so far into the document
+ for e in self.pending_events:
+ if e[0][0] == PROCESSING_INSTRUCTION:
+ _,target,data = e[0]
+ n = self.document.createProcessingInstruction(target, data)
+ e[0] = (PROCESSING_INSTRUCTION, n)
+ elif e[0][0] == COMMENT:
+ n = self.document.createComment(e[0][1])
+ e[0] = (COMMENT, n)
+ else:
+ raise AssertionError("Unknown pending event ",e[0][0])
+ self.lastEvent[1] = e
+ self.lastEvent = e
+ self.pending_events = None
+ return node.firstChild
+
+ def endDocument(self):
+ self.lastEvent[1] = [(END_DOCUMENT, self.document), None]
+ self.pop()
+
+ def clear(self):
+ "clear(): Explicitly release parsing structures"
+ self.document = None
+
+class ErrorHandler:
+ def warning(self, exception):
+ print exception
+ def error(self, exception):
+ raise exception
+ def fatalError(self, exception):
+ raise exception
+
+class DOMEventStream:
+ def __init__(self, stream, parser, bufsize):
+ self.stream = stream
+ self.parser = parser
+ self.bufsize = bufsize
+ if not hasattr(self.parser, 'feed'):
+ self.getEvent = self._slurp
+ self.reset()
+
+ def reset(self):
+ self.pulldom = PullDOM()
+ # This content handler relies on namespace support
+ self.parser.setFeature(xml.sax.handler.feature_namespaces, 1)
+ self.parser.setContentHandler(self.pulldom)
+
+ def __getitem__(self, pos):
+ rc = self.getEvent()
+ if rc:
+ return rc
+ raise IndexError
+
+ def next(self):
+ rc = self.getEvent()
+ if rc:
+ return rc
+ raise StopIteration
+
+ def __iter__(self):
+ return self
+
+ def expandNode(self, node):
+ event = self.getEvent()
+ parents = [node]
+ while event:
+ token, cur_node = event
+ if cur_node is node:
+ return
+ if token != END_ELEMENT:
+ parents[-1].appendChild(cur_node)
+ if token == START_ELEMENT:
+ parents.append(cur_node)
+ elif token == END_ELEMENT:
+ del parents[-1]
+ event = self.getEvent()
+
+ def getEvent(self):
+ # use IncrementalParser interface, so we get the desired
+ # pull effect
+ if not self.pulldom.firstEvent[1]:
+ self.pulldom.lastEvent = self.pulldom.firstEvent
+ while not self.pulldom.firstEvent[1]:
+ buf = self.stream.read(self.bufsize)
+ if not buf:
+ self.parser.close()
+ return None
+ self.parser.feed(buf)
+ rc = self.pulldom.firstEvent[1][0]
+ self.pulldom.firstEvent[1] = self.pulldom.firstEvent[1][1]
+ return rc
+
+ def _slurp(self):
+ """ Fallback replacement for getEvent() using the
+ standard SAX2 interface, which means we slurp the
+ SAX events into memory (no performance gain, but
+ we are compatible to all SAX parsers).
+ """
+ self.parser.parse(self.stream)
+ self.getEvent = self._emit
+ return self._emit()
+
+ def _emit(self):
+ """ Fallback replacement for getEvent() that emits
+ the events that _slurp() read previously.
+ """
+ rc = self.pulldom.firstEvent[1][0]
+ self.pulldom.firstEvent[1] = self.pulldom.firstEvent[1][1]
+ return rc
+
+ def clear(self):
+ """clear(): Explicitly release parsing objects"""
+ self.pulldom.clear()
+ del self.pulldom
+ self.parser = None
+ self.stream = None
+
+class SAX2DOM(PullDOM):
+
+ def startElementNS(self, name, tagName , attrs):
+ PullDOM.startElementNS(self, name, tagName, attrs)
+ curNode = self.elementStack[-1]
+ parentNode = self.elementStack[-2]
+ parentNode.appendChild(curNode)
+
+ def startElement(self, name, attrs):
+ PullDOM.startElement(self, name, attrs)
+ curNode = self.elementStack[-1]
+ parentNode = self.elementStack[-2]
+ parentNode.appendChild(curNode)
+
+ def processingInstruction(self, target, data):
+ PullDOM.processingInstruction(self, target, data)
+ node = self.lastEvent[0][1]
+ parentNode = self.elementStack[-1]
+ parentNode.appendChild(node)
+
+ def ignorableWhitespace(self, chars):
+ PullDOM.ignorableWhitespace(self, chars)
+ node = self.lastEvent[0][1]
+ parentNode = self.elementStack[-1]
+ parentNode.appendChild(node)
+
+ def characters(self, chars):
+ PullDOM.characters(self, chars)
+ node = self.lastEvent[0][1]
+ parentNode = self.elementStack[-1]
+ parentNode.appendChild(node)
+
+
+default_bufsize = (2 ** 14) - 20
+
+def parse(stream_or_string, parser=None, bufsize=None):
+ if bufsize is None:
+ bufsize = default_bufsize
+ if type(stream_or_string) in _StringTypes:
+ stream = open(stream_or_string)
+ else:
+ stream = stream_or_string
+ if not parser:
+ parser = xml.sax.make_parser()
+ return DOMEventStream(stream, parser, bufsize)
+
+def parseString(string, parser=None):
+ try:
+ from cStringIO import StringIO
+ except ImportError:
+ from StringIO import StringIO
+
+ bufsize = len(string)
+ buf = StringIO(string)
+ if not parser:
+ parser = xml.sax.make_parser()
+ return DOMEventStream(buf, parser, bufsize)
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
index 0000000000..c386b26929
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/xmlbuilder.py
@@ -0,0 +1,386 @@
+"""Implementation of the DOM Level 3 'LS-Load' feature."""
+
+import copy
+import xml.dom
+
+from xml.dom.NodeFilter import NodeFilter
+
+
+__all__ = ["DOMBuilder", "DOMEntityResolver", "DOMInputSource"]
+
+
+class Options:
+ """Features object that has variables set for each DOMBuilder feature.
+
+ The DOMBuilder class uses an instance of this class to pass settings to
+ the ExpatBuilder class.
+ """
+
+ # Note that the DOMBuilder class in LoadSave constrains which of these
+ # values can be set using the DOM Level 3 LoadSave feature.
+
+ namespaces = 1
+ namespace_declarations = True
+ validation = False
+ external_parameter_entities = True
+ external_general_entities = True
+ external_dtd_subset = True
+ validate_if_schema = False
+ validate = False
+ datatype_normalization = False
+ create_entity_ref_nodes = True
+ entities = True
+ whitespace_in_element_content = True
+ cdata_sections = True
+ comments = True
+ charset_overrides_xml_encoding = True
+ infoset = False
+ supported_mediatypes_only = False
+
+ errorHandler = None
+ filter = None
+
+
+class DOMBuilder:
+ entityResolver = None
+ errorHandler = None
+ filter = None
+
+ ACTION_REPLACE = 1
+ ACTION_APPEND_AS_CHILDREN = 2
+ ACTION_INSERT_AFTER = 3
+ ACTION_INSERT_BEFORE = 4
+
+ _legal_actions = (ACTION_REPLACE, ACTION_APPEND_AS_CHILDREN,
+ ACTION_INSERT_AFTER, ACTION_INSERT_BEFORE)
+
+ def __init__(self):
+ self._options = Options()
+
+ def _get_entityResolver(self):
+ return self.entityResolver
+ def _set_entityResolver(self, entityResolver):
+ self.entityResolver = entityResolver
+
+ def _get_errorHandler(self):
+ return self.errorHandler
+ def _set_errorHandler(self, errorHandler):
+ self.errorHandler = errorHandler
+
+ def _get_filter(self):
+ return self.filter
+ def _set_filter(self, filter):
+ self.filter = filter
+
+ def setFeature(self, name, state):
+ if self.supportsFeature(name):
+ state = state and 1 or 0
+ try:
+ settings = self._settings[(_name_xform(name), state)]
+ except KeyError:
+ raise xml.dom.NotSupportedErr(
+ "unsupported feature: %r" % (name,))
+ else:
+ for name, value in settings:
+ setattr(self._options, name, value)
+ else:
+ raise xml.dom.NotFoundErr("unknown feature: " + repr(name))
+
+ def supportsFeature(self, name):
+ return hasattr(self._options, _name_xform(name))
+
+ def canSetFeature(self, name, state):
+ key = (_name_xform(name), state and 1 or 0)
+ return key in self._settings
+
+ # This dictionary maps from (feature,value) to a list of
+ # (option,value) pairs that should be set on the Options object.
+ # If a (feature,value) setting is not in this dictionary, it is
+ # not supported by the DOMBuilder.
+ #
+ _settings = {
+ ("namespace_declarations", 0): [
+ ("namespace_declarations", 0)],
+ ("namespace_declarations", 1): [
+ ("namespace_declarations", 1)],
+ ("validation", 0): [
+ ("validation", 0)],
+ ("external_general_entities", 0): [
+ ("external_general_entities", 0)],
+ ("external_general_entities", 1): [
+ ("external_general_entities", 1)],
+ ("external_parameter_entities", 0): [
+ ("external_parameter_entities", 0)],
+ ("external_parameter_entities", 1): [
+ ("external_parameter_entities", 1)],
+ ("validate_if_schema", 0): [
+ ("validate_if_schema", 0)],
+ ("create_entity_ref_nodes", 0): [
+ ("create_entity_ref_nodes", 0)],
+ ("create_entity_ref_nodes", 1): [
+ ("create_entity_ref_nodes", 1)],
+ ("entities", 0): [
+ ("create_entity_ref_nodes", 0),
+ ("entities", 0)],
+ ("entities", 1): [
+ ("entities", 1)],
+ ("whitespace_in_element_content", 0): [
+ ("whitespace_in_element_content", 0)],
+ ("whitespace_in_element_content", 1): [
+ ("whitespace_in_element_content", 1)],
+ ("cdata_sections", 0): [
+ ("cdata_sections", 0)],
+ ("cdata_sections", 1): [
+ ("cdata_sections", 1)],
+ ("comments", 0): [
+ ("comments", 0)],
+ ("comments", 1): [
+ ("comments", 1)],
+ ("charset_overrides_xml_encoding", 0): [
+ ("charset_overrides_xml_encoding", 0)],
+ ("charset_overrides_xml_encoding", 1): [
+ ("charset_overrides_xml_encoding", 1)],
+ ("infoset", 0): [],
+ ("infoset", 1): [
+ ("namespace_declarations", 0),
+ ("validate_if_schema", 0),
+ ("create_entity_ref_nodes", 0),
+ ("entities", 0),
+ ("cdata_sections", 0),
+ ("datatype_normalization", 1),
+ ("whitespace_in_element_content", 1),
+ ("comments", 1),
+ ("charset_overrides_xml_encoding", 1)],
+ ("supported_mediatypes_only", 0): [
+ ("supported_mediatypes_only", 0)],
+ ("namespaces", 0): [
+ ("namespaces", 0)],
+ ("namespaces", 1): [
+ ("namespaces", 1)],
+ }
+
+ def getFeature(self, name):
+ xname = _name_xform(name)
+ try:
+ return getattr(self._options, xname)
+ except AttributeError:
+ if name == "infoset":
+ options = self._options
+ return (options.datatype_normalization
+ and options.whitespace_in_element_content
+ and options.comments
+ and options.charset_overrides_xml_encoding
+ and not (options.namespace_declarations
+ or options.validate_if_schema
+ or options.create_entity_ref_nodes
+ or options.entities
+ or options.cdata_sections))
+ raise xml.dom.NotFoundErr("feature %s not known" % repr(name))
+
+ def parseURI(self, uri):
+ if self.entityResolver:
+ input = self.entityResolver.resolveEntity(None, uri)
+ else:
+ input = DOMEntityResolver().resolveEntity(None, uri)
+ return self.parse(input)
+
+ def parse(self, input):
+ options = copy.copy(self._options)
+ options.filter = self.filter
+ options.errorHandler = self.errorHandler
+ fp = input.byteStream
+ if fp is None and options.systemId:
+ import urllib2
+ fp = urllib2.urlopen(input.systemId)
+ return self._parse_bytestream(fp, options)
+
+ def parseWithContext(self, input, cnode, action):
+ if action not in self._legal_actions:
+ raise ValueError("not a legal action")
+ raise NotImplementedError("Haven't written this yet...")
+
+ def _parse_bytestream(self, stream, options):
+ import xml.dom.expatbuilder
+ builder = xml.dom.expatbuilder.makeBuilder(options)
+ return builder.parseFile(stream)
+
+
+def _name_xform(name):
+ return name.lower().replace('-', '_')
+
+
+class DOMEntityResolver(object):
+ __slots__ = '_opener',
+
+ def resolveEntity(self, publicId, systemId):
+ assert systemId is not None
+ source = DOMInputSource()
+ source.publicId = publicId
+ source.systemId = systemId
+ source.byteStream = self._get_opener().open(systemId)
+
+ # determine the encoding if the transport provided it
+ source.encoding = self._guess_media_encoding(source)
+
+ # determine the base URI is we can
+ import posixpath, urlparse
+ parts = urlparse.urlparse(systemId)
+ scheme, netloc, path, params, query, fragment = parts
+ # XXX should we check the scheme here as well?
+ if path and not path.endswith("/"):
+ path = posixpath.dirname(path) + "/"
+ parts = scheme, netloc, path, params, query, fragment
+ source.baseURI = urlparse.urlunparse(parts)
+
+ return source
+
+ def _get_opener(self):
+ try:
+ return self._opener
+ except AttributeError:
+ self._opener = self._create_opener()
+ return self._opener
+
+ def _create_opener(self):
+ import urllib2
+ return urllib2.build_opener()
+
+ def _guess_media_encoding(self, source):
+ info = source.byteStream.info()
+ if "Content-Type" in info:
+ for param in info.getplist():
+ if param.startswith("charset="):
+ return param.split("=", 1)[1].lower()
+
+
+class DOMInputSource(object):
+ __slots__ = ('byteStream', 'characterStream', 'stringData',
+ 'encoding', 'publicId', 'systemId', 'baseURI')
+
+ def __init__(self):
+ self.byteStream = None
+ self.characterStream = None
+ self.stringData = None
+ self.encoding = None
+ self.publicId = None
+ self.systemId = None
+ self.baseURI = None
+
+ def _get_byteStream(self):
+ return self.byteStream
+ def _set_byteStream(self, byteStream):
+ self.byteStream = byteStream
+
+ def _get_characterStream(self):
+ return self.characterStream
+ def _set_characterStream(self, characterStream):
+ self.characterStream = characterStream
+
+ def _get_stringData(self):
+ return self.stringData
+ def _set_stringData(self, data):
+ self.stringData = data
+
+ def _get_encoding(self):
+ return self.encoding
+ def _set_encoding(self, encoding):
+ self.encoding = encoding
+
+ def _get_publicId(self):
+ return self.publicId
+ def _set_publicId(self, publicId):
+ self.publicId = publicId
+
+ def _get_systemId(self):
+ return self.systemId
+ def _set_systemId(self, systemId):
+ self.systemId = systemId
+
+ def _get_baseURI(self):
+ return self.baseURI
+ def _set_baseURI(self, uri):
+ self.baseURI = uri
+
+
+class DOMBuilderFilter:
+ """Element filter which can be used to tailor construction of
+ a DOM instance.
+ """
+
+ # There's really no need for this class; concrete implementations
+ # should just implement the endElement() and startElement()
+ # methods as appropriate. Using this makes it easy to only
+ # implement one of them.
+
+ FILTER_ACCEPT = 1
+ FILTER_REJECT = 2
+ FILTER_SKIP = 3
+ FILTER_INTERRUPT = 4
+
+ whatToShow = NodeFilter.SHOW_ALL
+
+ def _get_whatToShow(self):
+ return self.whatToShow
+
+ def acceptNode(self, element):
+ return self.FILTER_ACCEPT
+
+ def startContainer(self, element):
+ return self.FILTER_ACCEPT
+
+del NodeFilter
+
+
+class DocumentLS:
+ """Mixin to create documents that conform to the load/save spec."""
+
+ async = False
+
+ def _get_async(self):
+ return False
+ def _set_async(self, async):
+ if async:
+ raise xml.dom.NotSupportedErr(
+ "asynchronous document loading is not supported")
+
+ def abort(self):
+ # What does it mean to "clear" a document? Does the
+ # documentElement disappear?
+ raise NotImplementedError(
+ "haven't figured out what this means yet")
+
+ def load(self, uri):
+ raise NotImplementedError("haven't written this yet")
+
+ def loadXML(self, source):
+ raise NotImplementedError("haven't written this yet")
+
+ def saveXML(self, snode):
+ if snode is None:
+ snode = self
+ elif snode.ownerDocument is not self:
+ raise xml.dom.WrongDocumentErr()
+ return snode.toxml()
+
+
+class DOMImplementationLS:
+ MODE_SYNCHRONOUS = 1
+ MODE_ASYNCHRONOUS = 2
+
+ def createDOMBuilder(self, mode, schemaType):
+ if schemaType is not None:
+ raise xml.dom.NotSupportedErr(
+ "schemaType not yet supported")
+ if mode == self.MODE_SYNCHRONOUS:
+ return DOMBuilder()
+ if mode == self.MODE_ASYNCHRONOUS:
+ raise xml.dom.NotSupportedErr(
+ "asynchronous builders are not supported")
+ raise ValueError("unknown value for mode")
+
+ def createDOMWriter(self):
+ raise NotImplementedError(
+ "the writer interface hasn't been written yet!")
+
+ def createDOMInputSource(self):
+ return DOMInputSource()
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
index 0000000000..2bfac341ad
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementInclude.py
@@ -0,0 +1,142 @@
+#
+# ElementTree
+# $Id: ElementInclude.py 3375 2008-02-13 08:05:08Z fredrik $
+#
+# limited xinclude support for element trees
+#
+# history:
+# 2003-08-15 fl created
+# 2003-11-14 fl fixed default loader
+#
+# Copyright (c) 2003-2004 by Fredrik Lundh. All rights reserved.
+#
+# fredrik@pythonware.com
+# http://www.pythonware.com
+#
+# --------------------------------------------------------------------
+# The ElementTree toolkit is
+#
+# Copyright (c) 1999-2008 by Fredrik Lundh
+#
+# By obtaining, using, and/or copying this software and/or its
+# associated documentation, you agree that you have read, understood,
+# and will comply with the following terms and conditions:
+#
+# Permission to use, copy, modify, and distribute this software and
+# its associated documentation for any purpose and without fee is
+# hereby granted, provided that the above copyright notice appears in
+# all copies, and that both that copyright notice and this permission
+# notice appear in supporting documentation, and that the name of
+# Secret Labs AB or the author not be used in advertising or publicity
+# pertaining to distribution of the software without specific, written
+# prior permission.
+#
+# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
+# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
+# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
+# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+# --------------------------------------------------------------------
+
+# Licensed to PSF under a Contributor Agreement.
+# See http://www.python.org/psf/license for licensing details.
+
+##
+# Limited XInclude support for the ElementTree package.
+##
+
+import copy
+from . import ElementTree
+
+XINCLUDE = "{http://www.w3.org/2001/XInclude}"
+
+XINCLUDE_INCLUDE = XINCLUDE + "include"
+XINCLUDE_FALLBACK = XINCLUDE + "fallback"
+
+##
+# Fatal include error.
+
+class FatalIncludeError(SyntaxError):
+ pass
+
+##
+# Default loader. This loader reads an included resource from disk.
+#
+# @param href Resource reference.
+# @param parse Parse mode. Either "xml" or "text".
+# @param encoding Optional text encoding.
+# @return The expanded resource. If the parse mode is "xml", this
+# is an ElementTree instance. If the parse mode is "text", this
+# is a Unicode string. If the loader fails, it can return None
+# or raise an IOError exception.
+# @throws IOError If the loader fails to load the resource.
+
+def default_loader(href, parse, encoding=None):
+ with open(href) as file:
+ if parse == "xml":
+ data = ElementTree.parse(file).getroot()
+ else:
+ data = file.read()
+ if encoding:
+ data = data.decode(encoding)
+ return data
+
+##
+# Expand XInclude directives.
+#
+# @param elem Root element.
+# @param loader Optional resource loader. If omitted, it defaults
+# to {@link default_loader}. If given, it should be a callable
+# that implements the same interface as <b>default_loader</b>.
+# @throws FatalIncludeError If the function fails to include a given
+# resource, or if the tree contains malformed XInclude elements.
+# @throws IOError If the function fails to load a given resource.
+
+def include(elem, loader=None):
+ if loader is None:
+ loader = default_loader
+ # look for xinclude elements
+ i = 0
+ while i < len(elem):
+ e = elem[i]
+ if e.tag == XINCLUDE_INCLUDE:
+ # process xinclude directive
+ href = e.get("href")
+ parse = e.get("parse", "xml")
+ if parse == "xml":
+ node = loader(href, parse)
+ if node is None:
+ raise FatalIncludeError(
+ "cannot load %r as %r" % (href, parse)
+ )
+ node = copy.copy(node)
+ if e.tail:
+ node.tail = (node.tail or "") + e.tail
+ elem[i] = node
+ elif parse == "text":
+ text = loader(href, parse, e.get("encoding"))
+ if text is None:
+ raise FatalIncludeError(
+ "cannot load %r as %r" % (href, parse)
+ )
+ if i:
+ node = elem[i-1]
+ node.tail = (node.tail or "") + text + (e.tail or "")
+ else:
+ elem.text = (elem.text or "") + text + (e.tail or "")
+ del elem[i]
+ continue
+ else:
+ raise FatalIncludeError(
+ "unknown parse type in xi:include tag (%r)" % parse
+ )
+ elif e.tag == XINCLUDE_FALLBACK:
+ raise FatalIncludeError(
+ "xi:fallback tag must be child of xi:include (%r)" % e.tag
+ )
+ else:
+ include(e, loader)
+ i = i + 1
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
index 0000000000..5c117c3264
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementPath.py
@@ -0,0 +1,303 @@
+#
+# ElementTree
+# $Id: ElementPath.py 3375 2008-02-13 08:05:08Z fredrik $
+#
+# limited xpath support for element trees
+#
+# history:
+# 2003-05-23 fl created
+# 2003-05-28 fl added support for // etc
+# 2003-08-27 fl fixed parsing of periods in element names
+# 2007-09-10 fl new selection engine
+# 2007-09-12 fl fixed parent selector
+# 2007-09-13 fl added iterfind; changed findall to return a list
+# 2007-11-30 fl added namespaces support
+# 2009-10-30 fl added child element value filter
+#
+# Copyright (c) 2003-2009 by Fredrik Lundh. All rights reserved.
+#
+# fredrik@pythonware.com
+# http://www.pythonware.com
+#
+# --------------------------------------------------------------------
+# The ElementTree toolkit is
+#
+# Copyright (c) 1999-2009 by Fredrik Lundh
+#
+# By obtaining, using, and/or copying this software and/or its
+# associated documentation, you agree that you have read, understood,
+# and will comply with the following terms and conditions:
+#
+# Permission to use, copy, modify, and distribute this software and
+# its associated documentation for any purpose and without fee is
+# hereby granted, provided that the above copyright notice appears in
+# all copies, and that both that copyright notice and this permission
+# notice appear in supporting documentation, and that the name of
+# Secret Labs AB or the author not be used in advertising or publicity
+# pertaining to distribution of the software without specific, written
+# prior permission.
+#
+# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
+# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
+# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
+# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+# --------------------------------------------------------------------
+
+# Licensed to PSF under a Contributor Agreement.
+# See http://www.python.org/psf/license for licensing details.
+
+##
+# Implementation module for XPath support. There's usually no reason
+# to import this module directly; the <b>ElementTree</b> does this for
+# you, if needed.
+##
+
+import re
+
+xpath_tokenizer_re = re.compile(
+ "("
+ "'[^']*'|\"[^\"]*\"|"
+ "::|"
+ "//?|"
+ "\.\.|"
+ "\(\)|"
+ "[/.*:\[\]\(\)@=])|"
+ "((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|"
+ "\s+"
+ )
+
+def xpath_tokenizer(pattern, namespaces=None):
+ for token in xpath_tokenizer_re.findall(pattern):
+ tag = token[1]
+ if tag and tag[0] != "{" and ":" in tag:
+ try:
+ prefix, uri = tag.split(":", 1)
+ if not namespaces:
+ raise KeyError
+ yield token[0], "{%s}%s" % (namespaces[prefix], uri)
+ except KeyError:
+ raise SyntaxError("prefix %r not found in prefix map" % prefix)
+ else:
+ yield token
+
+def get_parent_map(context):
+ parent_map = context.parent_map
+ if parent_map is None:
+ context.parent_map = parent_map = {}
+ for p in context.root.iter():
+ for e in p:
+ parent_map[e] = p
+ return parent_map
+
+def prepare_child(next, token):
+ tag = token[1]
+ def select(context, result):
+ for elem in result:
+ for e in elem:
+ if e.tag == tag:
+ yield e
+ return select
+
+def prepare_star(next, token):
+ def select(context, result):
+ for elem in result:
+ for e in elem:
+ yield e
+ return select
+
+def prepare_self(next, token):
+ def select(context, result):
+ for elem in result:
+ yield elem
+ return select
+
+def prepare_descendant(next, token):
+ token = next()
+ if token[0] == "*":
+ tag = "*"
+ elif not token[0]:
+ tag = token[1]
+ else:
+ raise SyntaxError("invalid descendant")
+ def select(context, result):
+ for elem in result:
+ for e in elem.iter(tag):
+ if e is not elem:
+ yield e
+ return select
+
+def prepare_parent(next, token):
+ def select(context, result):
+ # FIXME: raise error if .. is applied at toplevel?
+ parent_map = get_parent_map(context)
+ result_map = {}
+ for elem in result:
+ if elem in parent_map:
+ parent = parent_map[elem]
+ if parent not in result_map:
+ result_map[parent] = None
+ yield parent
+ return select
+
+def prepare_predicate(next, token):
+ # FIXME: replace with real parser!!! refs:
+ # http://effbot.org/zone/simple-iterator-parser.htm
+ # http://javascript.crockford.com/tdop/tdop.html
+ signature = []
+ predicate = []
+ while 1:
+ token = next()
+ if token[0] == "]":
+ break
+ if token[0] and token[0][:1] in "'\"":
+ token = "'", token[0][1:-1]
+ signature.append(token[0] or "-")
+ predicate.append(token[1])
+ signature = "".join(signature)
+ # use signature to determine predicate type
+ if signature == "@-":
+ # [@attribute] predicate
+ key = predicate[1]
+ def select(context, result):
+ for elem in result:
+ if elem.get(key) is not None:
+ yield elem
+ return select
+ if signature == "@-='":
+ # [@attribute='value']
+ key = predicate[1]
+ value = predicate[-1]
+ def select(context, result):
+ for elem in result:
+ if elem.get(key) == value:
+ yield elem
+ return select
+ if signature == "-" and not re.match("\d+$", predicate[0]):
+ # [tag]
+ tag = predicate[0]
+ def select(context, result):
+ for elem in result:
+ if elem.find(tag) is not None:
+ yield elem
+ return select
+ if signature == "-='" and not re.match("\d+$", predicate[0]):
+ # [tag='value']
+ tag = predicate[0]
+ value = predicate[-1]
+ def select(context, result):
+ for elem in result:
+ for e in elem.findall(tag):
+ if "".join(e.itertext()) == value:
+ yield elem
+ break
+ return select
+ if signature == "-" or signature == "-()" or signature == "-()-":
+ # [index] or [last()] or [last()-index]
+ if signature == "-":
+ index = int(predicate[0]) - 1
+ else:
+ if predicate[0] != "last":
+ raise SyntaxError("unsupported function")
+ if signature == "-()-":
+ try:
+ index = int(predicate[2]) - 1
+ except ValueError:
+ raise SyntaxError("unsupported expression")
+ else:
+ index = -1
+ def select(context, result):
+ parent_map = get_parent_map(context)
+ for elem in result:
+ try:
+ parent = parent_map[elem]
+ # FIXME: what if the selector is "*" ?
+ elems = list(parent.findall(elem.tag))
+ if elems[index] is elem:
+ yield elem
+ except (IndexError, KeyError):
+ pass
+ return select
+ raise SyntaxError("invalid predicate")
+
+ops = {
+ "": prepare_child,
+ "*": prepare_star,
+ ".": prepare_self,
+ "..": prepare_parent,
+ "//": prepare_descendant,
+ "[": prepare_predicate,
+ }
+
+_cache = {}
+
+class _SelectorContext:
+ parent_map = None
+ def __init__(self, root):
+ self.root = root
+
+# --------------------------------------------------------------------
+
+##
+# Generate all matching objects.
+
+def iterfind(elem, path, namespaces=None):
+ # compile selector pattern
+ if path[-1:] == "/":
+ path = path + "*" # implicit all (FIXME: keep this?)
+ try:
+ selector = _cache[path]
+ except KeyError:
+ if len(_cache) > 100:
+ _cache.clear()
+ if path[:1] == "/":
+ raise SyntaxError("cannot use absolute path on element")
+ next = iter(xpath_tokenizer(path, namespaces)).next
+ token = next()
+ selector = []
+ while 1:
+ try:
+ selector.append(ops[token[0]](next, token))
+ except StopIteration:
+ raise SyntaxError("invalid path")
+ try:
+ token = next()
+ if token[0] == "/":
+ token = next()
+ except StopIteration:
+ break
+ _cache[path] = selector
+ # execute selector pattern
+ result = [elem]
+ context = _SelectorContext(elem)
+ for select in selector:
+ result = select(context, result)
+ return result
+
+##
+# Find first matching object.
+
+def find(elem, path, namespaces=None):
+ try:
+ return iterfind(elem, path, namespaces).next()
+ except StopIteration:
+ return None
+
+##
+# Find all matching objects.
+
+def findall(elem, path, namespaces=None):
+ return list(iterfind(elem, path, namespaces))
+
+##
+# Find text for first matching object.
+
+def findtext(elem, path, default=None, namespaces=None):
+ try:
+ elem = iterfind(elem, path, namespaces).next()
+ return elem.text or ""
+ except StopIteration:
+ return default
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
index 0000000000..7ae11bc2f8
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementTree.py
@@ -0,0 +1,1667 @@
+#
+# ElementTree
+# $Id: ElementTree.py 3440 2008-07-18 14:45:01Z fredrik $
+#
+# light-weight XML support for Python 2.3 and later.
+#
+# history (since 1.2.6):
+# 2005-11-12 fl added tostringlist/fromstringlist helpers
+# 2006-07-05 fl merged in selected changes from the 1.3 sandbox
+# 2006-07-05 fl removed support for 2.1 and earlier
+# 2007-06-21 fl added deprecation/future warnings
+# 2007-08-25 fl added doctype hook, added parser version attribute etc
+# 2007-08-26 fl added new serializer code (better namespace handling, etc)
+# 2007-08-27 fl warn for broken /tag searches on tree level
+# 2007-09-02 fl added html/text methods to serializer (experimental)
+# 2007-09-05 fl added method argument to tostring/tostringlist
+# 2007-09-06 fl improved error handling
+# 2007-09-13 fl added itertext, iterfind; assorted cleanups
+# 2007-12-15 fl added C14N hooks, copy method (experimental)
+#
+# Copyright (c) 1999-2008 by Fredrik Lundh. All rights reserved.
+#
+# fredrik@pythonware.com
+# http://www.pythonware.com
+#
+# --------------------------------------------------------------------
+# The ElementTree toolkit is
+#
+# Copyright (c) 1999-2008 by Fredrik Lundh
+#
+# By obtaining, using, and/or copying this software and/or its
+# associated documentation, you agree that you have read, understood,
+# and will comply with the following terms and conditions:
+#
+# Permission to use, copy, modify, and distribute this software and
+# its associated documentation for any purpose and without fee is
+# hereby granted, provided that the above copyright notice appears in
+# all copies, and that both that copyright notice and this permission
+# notice appear in supporting documentation, and that the name of
+# Secret Labs AB or the author not be used in advertising or publicity
+# pertaining to distribution of the software without specific, written
+# prior permission.
+#
+# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
+# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
+# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
+# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+# --------------------------------------------------------------------
+
+# Licensed to PSF under a Contributor Agreement.
+# See http://www.python.org/psf/license for licensing details.
+
+__all__ = [
+ # public symbols
+ "Comment",
+ "dump",
+ "Element", "ElementTree",
+ "fromstring", "fromstringlist",
+ "iselement", "iterparse",
+ "parse", "ParseError",
+ "PI", "ProcessingInstruction",
+ "QName",
+ "SubElement",
+ "tostring", "tostringlist",
+ "TreeBuilder",
+ "VERSION",
+ "XML",
+ "XMLParser", "XMLTreeBuilder",
+ ]
+
+VERSION = "1.3.0"
+
+##
+# The <b>Element</b> type is a flexible container object, designed to
+# store hierarchical data structures in memory. The type can be
+# described as a cross between a list and a dictionary.
+# <p>
+# Each element has a number of properties associated with it:
+# <ul>
+# <li>a <i>tag</i>. This is a string identifying what kind of data
+# this element represents (the element type, in other words).</li>
+# <li>a number of <i>attributes</i>, stored in a Python dictionary.</li>
+# <li>a <i>text</i> string.</li>
+# <li>an optional <i>tail</i> string.</li>
+# <li>a number of <i>child elements</i>, stored in a Python sequence</li>
+# </ul>
+#
+# To create an element instance, use the {@link #Element} constructor
+# or the {@link #SubElement} factory function.
+# <p>
+# The {@link #ElementTree} class can be used to wrap an element
+# structure, and convert it from and to XML.
+##
+
+import sys
+import re
+import warnings
+
+
+class _SimpleElementPath(object):
+ # emulate pre-1.2 find/findtext/findall behaviour
+ def find(self, element, tag, namespaces=None):
+ for elem in element:
+ if elem.tag == tag:
+ return elem
+ return None
+ def findtext(self, element, tag, default=None, namespaces=None):
+ elem = self.find(element, tag)
+ if elem is None:
+ return default
+ return elem.text or ""
+ def iterfind(self, element, tag, namespaces=None):
+ if tag[:3] == ".//":
+ for elem in element.iter(tag[3:]):
+ yield elem
+ for elem in element:
+ if elem.tag == tag:
+ yield elem
+ def findall(self, element, tag, namespaces=None):
+ return list(self.iterfind(element, tag, namespaces))
+
+try:
+ from . import ElementPath
+except ImportError:
+ ElementPath = _SimpleElementPath()
+
+##
+# Parser error. This is a subclass of <b>SyntaxError</b>.
+# <p>
+# In addition to the exception value, an exception instance contains a
+# specific exception code in the <b>code</b> attribute, and the line and
+# column of the error in the <b>position</b> attribute.
+
+class ParseError(SyntaxError):
+ pass
+
+# --------------------------------------------------------------------
+
+##
+# Checks if an object appears to be a valid element object.
+#
+# @param An element instance.
+# @return A true value if this is an element object.
+# @defreturn flag
+
+def iselement(element):
+ # FIXME: not sure about this; might be a better idea to look
+ # for tag/attrib/text attributes
+ return isinstance(element, Element) or hasattr(element, "tag")
+
+##
+# Element class. This class defines the Element interface, and
+# provides a reference implementation of this interface.
+# <p>
+# The element name, attribute names, and attribute values can be
+# either ASCII strings (ordinary Python strings containing only 7-bit
+# ASCII characters) or Unicode strings.
+#
+# @param tag The element name.
+# @param attrib An optional dictionary, containing element attributes.
+# @param **extra Additional attributes, given as keyword arguments.
+# @see Element
+# @see SubElement
+# @see Comment
+# @see ProcessingInstruction
+
+class Element(object):
+ # <tag attrib>text<child/>...</tag>tail
+
+ ##
+ # (Attribute) Element tag.
+
+ tag = None
+
+ ##
+ # (Attribute) Element attribute dictionary. Where possible, use
+ # {@link #Element.get},
+ # {@link #Element.set},
+ # {@link #Element.keys}, and
+ # {@link #Element.items} to access
+ # element attributes.
+
+ attrib = None
+
+ ##
+ # (Attribute) Text before first subelement. This is either a
+ # string or the value None. Note that if there was no text, this
+ # attribute may be either None or an empty string, depending on
+ # the parser.
+
+ text = None
+
+ ##
+ # (Attribute) Text after this element's end tag, but before the
+ # next sibling element's start tag. This is either a string or
+ # the value None. Note that if there was no text, this attribute
+ # may be either None or an empty string, depending on the parser.
+
+ tail = None # text after end tag, if any
+
+ # constructor
+
+ def __init__(self, tag, attrib={}, **extra):
+ attrib = attrib.copy()
+ attrib.update(extra)
+ self.tag = tag
+ self.attrib = attrib
+ self._children = []
+
+ def __repr__(self):
+ return "<Element %s at 0x%x>" % (repr(self.tag), id(self))
+
+ ##
+ # Creates a new element object of the same type as this element.
+ #
+ # @param tag Element tag.
+ # @param attrib Element attributes, given as a dictionary.
+ # @return A new element instance.
+
+ def makeelement(self, tag, attrib):
+ return self.__class__(tag, attrib)
+
+ ##
+ # (Experimental) Copies the current element. This creates a
+ # shallow copy; subelements will be shared with the original tree.
+ #
+ # @return A new element instance.
+
+ def copy(self):
+ elem = self.makeelement(self.tag, self.attrib)
+ elem.text = self.text
+ elem.tail = self.tail
+ elem[:] = self
+ return elem
+
+ ##
+ # Returns the number of subelements. Note that this only counts
+ # full elements; to check if there's any content in an element, you
+ # have to check both the length and the <b>text</b> attribute.
+ #
+ # @return The number of subelements.
+
+ def __len__(self):
+ return len(self._children)
+
+ def __nonzero__(self):
+ warnings.warn(
+ "The behavior of this method will change in future versions. "
+ "Use specific 'len(elem)' or 'elem is not None' test instead.",
+ FutureWarning, stacklevel=2
+ )
+ return len(self._children) != 0 # emulate old behaviour, for now
+
+ ##
+ # Returns the given subelement, by index.
+ #
+ # @param index What subelement to return.
+ # @return The given subelement.
+ # @exception IndexError If the given element does not exist.
+
+ def __getitem__(self, index):
+ return self._children[index]
+
+ ##
+ # Replaces the given subelement, by index.
+ #
+ # @param index What subelement to replace.
+ # @param element The new element value.
+ # @exception IndexError If the given element does not exist.
+
+ def __setitem__(self, index, element):
+ # if isinstance(index, slice):
+ # for elt in element:
+ # assert iselement(elt)
+ # else:
+ # assert iselement(element)
+ self._children[index] = element
+
+ ##
+ # Deletes the given subelement, by index.
+ #
+ # @param index What subelement to delete.
+ # @exception IndexError If the given element does not exist.
+
+ def __delitem__(self, index):
+ del self._children[index]
+
+ ##
+ # Adds a subelement to the end of this element. In document order,
+ # the new element will appear after the last existing subelement (or
+ # directly after the text, if it's the first subelement), but before
+ # the end tag for this element.
+ #
+ # @param element The element to add.
+
+ def append(self, element):
+ # assert iselement(element)
+ self._children.append(element)
+
+ ##
+ # Appends subelements from a sequence.
+ #
+ # @param elements A sequence object with zero or more elements.
+ # @since 1.3
+
+ def extend(self, elements):
+ # for element in elements:
+ # assert iselement(element)
+ self._children.extend(elements)
+
+ ##
+ # Inserts a subelement at the given position in this element.
+ #
+ # @param index Where to insert the new subelement.
+
+ def insert(self, index, element):
+ # assert iselement(element)
+ self._children.insert(index, element)
+
+ ##
+ # Removes a matching subelement. Unlike the <b>find</b> methods,
+ # this method compares elements based on identity, not on tag
+ # value or contents. To remove subelements by other means, the
+ # easiest way is often to use a list comprehension to select what
+ # elements to keep, and use slice assignment to update the parent
+ # element.
+ #
+ # @param element What element to remove.
+ # @exception ValueError If a matching element could not be found.
+
+ def remove(self, element):
+ # assert iselement(element)
+ self._children.remove(element)
+
+ ##
+ # (Deprecated) Returns all subelements. The elements are returned
+ # in document order.
+ #
+ # @return A list of subelements.
+ # @defreturn list of Element instances
+
+ def getchildren(self):
+ warnings.warn(
+ "This method will be removed in future versions. "
+ "Use 'list(elem)' or iteration over elem instead.",
+ DeprecationWarning, stacklevel=2
+ )
+ return self._children
+
+ ##
+ # Finds the first matching subelement, by tag name or path.
+ #
+ # @param path What element to look for.
+ # @keyparam namespaces Optional namespace prefix map.
+ # @return The first matching element, or None if no element was found.
+ # @defreturn Element or None
+
+ def find(self, path, namespaces=None):
+ return ElementPath.find(self, path, namespaces)
+
+ ##
+ # Finds text for the first matching subelement, by tag name or path.
+ #
+ # @param path What element to look for.
+ # @param default What to return if the element was not found.
+ # @keyparam namespaces Optional namespace prefix map.
+ # @return The text content of the first matching element, or the
+ # default value no element was found. Note that if the element
+ # is found, but has no text content, this method returns an
+ # empty string.
+ # @defreturn string
+
+ def findtext(self, path, default=None, namespaces=None):
+ return ElementPath.findtext(self, path, default, namespaces)
+
+ ##
+ # Finds all matching subelements, by tag name or path.
+ #
+ # @param path What element to look for.
+ # @keyparam namespaces Optional namespace prefix map.
+ # @return A list or other sequence containing all matching elements,
+ # in document order.
+ # @defreturn list of Element instances
+
+ def findall(self, path, namespaces=None):
+ return ElementPath.findall(self, path, namespaces)
+
+ ##
+ # Finds all matching subelements, by tag name or path.
+ #
+ # @param path What element to look for.
+ # @keyparam namespaces Optional namespace prefix map.
+ # @return An iterator or sequence containing all matching elements,
+ # in document order.
+ # @defreturn a generated sequence of Element instances
+
+ def iterfind(self, path, namespaces=None):
+ return ElementPath.iterfind(self, path, namespaces)
+
+ ##
+ # Resets an element. This function removes all subelements, clears
+ # all attributes, and sets the <b>text</b> and <b>tail</b> attributes
+ # to None.
+
+ def clear(self):
+ self.attrib.clear()
+ self._children = []
+ self.text = self.tail = None
+
+ ##
+ # Gets an element attribute. Equivalent to <b>attrib.get</b>, but
+ # some implementations may handle this a bit more efficiently.
+ #
+ # @param key What attribute to look for.
+ # @param default What to return if the attribute was not found.
+ # @return The attribute value, or the default value, if the
+ # attribute was not found.
+ # @defreturn string or None
+
+ def get(self, key, default=None):
+ return self.attrib.get(key, default)
+
+ ##
+ # Sets an element attribute. Equivalent to <b>attrib[key] = value</b>,
+ # but some implementations may handle this a bit more efficiently.
+ #
+ # @param key What attribute to set.
+ # @param value The attribute value.
+
+ def set(self, key, value):
+ self.attrib[key] = value
+
+ ##
+ # Gets a list of attribute names. The names are returned in an
+ # arbitrary order (just like for an ordinary Python dictionary).
+ # Equivalent to <b>attrib.keys()</b>.
+ #
+ # @return A list of element attribute names.
+ # @defreturn list of strings
+
+ def keys(self):
+ return self.attrib.keys()
+
+ ##
+ # Gets element attributes, as a sequence. The attributes are
+ # returned in an arbitrary order. Equivalent to <b>attrib.items()</b>.
+ #
+ # @return A list of (name, value) tuples for all attributes.
+ # @defreturn list of (string, string) tuples
+
+ def items(self):
+ return self.attrib.items()
+
+ ##
+ # Creates a tree iterator. The iterator loops over this element
+ # and all subelements, in document order, and returns all elements
+ # with a matching tag.
+ # <p>
+ # If the tree structure is modified during iteration, new or removed
+ # elements may or may not be included. To get a stable set, use the
+ # list() function on the iterator, and loop over the resulting list.
+ #
+ # @param tag What tags to look for (default is to return all elements).
+ # @return An iterator containing all the matching elements.
+ # @defreturn iterator
+
+ def iter(self, tag=None):
+ if tag == "*":
+ tag = None
+ if tag is None or self.tag == tag:
+ yield self
+ for e in self._children:
+ for e in e.iter(tag):
+ yield e
+
+ # compatibility
+ def getiterator(self, tag=None):
+ # Change for a DeprecationWarning in 1.4
+ warnings.warn(
+ "This method will be removed in future versions. "
+ "Use 'elem.iter()' or 'list(elem.iter())' instead.",
+ PendingDeprecationWarning, stacklevel=2
+ )
+ return list(self.iter(tag))
+
+ ##
+ # Creates a text iterator. The iterator loops over this element
+ # and all subelements, in document order, and returns all inner
+ # text.
+ #
+ # @return An iterator containing all inner text.
+ # @defreturn iterator
+
+ def itertext(self):
+ tag = self.tag
+ if not isinstance(tag, basestring) and tag is not None:
+ return
+ if self.text:
+ yield self.text
+ for e in self:
+ for s in e.itertext():
+ yield s
+ if e.tail:
+ yield e.tail
+
+# compatibility
+_Element = _ElementInterface = Element
+
+##
+# Subelement factory. This function creates an element instance, and
+# appends it to an existing element.
+# <p>
+# The element name, attribute names, and attribute values can be
+# either 8-bit ASCII strings or Unicode strings.
+#
+# @param parent The parent element.
+# @param tag The subelement name.
+# @param attrib An optional dictionary, containing element attributes.
+# @param **extra Additional attributes, given as keyword arguments.
+# @return An element instance.
+# @defreturn Element
+
+def SubElement(parent, tag, attrib={}, **extra):
+ attrib = attrib.copy()
+ attrib.update(extra)
+ element = parent.makeelement(tag, attrib)
+ parent.append(element)
+ return element
+
+##
+# Comment element factory. This factory function creates a special
+# element that will be serialized as an XML comment by the standard
+# serializer.
+# <p>
+# The comment string can be either an 8-bit ASCII string or a Unicode
+# string.
+#
+# @param text A string containing the comment string.
+# @return An element instance, representing a comment.
+# @defreturn Element
+
+def Comment(text=None):
+ element = Element(Comment)
+ element.text = text
+ return element
+
+##
+# PI element factory. This factory function creates a special element
+# that will be serialized as an XML processing instruction by the standard
+# serializer.
+#
+# @param target A string containing the PI target.
+# @param text A string containing the PI contents, if any.
+# @return An element instance, representing a PI.
+# @defreturn Element
+
+def ProcessingInstruction(target, text=None):
+ element = Element(ProcessingInstruction)
+ element.text = target
+ if text:
+ element.text = element.text + " " + text
+ return element
+
+PI = ProcessingInstruction
+
+##
+# QName wrapper. This can be used to wrap a QName attribute value, in
+# order to get proper namespace handling on output.
+#
+# @param text A string containing the QName value, in the form {uri}local,
+# or, if the tag argument is given, the URI part of a QName.
+# @param tag Optional tag. If given, the first argument is interpreted as
+# an URI, and this argument is interpreted as a local name.
+# @return An opaque object, representing the QName.
+
+class QName(object):
+ def __init__(self, text_or_uri, tag=None):
+ if tag:
+ text_or_uri = "{%s}%s" % (text_or_uri, tag)
+ self.text = text_or_uri
+ def __str__(self):
+ return self.text
+ def __hash__(self):
+ return hash(self.text)
+ def __cmp__(self, other):
+ if isinstance(other, QName):
+ return cmp(self.text, other.text)
+ return cmp(self.text, other)
+
+# --------------------------------------------------------------------
+
+##
+# ElementTree wrapper class. This class represents an entire element
+# hierarchy, and adds some extra support for serialization to and from
+# standard XML.
+#
+# @param element Optional root element.
+# @keyparam file Optional file handle or file name. If given, the
+# tree is initialized with the contents of this XML file.
+
+class ElementTree(object):
+
+ def __init__(self, element=None, file=None):
+ # assert element is None or iselement(element)
+ self._root = element # first node
+ if file:
+ self.parse(file)
+
+ ##
+ # Gets the root element for this tree.
+ #
+ # @return An element instance.
+ # @defreturn Element
+
+ def getroot(self):
+ return self._root
+
+ ##
+ # Replaces the root element for this tree. This discards the
+ # current contents of the tree, and replaces it with the given
+ # element. Use with care.
+ #
+ # @param element An element instance.
+
+ def _setroot(self, element):
+ # assert iselement(element)
+ self._root = element
+
+ ##
+ # Loads an external XML document into this element tree.
+ #
+ # @param source A file name or file object. If a file object is
+ # given, it only has to implement a <b>read(n)</b> method.
+ # @keyparam parser An optional parser instance. If not given, the
+ # standard {@link XMLParser} parser is used.
+ # @return The document root element.
+ # @defreturn Element
+ # @exception ParseError If the parser fails to parse the document.
+
+ def parse(self, source, parser=None):
+ close_source = False
+ if not hasattr(source, "read"):
+ source = open(source, "rb")
+ close_source = True
+ try:
+ if not parser:
+ parser = XMLParser(target=TreeBuilder())
+ while 1:
+ data = source.read(65536)
+ if not data:
+ break
+ parser.feed(data)
+ self._root = parser.close()
+ return self._root
+ finally:
+ if close_source:
+ source.close()
+
+ ##
+ # Creates a tree iterator for the root element. The iterator loops
+ # over all elements in this tree, in document order.
+ #
+ # @param tag What tags to look for (default is to return all elements)
+ # @return An iterator.
+ # @defreturn iterator
+
+ def iter(self, tag=None):
+ # assert self._root is not None
+ return self._root.iter(tag)
+
+ # compatibility
+ def getiterator(self, tag=None):
+ # Change for a DeprecationWarning in 1.4
+ warnings.warn(
+ "This method will be removed in future versions. "
+ "Use 'tree.iter()' or 'list(tree.iter())' instead.",
+ PendingDeprecationWarning, stacklevel=2
+ )
+ return list(self.iter(tag))
+
+ ##
+ # Same as getroot().find(path), starting at the root of the
+ # tree.
+ #
+ # @param path What element to look for.
+ # @keyparam namespaces Optional namespace prefix map.
+ # @return The first matching element, or None if no element was found.
+ # @defreturn Element or None
+
+ def find(self, path, namespaces=None):
+ # assert self._root is not None
+ if path[:1] == "/":
+ path = "." + path
+ warnings.warn(
+ "This search is broken in 1.3 and earlier, and will be "
+ "fixed in a future version. If you rely on the current "
+ "behaviour, change it to %r" % path,
+ FutureWarning, stacklevel=2
+ )
+ return self._root.find(path, namespaces)
+
+ ##
+ # Same as getroot().findtext(path), starting at the root of the tree.
+ #
+ # @param path What element to look for.
+ # @param default What to return if the element was not found.
+ # @keyparam namespaces Optional namespace prefix map.
+ # @return The text content of the first matching element, or the
+ # default value no element was found. Note that if the element
+ # is found, but has no text content, this method returns an
+ # empty string.
+ # @defreturn string
+
+ def findtext(self, path, default=None, namespaces=None):
+ # assert self._root is not None
+ if path[:1] == "/":
+ path = "." + path
+ warnings.warn(
+ "This search is broken in 1.3 and earlier, and will be "
+ "fixed in a future version. If you rely on the current "
+ "behaviour, change it to %r" % path,
+ FutureWarning, stacklevel=2
+ )
+ return self._root.findtext(path, default, namespaces)
+
+ ##
+ # Same as getroot().findall(path), starting at the root of the tree.
+ #
+ # @param path What element to look for.
+ # @keyparam namespaces Optional namespace prefix map.
+ # @return A list or iterator containing all matching elements,
+ # in document order.
+ # @defreturn list of Element instances
+
+ def findall(self, path, namespaces=None):
+ # assert self._root is not None
+ if path[:1] == "/":
+ path = "." + path
+ warnings.warn(
+ "This search is broken in 1.3 and earlier, and will be "
+ "fixed in a future version. If you rely on the current "
+ "behaviour, change it to %r" % path,
+ FutureWarning, stacklevel=2
+ )
+ return self._root.findall(path, namespaces)
+
+ ##
+ # Finds all matching subelements, by tag name or path.
+ # Same as getroot().iterfind(path).
+ #
+ # @param path What element to look for.
+ # @keyparam namespaces Optional namespace prefix map.
+ # @return An iterator or sequence containing all matching elements,
+ # in document order.
+ # @defreturn a generated sequence of Element instances
+
+ def iterfind(self, path, namespaces=None):
+ # assert self._root is not None
+ if path[:1] == "/":
+ path = "." + path
+ warnings.warn(
+ "This search is broken in 1.3 and earlier, and will be "
+ "fixed in a future version. If you rely on the current "
+ "behaviour, change it to %r" % path,
+ FutureWarning, stacklevel=2
+ )
+ return self._root.iterfind(path, namespaces)
+
+ ##
+ # Writes the element tree to a file, as XML.
+ #
+ # @def write(file, **options)
+ # @param file A file name, or a file object opened for writing.
+ # @param **options Options, given as keyword arguments.
+ # @keyparam encoding Optional output encoding (default is US-ASCII).
+ # @keyparam xml_declaration Controls if an XML declaration should
+ # be added to the file. Use False for never, True for always,
+ # None for only if not US-ASCII or UTF-8. None is default.
+ # @keyparam default_namespace Sets the default XML namespace (for "xmlns").
+ # @keyparam method Optional output method ("xml", "html", "text" or
+ # "c14n"; default is "xml").
+
+ def write(self, file_or_filename,
+ # keyword arguments
+ encoding=None,
+ xml_declaration=None,
+ default_namespace=None,
+ method=None):
+ # assert self._root is not None
+ if not method:
+ method = "xml"
+ elif method not in _serialize:
+ # FIXME: raise an ImportError for c14n if ElementC14N is missing?
+ raise ValueError("unknown method %r" % method)
+ if hasattr(file_or_filename, "write"):
+ file = file_or_filename
+ else:
+ file = open(file_or_filename, "wb")
+ write = file.write
+ if not encoding:
+ if method == "c14n":
+ encoding = "utf-8"
+ else:
+ encoding = "us-ascii"
+ elif xml_declaration or (xml_declaration is None and
+ encoding not in ("utf-8", "us-ascii")):
+ if method == "xml":
+ write("<?xml version='1.0' encoding='%s'?>\n" % encoding)
+ if method == "text":
+ _serialize_text(write, self._root, encoding)
+ else:
+ qnames, namespaces = _namespaces(
+ self._root, encoding, default_namespace
+ )
+ serialize = _serialize[method]
+ serialize(write, self._root, encoding, qnames, namespaces)
+ if file_or_filename is not file:
+ file.close()
+
+ def write_c14n(self, file):
+ # lxml.etree compatibility. use output method instead
+ return self.write(file, method="c14n")
+
+# --------------------------------------------------------------------
+# serialization support
+
+def _namespaces(elem, encoding, default_namespace=None):
+ # identify namespaces used in this tree
+
+ # maps qnames to *encoded* prefix:local names
+ qnames = {None: None}
+
+ # maps uri:s to prefixes
+ namespaces = {}
+ if default_namespace:
+ namespaces[default_namespace] = ""
+
+ def encode(text):
+ return text.encode(encoding)
+
+ def add_qname(qname):
+ # calculate serialized qname representation
+ try:
+ if qname[:1] == "{":
+ uri, tag = qname[1:].rsplit("}", 1)
+ prefix = namespaces.get(uri)
+ if prefix is None:
+ prefix = _namespace_map.get(uri)
+ if prefix is None:
+ prefix = "ns%d" % len(namespaces)
+ if prefix != "xml":
+ namespaces[uri] = prefix
+ if prefix:
+ qnames[qname] = encode("%s:%s" % (prefix, tag))
+ else:
+ qnames[qname] = encode(tag) # default element
+ else:
+ if default_namespace:
+ # FIXME: can this be handled in XML 1.0?
+ raise ValueError(
+ "cannot use non-qualified names with "
+ "default_namespace option"
+ )
+ qnames[qname] = encode(qname)
+ except TypeError:
+ _raise_serialization_error(qname)
+
+ # populate qname and namespaces table
+ try:
+ iterate = elem.iter
+ except AttributeError:
+ iterate = elem.getiterator # cET compatibility
+ for elem in iterate():
+ tag = elem.tag
+ if isinstance(tag, QName):
+ if tag.text not in qnames:
+ add_qname(tag.text)
+ elif isinstance(tag, basestring):
+ if tag not in qnames:
+ add_qname(tag)
+ elif tag is not None and tag is not Comment and tag is not PI:
+ _raise_serialization_error(tag)
+ for key, value in elem.items():
+ if isinstance(key, QName):
+ key = key.text
+ if key not in qnames:
+ add_qname(key)
+ if isinstance(value, QName) and value.text not in qnames:
+ add_qname(value.text)
+ text = elem.text
+ if isinstance(text, QName) and text.text not in qnames:
+ add_qname(text.text)
+ return qnames, namespaces
+
+def _serialize_xml(write, elem, encoding, qnames, namespaces):
+ tag = elem.tag
+ text = elem.text
+ if tag is Comment:
+ write("<!--%s-->" % _encode(text, encoding))
+ elif tag is ProcessingInstruction:
+ write("<?%s?>" % _encode(text, encoding))
+ else:
+ tag = qnames[tag]
+ if tag is None:
+ if text:
+ write(_escape_cdata(text, encoding))
+ for e in elem:
+ _serialize_xml(write, e, encoding, qnames, None)
+ else:
+ write("<" + tag)
+ items = elem.items()
+ if items or namespaces:
+ if namespaces:
+ for v, k in sorted(namespaces.items(),
+ key=lambda x: x[1]): # sort on prefix
+ if k:
+ k = ":" + k
+ write(" xmlns%s=\"%s\"" % (
+ k.encode(encoding),
+ _escape_attrib(v, encoding)
+ ))
+ for k, v in sorted(items): # lexical order
+ if isinstance(k, QName):
+ k = k.text
+ if isinstance(v, QName):
+ v = qnames[v.text]
+ else:
+ v = _escape_attrib(v, encoding)
+ write(" %s=\"%s\"" % (qnames[k], v))
+ if text or len(elem):
+ write(">")
+ if text:
+ write(_escape_cdata(text, encoding))
+ for e in elem:
+ _serialize_xml(write, e, encoding, qnames, None)
+ write("</" + tag + ">")
+ else:
+ write(" />")
+ if elem.tail:
+ write(_escape_cdata(elem.tail, encoding))
+
+HTML_EMPTY = ("area", "base", "basefont", "br", "col", "frame", "hr",
+ "img", "input", "isindex", "link", "meta", "param")
+
+try:
+ HTML_EMPTY = set(HTML_EMPTY)
+except NameError:
+ pass
+
+def _serialize_html(write, elem, encoding, qnames, namespaces):
+ tag = elem.tag
+ text = elem.text
+ if tag is Comment:
+ write("<!--%s-->" % _escape_cdata(text, encoding))
+ elif tag is ProcessingInstruction:
+ write("<?%s?>" % _escape_cdata(text, encoding))
+ else:
+ tag = qnames[tag]
+ if tag is None:
+ if text:
+ write(_escape_cdata(text, encoding))
+ for e in elem:
+ _serialize_html(write, e, encoding, qnames, None)
+ else:
+ write("<" + tag)
+ items = elem.items()
+ if items or namespaces:
+ if namespaces:
+ for v, k in sorted(namespaces.items(),
+ key=lambda x: x[1]): # sort on prefix
+ if k:
+ k = ":" + k
+ write(" xmlns%s=\"%s\"" % (
+ k.encode(encoding),
+ _escape_attrib(v, encoding)
+ ))
+ for k, v in sorted(items): # lexical order
+ if isinstance(k, QName):
+ k = k.text
+ if isinstance(v, QName):
+ v = qnames[v.text]
+ else:
+ v = _escape_attrib_html(v, encoding)
+ # FIXME: handle boolean attributes
+ write(" %s=\"%s\"" % (qnames[k], v))
+ write(">")
+ ltag = tag.lower()
+ if text:
+ if ltag == "script" or ltag == "style":
+ write(_encode(text, encoding))
+ else:
+ write(_escape_cdata(text, encoding))
+ for e in elem:
+ _serialize_html(write, e, encoding, qnames, None)
+ if ltag not in HTML_EMPTY:
+ write("</" + tag + ">")
+ if elem.tail:
+ write(_escape_cdata(elem.tail, encoding))
+
+def _serialize_text(write, elem, encoding):
+ for part in elem.itertext():
+ write(part.encode(encoding))
+ if elem.tail:
+ write(elem.tail.encode(encoding))
+
+_serialize = {
+ "xml": _serialize_xml,
+ "html": _serialize_html,
+ "text": _serialize_text,
+# this optional method is imported at the end of the module
+# "c14n": _serialize_c14n,
+}
+
+##
+# Registers a namespace prefix. The registry is global, and any
+# existing mapping for either the given prefix or the namespace URI
+# will be removed.
+#
+# @param prefix Namespace prefix.
+# @param uri Namespace uri. Tags and attributes in this namespace
+# will be serialized with the given prefix, if at all possible.
+# @exception ValueError If the prefix is reserved, or is otherwise
+# invalid.
+
+def register_namespace(prefix, uri):
+ if re.match("ns\d+$", prefix):
+ raise ValueError("Prefix format reserved for internal use")
+ for k, v in _namespace_map.items():
+ if k == uri or v == prefix:
+ del _namespace_map[k]
+ _namespace_map[uri] = prefix
+
+_namespace_map = {
+ # "well-known" namespace prefixes
+ "http://www.w3.org/XML/1998/namespace": "xml",
+ "http://www.w3.org/1999/xhtml": "html",
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf",
+ "http://schemas.xmlsoap.org/wsdl/": "wsdl",
+ # xml schema
+ "http://www.w3.org/2001/XMLSchema": "xs",
+ "http://www.w3.org/2001/XMLSchema-instance": "xsi",
+ # dublin core
+ "http://purl.org/dc/elements/1.1/": "dc",
+}
+
+def _raise_serialization_error(text):
+ raise TypeError(
+ "cannot serialize %r (type %s)" % (text, type(text).__name__)
+ )
+
+def _encode(text, encoding):
+ try:
+ return text.encode(encoding, "xmlcharrefreplace")
+ except (TypeError, AttributeError):
+ _raise_serialization_error(text)
+
+def _escape_cdata(text, encoding):
+ # escape character data
+ try:
+ # it's worth avoiding do-nothing calls for strings that are
+ # shorter than 500 character, or so. assume that's, by far,
+ # the most common case in most applications.
+ if "&" in text:
+ text = text.replace("&", "&amp;")
+ if "<" in text:
+ text = text.replace("<", "&lt;")
+ if ">" in text:
+ text = text.replace(">", "&gt;")
+ return text.encode(encoding, "xmlcharrefreplace")
+ except (TypeError, AttributeError):
+ _raise_serialization_error(text)
+
+def _escape_attrib(text, encoding):
+ # escape attribute value
+ try:
+ if "&" in text:
+ text = text.replace("&", "&amp;")
+ if "<" in text:
+ text = text.replace("<", "&lt;")
+ if ">" in text:
+ text = text.replace(">", "&gt;")
+ if "\"" in text:
+ text = text.replace("\"", "&quot;")
+ if "\n" in text:
+ text = text.replace("\n", "&#10;")
+ return text.encode(encoding, "xmlcharrefreplace")
+ except (TypeError, AttributeError):
+ _raise_serialization_error(text)
+
+def _escape_attrib_html(text, encoding):
+ # escape attribute value
+ try:
+ if "&" in text:
+ text = text.replace("&", "&amp;")
+ if ">" in text:
+ text = text.replace(">", "&gt;")
+ if "\"" in text:
+ text = text.replace("\"", "&quot;")
+ return text.encode(encoding, "xmlcharrefreplace")
+ except (TypeError, AttributeError):
+ _raise_serialization_error(text)
+
+# --------------------------------------------------------------------
+
+##
+# Generates a string representation of an XML element, including all
+# subelements.
+#
+# @param element An Element instance.
+# @keyparam encoding Optional output encoding (default is US-ASCII).
+# @keyparam method Optional output method ("xml", "html", "text" or
+# "c14n"; default is "xml").
+# @return An encoded string containing the XML data.
+# @defreturn string
+
+def tostring(element, encoding=None, method=None):
+ class dummy:
+ pass
+ data = []
+ file = dummy()
+ file.write = data.append
+ ElementTree(element).write(file, encoding, method=method)
+ return "".join(data)
+
+##
+# Generates a string representation of an XML element, including all
+# subelements. The string is returned as a sequence of string fragments.
+#
+# @param element An Element instance.
+# @keyparam encoding Optional output encoding (default is US-ASCII).
+# @keyparam method Optional output method ("xml", "html", "text" or
+# "c14n"; default is "xml").
+# @return A sequence object containing the XML data.
+# @defreturn sequence
+# @since 1.3
+
+def tostringlist(element, encoding=None, method=None):
+ class dummy:
+ pass
+ data = []
+ file = dummy()
+ file.write = data.append
+ ElementTree(element).write(file, encoding, method=method)
+ # FIXME: merge small fragments into larger parts
+ return data
+
+##
+# Writes an element tree or element structure to sys.stdout. This
+# function should be used for debugging only.
+# <p>
+# The exact output format is implementation dependent. In this
+# version, it's written as an ordinary XML file.
+#
+# @param elem An element tree or an individual element.
+
+def dump(elem):
+ # debugging
+ if not isinstance(elem, ElementTree):
+ elem = ElementTree(elem)
+ elem.write(sys.stdout)
+ tail = elem.getroot().tail
+ if not tail or tail[-1] != "\n":
+ sys.stdout.write("\n")
+
+# --------------------------------------------------------------------
+# parsing
+
+##
+# Parses an XML document into an element tree.
+#
+# @param source A filename or file object containing XML data.
+# @param parser An optional parser instance. If not given, the
+# standard {@link XMLParser} parser is used.
+# @return An ElementTree instance
+
+def parse(source, parser=None):
+ tree = ElementTree()
+ tree.parse(source, parser)
+ return tree
+
+##
+# Parses an XML document into an element tree incrementally, and reports
+# what's going on to the user.
+#
+# @param source A filename or file object containing XML data.
+# @param events A list of events to report back. If omitted, only "end"
+# events are reported.
+# @param parser An optional parser instance. If not given, the
+# standard {@link XMLParser} parser is used.
+# @return A (event, elem) iterator.
+
+def iterparse(source, events=None, parser=None):
+ close_source = False
+ if not hasattr(source, "read"):
+ source = open(source, "rb")
+ close_source = True
+ if not parser:
+ parser = XMLParser(target=TreeBuilder())
+ return _IterParseIterator(source, events, parser, close_source)
+
+class _IterParseIterator(object):
+
+ def __init__(self, source, events, parser, close_source=False):
+ self._file = source
+ self._close_file = close_source
+ self._events = []
+ self._index = 0
+ self._error = None
+ self.root = self._root = None
+ self._parser = parser
+ # wire up the parser for event reporting
+ parser = self._parser._parser
+ append = self._events.append
+ if events is None:
+ events = ["end"]
+ for event in events:
+ if event == "start":
+ try:
+ parser.ordered_attributes = 1
+ parser.specified_attributes = 1
+ def handler(tag, attrib_in, event=event, append=append,
+ start=self._parser._start_list):
+ append((event, start(tag, attrib_in)))
+ parser.StartElementHandler = handler
+ except AttributeError:
+ def handler(tag, attrib_in, event=event, append=append,
+ start=self._parser._start):
+ append((event, start(tag, attrib_in)))
+ parser.StartElementHandler = handler
+ elif event == "end":
+ def handler(tag, event=event, append=append,
+ end=self._parser._end):
+ append((event, end(tag)))
+ parser.EndElementHandler = handler
+ elif event == "start-ns":
+ def handler(prefix, uri, event=event, append=append):
+ try:
+ uri = (uri or "").encode("ascii")
+ except UnicodeError:
+ pass
+ append((event, (prefix or "", uri or "")))
+ parser.StartNamespaceDeclHandler = handler
+ elif event == "end-ns":
+ def handler(prefix, event=event, append=append):
+ append((event, None))
+ parser.EndNamespaceDeclHandler = handler
+ else:
+ raise ValueError("unknown event %r" % event)
+
+ def next(self):
+ while 1:
+ try:
+ item = self._events[self._index]
+ self._index += 1
+ return item
+ except IndexError:
+ pass
+ if self._error:
+ e = self._error
+ self._error = None
+ raise e
+ if self._parser is None:
+ self.root = self._root
+ if self._close_file:
+ self._file.close()
+ raise StopIteration
+ # load event buffer
+ del self._events[:]
+ self._index = 0
+ data = self._file.read(16384)
+ if data:
+ try:
+ self._parser.feed(data)
+ except SyntaxError as exc:
+ self._error = exc
+ else:
+ self._root = self._parser.close()
+ self._parser = None
+
+ def __iter__(self):
+ return self
+
+##
+# Parses an XML document from a string constant. This function can
+# be used to embed "XML literals" in Python code.
+#
+# @param source A string containing XML data.
+# @param parser An optional parser instance. If not given, the
+# standard {@link XMLParser} parser is used.
+# @return An Element instance.
+# @defreturn Element
+
+def XML(text, parser=None):
+ if not parser:
+ parser = XMLParser(target=TreeBuilder())
+ parser.feed(text)
+ return parser.close()
+
+##
+# Parses an XML document from a string constant, and also returns
+# a dictionary which maps from element id:s to elements.
+#
+# @param source A string containing XML data.
+# @param parser An optional parser instance. If not given, the
+# standard {@link XMLParser} parser is used.
+# @return A tuple containing an Element instance and a dictionary.
+# @defreturn (Element, dictionary)
+
+def XMLID(text, parser=None):
+ if not parser:
+ parser = XMLParser(target=TreeBuilder())
+ parser.feed(text)
+ tree = parser.close()
+ ids = {}
+ for elem in tree.iter():
+ id = elem.get("id")
+ if id:
+ ids[id] = elem
+ return tree, ids
+
+##
+# Parses an XML document from a string constant. Same as {@link #XML}.
+#
+# @def fromstring(text)
+# @param source A string containing XML data.
+# @return An Element instance.
+# @defreturn Element
+
+fromstring = XML
+
+##
+# Parses an XML document from a sequence of string fragments.
+#
+# @param sequence A list or other sequence containing XML data fragments.
+# @param parser An optional parser instance. If not given, the
+# standard {@link XMLParser} parser is used.
+# @return An Element instance.
+# @defreturn Element
+# @since 1.3
+
+def fromstringlist(sequence, parser=None):
+ if not parser:
+ parser = XMLParser(target=TreeBuilder())
+ for text in sequence:
+ parser.feed(text)
+ return parser.close()
+
+# --------------------------------------------------------------------
+
+##
+# Generic element structure builder. This builder converts a sequence
+# of {@link #TreeBuilder.start}, {@link #TreeBuilder.data}, and {@link
+# #TreeBuilder.end} method calls to a well-formed element structure.
+# <p>
+# You can use this class to build an element structure using a custom XML
+# parser, or a parser for some other XML-like format.
+#
+# @param element_factory Optional element factory. This factory
+# is called to create new Element instances, as necessary.
+
+class TreeBuilder(object):
+
+ def __init__(self, element_factory=None):
+ self._data = [] # data collector
+ self._elem = [] # element stack
+ self._last = None # last element
+ self._tail = None # true if we're after an end tag
+ if element_factory is None:
+ element_factory = Element
+ self._factory = element_factory
+
+ ##
+ # Flushes the builder buffers, and returns the toplevel document
+ # element.
+ #
+ # @return An Element instance.
+ # @defreturn Element
+
+ def close(self):
+ assert len(self._elem) == 0, "missing end tags"
+ assert self._last is not None, "missing toplevel element"
+ return self._last
+
+ def _flush(self):
+ if self._data:
+ if self._last is not None:
+ text = "".join(self._data)
+ if self._tail:
+ assert self._last.tail is None, "internal error (tail)"
+ self._last.tail = text
+ else:
+ assert self._last.text is None, "internal error (text)"
+ self._last.text = text
+ self._data = []
+
+ ##
+ # Adds text to the current element.
+ #
+ # @param data A string. This should be either an 8-bit string
+ # containing ASCII text, or a Unicode string.
+
+ def data(self, data):
+ self._data.append(data)
+
+ ##
+ # Opens a new element.
+ #
+ # @param tag The element name.
+ # @param attrib A dictionary containing element attributes.
+ # @return The opened element.
+ # @defreturn Element
+
+ def start(self, tag, attrs):
+ self._flush()
+ self._last = elem = self._factory(tag, attrs)
+ if self._elem:
+ self._elem[-1].append(elem)
+ self._elem.append(elem)
+ self._tail = 0
+ return elem
+
+ ##
+ # Closes the current element.
+ #
+ # @param tag The element name.
+ # @return The closed element.
+ # @defreturn Element
+
+ def end(self, tag):
+ self._flush()
+ self._last = self._elem.pop()
+ assert self._last.tag == tag,\
+ "end tag mismatch (expected %s, got %s)" % (
+ self._last.tag, tag)
+ self._tail = 1
+ return self._last
+
+##
+# Element structure builder for XML source data, based on the
+# <b>expat</b> parser.
+#
+# @keyparam target Target object. If omitted, the builder uses an
+# instance of the standard {@link #TreeBuilder} class.
+# @keyparam html Predefine HTML entities. This flag is not supported
+# by the current implementation.
+# @keyparam encoding Optional encoding. If given, the value overrides
+# the encoding specified in the XML file.
+# @see #ElementTree
+# @see #TreeBuilder
+
+class XMLParser(object):
+
+ def __init__(self, html=0, target=None, encoding=None):
+ try:
+ from xml.parsers import expat
+ except ImportError:
+ try:
+ import pyexpat as expat
+ except ImportError:
+ raise ImportError(
+ "No module named expat; use SimpleXMLTreeBuilder instead"
+ )
+ parser = expat.ParserCreate(encoding, "}")
+ if target is None:
+ target = TreeBuilder()
+ # underscored names are provided for compatibility only
+ self.parser = self._parser = parser
+ self.target = self._target = target
+ self._error = expat.error
+ self._names = {} # name memo cache
+ # callbacks
+ parser.DefaultHandlerExpand = self._default
+ parser.StartElementHandler = self._start
+ parser.EndElementHandler = self._end
+ parser.CharacterDataHandler = self._data
+ # optional callbacks
+ parser.CommentHandler = self._comment
+ parser.ProcessingInstructionHandler = self._pi
+ # let expat do the buffering, if supported
+ try:
+ self._parser.buffer_text = 1
+ except AttributeError:
+ pass
+ # use new-style attribute handling, if supported
+ try:
+ self._parser.ordered_attributes = 1
+ self._parser.specified_attributes = 1
+ parser.StartElementHandler = self._start_list
+ except AttributeError:
+ pass
+ self._doctype = None
+ self.entity = {}
+ try:
+ self.version = "Expat %d.%d.%d" % expat.version_info
+ except AttributeError:
+ pass # unknown
+
+ def _raiseerror(self, value):
+ err = ParseError(value)
+ err.code = value.code
+ err.position = value.lineno, value.offset
+ raise err
+
+ def _fixtext(self, text):
+ # convert text string to ascii, if possible
+ try:
+ return text.encode("ascii")
+ except UnicodeError:
+ return text
+
+ def _fixname(self, key):
+ # expand qname, and convert name string to ascii, if possible
+ try:
+ name = self._names[key]
+ except KeyError:
+ name = key
+ if "}" in name:
+ name = "{" + name
+ self._names[key] = name = self._fixtext(name)
+ return name
+
+ def _start(self, tag, attrib_in):
+ fixname = self._fixname
+ fixtext = self._fixtext
+ tag = fixname(tag)
+ attrib = {}
+ for key, value in attrib_in.items():
+ attrib[fixname(key)] = fixtext(value)
+ return self.target.start(tag, attrib)
+
+ def _start_list(self, tag, attrib_in):
+ fixname = self._fixname
+ fixtext = self._fixtext
+ tag = fixname(tag)
+ attrib = {}
+ if attrib_in:
+ for i in range(0, len(attrib_in), 2):
+ attrib[fixname(attrib_in[i])] = fixtext(attrib_in[i+1])
+ return self.target.start(tag, attrib)
+
+ def _data(self, text):
+ return self.target.data(self._fixtext(text))
+
+ def _end(self, tag):
+ return self.target.end(self._fixname(tag))
+
+ def _comment(self, data):
+ try:
+ comment = self.target.comment
+ except AttributeError:
+ pass
+ else:
+ return comment(self._fixtext(data))
+
+ def _pi(self, target, data):
+ try:
+ pi = self.target.pi
+ except AttributeError:
+ pass
+ else:
+ return pi(self._fixtext(target), self._fixtext(data))
+
+ def _default(self, text):
+ prefix = text[:1]
+ if prefix == "&":
+ # deal with undefined entities
+ try:
+ self.target.data(self.entity[text[1:-1]])
+ except KeyError:
+ from xml.parsers import expat
+ err = expat.error(
+ "undefined entity %s: line %d, column %d" %
+ (text, self._parser.ErrorLineNumber,
+ self._parser.ErrorColumnNumber)
+ )
+ err.code = 11 # XML_ERROR_UNDEFINED_ENTITY
+ err.lineno = self._parser.ErrorLineNumber
+ err.offset = self._parser.ErrorColumnNumber
+ raise err
+ elif prefix == "<" and text[:9] == "<!DOCTYPE":
+ self._doctype = [] # inside a doctype declaration
+ elif self._doctype is not None:
+ # parse doctype contents
+ if prefix == ">":
+ self._doctype = None
+ return
+ text = text.strip()
+ if not text:
+ return
+ self._doctype.append(text)
+ n = len(self._doctype)
+ if n > 2:
+ type = self._doctype[1]
+ if type == "PUBLIC" and n == 4:
+ name, type, pubid, system = self._doctype
+ elif type == "SYSTEM" and n == 3:
+ name, type, system = self._doctype
+ pubid = None
+ else:
+ return
+ if pubid:
+ pubid = pubid[1:-1]
+ if hasattr(self.target, "doctype"):
+ self.target.doctype(name, pubid, system[1:-1])
+ elif self.doctype is not self._XMLParser__doctype:
+ # warn about deprecated call
+ self._XMLParser__doctype(name, pubid, system[1:-1])
+ self.doctype(name, pubid, system[1:-1])
+ self._doctype = None
+
+ ##
+ # (Deprecated) Handles a doctype declaration.
+ #
+ # @param name Doctype name.
+ # @param pubid Public identifier.
+ # @param system System identifier.
+
+ def doctype(self, name, pubid, system):
+ """This method of XMLParser is deprecated."""
+ warnings.warn(
+ "This method of XMLParser is deprecated. Define doctype() "
+ "method on the TreeBuilder target.",
+ DeprecationWarning,
+ )
+
+ # sentinel, if doctype is redefined in a subclass
+ __doctype = doctype
+
+ ##
+ # Feeds data to the parser.
+ #
+ # @param data Encoded data.
+
+ def feed(self, data):
+ try:
+ self._parser.Parse(data, 0)
+ except self._error, v:
+ self._raiseerror(v)
+
+ ##
+ # Finishes feeding data to the parser.
+ #
+ # @return An element structure.
+ # @defreturn Element
+
+ def close(self):
+ try:
+ self._parser.Parse("", 1) # end of data
+ except self._error, v:
+ self._raiseerror(v)
+ tree = self.target.close()
+ del self.target, self._parser # get rid of circular references
+ return tree
+
+# compatibility
+XMLTreeBuilder = XMLParser
+
+# workaround circular import.
+try:
+ from ElementC14N import _serialize_c14n
+ _serialize["c14n"] = _serialize_c14n
+except ImportError:
+ pass
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
index 0000000000..1fd62da7a3
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/__init__.py
@@ -0,0 +1,33 @@
+# $Id: __init__.py 3375 2008-02-13 08:05:08Z fredrik $
+# elementtree package
+
+# --------------------------------------------------------------------
+# The ElementTree toolkit is
+#
+# Copyright (c) 1999-2008 by Fredrik Lundh
+#
+# By obtaining, using, and/or copying this software and/or its
+# associated documentation, you agree that you have read, understood,
+# and will comply with the following terms and conditions:
+#
+# Permission to use, copy, modify, and distribute this software and
+# its associated documentation for any purpose and without fee is
+# hereby granted, provided that the above copyright notice appears in
+# all copies, and that both that copyright notice and this permission
+# notice appear in supporting documentation, and that the name of
+# Secret Labs AB or the author not be used in advertising or publicity
+# pertaining to distribution of the software without specific, written
+# prior permission.
+#
+# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
+# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT-
+# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR
+# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+# --------------------------------------------------------------------
+
+# Licensed to PSF under a Contributor Agreement.
+# See http://www.python.org/psf/license for licensing details.
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
index 0000000000..db12fde7dd
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/cElementTree.py
@@ -0,0 +1,3 @@
+# Wrapper module for _elementtree
+
+from _elementtree import *
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
index 0000000000..ee4380b1b3
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/parsers/__init__.py
@@ -0,0 +1,8 @@
+"""Python interfaces to XML parsers.
+
+This package contains one module:
+
+expat -- Python wrapper for James Clark's Expat parser, with namespace
+ support.
+
+"""
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
index 0000000000..77fed62eab
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/parsers/expat.py
@@ -0,0 +1,4 @@
+"""Interface to the Expat non-validating XML parser."""
+__version__ = '$Revision: 17640 $'
+
+from pyexpat import *
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
index 0000000000..2686c38fcc
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/__init__.py
@@ -0,0 +1,108 @@
+"""Simple API for XML (SAX) implementation for Python.
+
+This module provides an implementation of the SAX 2 interface;
+information about the Java version of the interface can be found at
+http://www.megginson.com/SAX/. The Python version of the interface is
+documented at <...>.
+
+This package contains the following modules:
+
+handler -- Base classes and constants which define the SAX 2 API for
+ the 'client-side' of SAX for Python.
+
+saxutils -- Implementation of the convenience classes commonly used to
+ work with SAX.
+
+xmlreader -- Base classes and constants which define the SAX 2 API for
+ the parsers used with SAX for Python.
+
+expatreader -- Driver that allows use of the Expat parser with SAX.
+"""
+
+from xmlreader import InputSource
+from handler import ContentHandler, ErrorHandler
+from _exceptions import SAXException, SAXNotRecognizedException, \
+ SAXParseException, SAXNotSupportedException, \
+ SAXReaderNotAvailable
+
+
+def parse(source, handler, errorHandler=ErrorHandler()):
+ parser = make_parser()
+ parser.setContentHandler(handler)
+ parser.setErrorHandler(errorHandler)
+ parser.parse(source)
+
+def parseString(string, handler, errorHandler=ErrorHandler()):
+ try:
+ from cStringIO import StringIO
+ except ImportError:
+ from StringIO import StringIO
+
+ if errorHandler is None:
+ errorHandler = ErrorHandler()
+ parser = make_parser()
+ parser.setContentHandler(handler)
+ parser.setErrorHandler(errorHandler)
+
+ inpsrc = InputSource()
+ inpsrc.setByteStream(StringIO(string))
+ parser.parse(inpsrc)
+
+# this is the parser list used by the make_parser function if no
+# alternatives are given as parameters to the function
+
+default_parser_list = ["xml.sax.expatreader"]
+
+# tell modulefinder that importing sax potentially imports expatreader
+_false = 0
+if _false:
+ import xml.sax.expatreader
+
+import os, sys
+if "PY_SAX_PARSER" in os.environ:
+ default_parser_list = os.environ["PY_SAX_PARSER"].split(",")
+del os
+
+_key = "python.xml.sax.parser"
+if sys.platform[:4] == "java" and sys.registry.containsKey(_key):
+ default_parser_list = sys.registry.getProperty(_key).split(",")
+
+
+def make_parser(parser_list = []):
+ """Creates and returns a SAX parser.
+
+ Creates the first parser it is able to instantiate of the ones
+ given in the list created by doing parser_list +
+ default_parser_list. The lists must contain the names of Python
+ modules containing both a SAX parser and a create_parser function."""
+
+ for parser_name in parser_list + default_parser_list:
+ try:
+ return _create_parser(parser_name)
+ except ImportError,e:
+ import sys
+ if parser_name in sys.modules:
+ # The parser module was found, but importing it
+ # failed unexpectedly, pass this exception through
+ raise
+ except SAXReaderNotAvailable:
+ # The parser module detected that it won't work properly,
+ # so try the next one
+ pass
+
+ raise SAXReaderNotAvailable("No parsers found", None)
+
+# --- Internal utility methods used by make_parser
+
+if sys.platform[ : 4] == "java":
+ def _create_parser(parser_name):
+ from org.python.core import imp
+ drv_module = imp.importName(parser_name, 0, globals())
+ return drv_module.create_parser()
+
+else:
+ def _create_parser(parser_name):
+ drv_module = __import__(parser_name,{},{},['create_parser'])
+ return drv_module.create_parser()
+
+del sys
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
index 0000000000..8477f0e6aa
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/_exceptions.py
@@ -0,0 +1,131 @@
+"""Different kinds of SAX Exceptions"""
+import sys
+if sys.platform[:4] == "java":
+ from java.lang import Exception
+del sys
+
+# ===== SAXEXCEPTION =====
+
+class SAXException(Exception):
+ """Encapsulate an XML error or warning. This class can contain
+ basic error or warning information from either the XML parser or
+ the application: you can subclass it to provide additional
+ functionality, or to add localization. Note that although you will
+ receive a SAXException as the argument to the handlers in the
+ ErrorHandler interface, you are not actually required to raise
+ the exception; instead, you can simply read the information in
+ it."""
+
+ def __init__(self, msg, exception=None):
+ """Creates an exception. The message is required, but the exception
+ is optional."""
+ self._msg = msg
+ self._exception = exception
+ Exception.__init__(self, msg)
+
+ def getMessage(self):
+ "Return a message for this exception."
+ return self._msg
+
+ def getException(self):
+ "Return the embedded exception, or None if there was none."
+ return self._exception
+
+ def __str__(self):
+ "Create a string representation of the exception."
+ return self._msg
+
+ def __getitem__(self, ix):
+ """Avoids weird error messages if someone does exception[ix] by
+ mistake, since Exception has __getitem__ defined."""
+ raise AttributeError("__getitem__")
+
+
+# ===== SAXPARSEEXCEPTION =====
+
+class SAXParseException(SAXException):
+ """Encapsulate an XML parse error or warning.
+
+ This exception will include information for locating the error in
+ the original XML document. Note that although the application will
+ receive a SAXParseException as the argument to the handlers in the
+ ErrorHandler interface, the application is not actually required
+ to raise the exception; instead, it can simply read the
+ information in it and take a different action.
+
+ Since this exception is a subclass of SAXException, it inherits
+ the ability to wrap another exception."""
+
+ def __init__(self, msg, exception, locator):
+ "Creates the exception. The exception parameter is allowed to be None."
+ SAXException.__init__(self, msg, exception)
+ self._locator = locator
+
+ # We need to cache this stuff at construction time.
+ # If this exception is raised, the objects through which we must
+ # traverse to get this information may be deleted by the time
+ # it gets caught.
+ self._systemId = self._locator.getSystemId()
+ self._colnum = self._locator.getColumnNumber()
+ self._linenum = self._locator.getLineNumber()
+
+ def getColumnNumber(self):
+ """The column number of the end of the text where the exception
+ occurred."""
+ return self._colnum
+
+ def getLineNumber(self):
+ "The line number of the end of the text where the exception occurred."
+ return self._linenum
+
+ def getPublicId(self):
+ "Get the public identifier of the entity where the exception occurred."
+ return self._locator.getPublicId()
+
+ def getSystemId(self):
+ "Get the system identifier of the entity where the exception occurred."
+ return self._systemId
+
+ def __str__(self):
+ "Create a string representation of the exception."
+ sysid = self.getSystemId()
+ if sysid is None:
+ sysid = "<unknown>"
+ linenum = self.getLineNumber()
+ if linenum is None:
+ linenum = "?"
+ colnum = self.getColumnNumber()
+ if colnum is None:
+ colnum = "?"
+ return "%s:%s:%s: %s" % (sysid, linenum, colnum, self._msg)
+
+
+# ===== SAXNOTRECOGNIZEDEXCEPTION =====
+
+class SAXNotRecognizedException(SAXException):
+ """Exception class for an unrecognized identifier.
+
+ An XMLReader will raise this exception when it is confronted with an
+ unrecognized feature or property. SAX applications and extensions may
+ use this class for similar purposes."""
+
+
+# ===== SAXNOTSUPPORTEDEXCEPTION =====
+
+class SAXNotSupportedException(SAXException):
+ """Exception class for an unsupported operation.
+
+ An XMLReader will raise this exception when a service it cannot
+ perform is requested (specifically setting a state or value). SAX
+ applications and extensions may use this class for similar
+ purposes."""
+
+# ===== SAXNOTSUPPORTEDEXCEPTION =====
+
+class SAXReaderNotAvailable(SAXNotSupportedException):
+ """Exception class for a missing driver.
+
+ An XMLReader module (driver) should raise this exception when it
+ is first imported, e.g. when a support module cannot be imported.
+ It also may be raised during parsing, e.g. if executing an external
+ program is not permitted."""
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
index 0000000000..f573311fbf
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/expatreader.py
@@ -0,0 +1,430 @@
+"""
+SAX driver for the pyexpat C module. This driver works with
+pyexpat.__version__ == '2.22'.
+"""
+
+version = "0.20"
+
+from xml.sax._exceptions import *
+from xml.sax.handler import feature_validation, feature_namespaces
+from xml.sax.handler import feature_namespace_prefixes
+from xml.sax.handler import feature_external_ges, feature_external_pes
+from xml.sax.handler import feature_string_interning
+from xml.sax.handler import property_xml_string, property_interning_dict
+
+# xml.parsers.expat does not raise ImportError in Jython
+import sys
+if sys.platform[:4] == "java":
+ raise SAXReaderNotAvailable("expat not available in Java", None)
+del sys
+
+try:
+ from xml.parsers import expat
+except ImportError:
+ raise SAXReaderNotAvailable("expat not supported", None)
+else:
+ if not hasattr(expat, "ParserCreate"):
+ raise SAXReaderNotAvailable("expat not supported", None)
+from xml.sax import xmlreader, saxutils, handler
+
+AttributesImpl = xmlreader.AttributesImpl
+AttributesNSImpl = xmlreader.AttributesNSImpl
+
+# If we're using a sufficiently recent version of Python, we can use
+# weak references to avoid cycles between the parser and content
+# handler, otherwise we'll just have to pretend.
+try:
+ import _weakref
+except ImportError:
+ def _mkproxy(o):
+ return o
+else:
+ import weakref
+ _mkproxy = weakref.proxy
+ del weakref, _weakref
+
+class _ClosedParser:
+ pass
+
+# --- ExpatLocator
+
+class ExpatLocator(xmlreader.Locator):
+ """Locator for use with the ExpatParser class.
+
+ This uses a weak reference to the parser object to avoid creating
+ a circular reference between the parser and the content handler.
+ """
+ def __init__(self, parser):
+ self._ref = _mkproxy(parser)
+
+ def getColumnNumber(self):
+ parser = self._ref
+ if parser._parser is None:
+ return None
+ return parser._parser.ErrorColumnNumber
+
+ def getLineNumber(self):
+ parser = self._ref
+ if parser._parser is None:
+ return 1
+ return parser._parser.ErrorLineNumber
+
+ def getPublicId(self):
+ parser = self._ref
+ if parser is None:
+ return None
+ return parser._source.getPublicId()
+
+ def getSystemId(self):
+ parser = self._ref
+ if parser is None:
+ return None
+ return parser._source.getSystemId()
+
+
+# --- ExpatParser
+
+class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator):
+ """SAX driver for the pyexpat C module."""
+
+ def __init__(self, namespaceHandling=0, bufsize=2**16-20):
+ xmlreader.IncrementalParser.__init__(self, bufsize)
+ self._source = xmlreader.InputSource()
+ self._parser = None
+ self._namespaces = namespaceHandling
+ self._lex_handler_prop = None
+ self._parsing = 0
+ self._entity_stack = []
+ self._external_ges = 1
+ self._interning = None
+
+ # XMLReader methods
+
+ def parse(self, source):
+ "Parse an XML document from a URL or an InputSource."
+ source = saxutils.prepare_input_source(source)
+
+ self._source = source
+ self.reset()
+ self._cont_handler.setDocumentLocator(ExpatLocator(self))
+ xmlreader.IncrementalParser.parse(self, source)
+
+ def prepareParser(self, source):
+ if source.getSystemId() is not None:
+ base = source.getSystemId()
+ if isinstance(base, unicode):
+ base = base.encode('utf-8')
+ self._parser.SetBase(base)
+
+ # Redefined setContentHandler to allow changing handlers during parsing
+
+ def setContentHandler(self, handler):
+ xmlreader.IncrementalParser.setContentHandler(self, handler)
+ if self._parsing:
+ self._reset_cont_handler()
+
+ def getFeature(self, name):
+ if name == feature_namespaces:
+ return self._namespaces
+ elif name == feature_string_interning:
+ return self._interning is not None
+ elif name in (feature_validation, feature_external_pes,
+ feature_namespace_prefixes):
+ return 0
+ elif name == feature_external_ges:
+ return self._external_ges
+ raise SAXNotRecognizedException("Feature '%s' not recognized" % name)
+
+ def setFeature(self, name, state):
+ if self._parsing:
+ raise SAXNotSupportedException("Cannot set features while parsing")
+
+ if name == feature_namespaces:
+ self._namespaces = state
+ elif name == feature_external_ges:
+ self._external_ges = state
+ elif name == feature_string_interning:
+ if state:
+ if self._interning is None:
+ self._interning = {}
+ else:
+ self._interning = None
+ elif name == feature_validation:
+ if state:
+ raise SAXNotSupportedException(
+ "expat does not support validation")
+ elif name == feature_external_pes:
+ if state:
+ raise SAXNotSupportedException(
+ "expat does not read external parameter entities")
+ elif name == feature_namespace_prefixes:
+ if state:
+ raise SAXNotSupportedException(
+ "expat does not report namespace prefixes")
+ else:
+ raise SAXNotRecognizedException(
+ "Feature '%s' not recognized" % name)
+
+ def getProperty(self, name):
+ if name == handler.property_lexical_handler:
+ return self._lex_handler_prop
+ elif name == property_interning_dict:
+ return self._interning
+ elif name == property_xml_string:
+ if self._parser:
+ if hasattr(self._parser, "GetInputContext"):
+ return self._parser.GetInputContext()
+ else:
+ raise SAXNotRecognizedException(
+ "This version of expat does not support getting"
+ " the XML string")
+ else:
+ raise SAXNotSupportedException(
+ "XML string cannot be returned when not parsing")
+ raise SAXNotRecognizedException("Property '%s' not recognized" % name)
+
+ def setProperty(self, name, value):
+ if name == handler.property_lexical_handler:
+ self._lex_handler_prop = value
+ if self._parsing:
+ self._reset_lex_handler_prop()
+ elif name == property_interning_dict:
+ self._interning = value
+ elif name == property_xml_string:
+ raise SAXNotSupportedException("Property '%s' cannot be set" %
+ name)
+ else:
+ raise SAXNotRecognizedException("Property '%s' not recognized" %
+ name)
+
+ # IncrementalParser methods
+
+ def feed(self, data, isFinal = 0):
+ if not self._parsing:
+ self.reset()
+ self._parsing = 1
+ self._cont_handler.startDocument()
+
+ try:
+ # The isFinal parameter is internal to the expat reader.
+ # If it is set to true, expat will check validity of the entire
+ # document. When feeding chunks, they are not normally final -
+ # except when invoked from close.
+ self._parser.Parse(data, isFinal)
+ except expat.error, e:
+ exc = SAXParseException(expat.ErrorString(e.code), e, self)
+ # FIXME: when to invoke error()?
+ self._err_handler.fatalError(exc)
+
+ def close(self):
+ if (self._entity_stack or self._parser is None or
+ isinstance(self._parser, _ClosedParser)):
+ # If we are completing an external entity, do nothing here
+ return
+ try:
+ self.feed("", isFinal = 1)
+ self._cont_handler.endDocument()
+ self._parsing = 0
+ # break cycle created by expat handlers pointing to our methods
+ self._parser = None
+ finally:
+ self._parsing = 0
+ if self._parser is not None:
+ # Keep ErrorColumnNumber and ErrorLineNumber after closing.
+ parser = _ClosedParser()
+ parser.ErrorColumnNumber = self._parser.ErrorColumnNumber
+ parser.ErrorLineNumber = self._parser.ErrorLineNumber
+ self._parser = parser
+
+ def _reset_cont_handler(self):
+ self._parser.ProcessingInstructionHandler = \
+ self._cont_handler.processingInstruction
+ self._parser.CharacterDataHandler = self._cont_handler.characters
+
+ def _reset_lex_handler_prop(self):
+ lex = self._lex_handler_prop
+ parser = self._parser
+ if lex is None:
+ parser.CommentHandler = None
+ parser.StartCdataSectionHandler = None
+ parser.EndCdataSectionHandler = None
+ parser.StartDoctypeDeclHandler = None
+ parser.EndDoctypeDeclHandler = None
+ else:
+ parser.CommentHandler = lex.comment
+ parser.StartCdataSectionHandler = lex.startCDATA
+ parser.EndCdataSectionHandler = lex.endCDATA
+ parser.StartDoctypeDeclHandler = self.start_doctype_decl
+ parser.EndDoctypeDeclHandler = lex.endDTD
+
+ def reset(self):
+ if self._namespaces:
+ self._parser = expat.ParserCreate(self._source.getEncoding(), " ",
+ intern=self._interning)
+ self._parser.namespace_prefixes = 1
+ self._parser.StartElementHandler = self.start_element_ns
+ self._parser.EndElementHandler = self.end_element_ns
+ else:
+ self._parser = expat.ParserCreate(self._source.getEncoding(),
+ intern = self._interning)
+ self._parser.StartElementHandler = self.start_element
+ self._parser.EndElementHandler = self.end_element
+
+ self._reset_cont_handler()
+ self._parser.UnparsedEntityDeclHandler = self.unparsed_entity_decl
+ self._parser.NotationDeclHandler = self.notation_decl
+ self._parser.StartNamespaceDeclHandler = self.start_namespace_decl
+ self._parser.EndNamespaceDeclHandler = self.end_namespace_decl
+
+ self._decl_handler_prop = None
+ if self._lex_handler_prop:
+ self._reset_lex_handler_prop()
+# self._parser.DefaultHandler =
+# self._parser.DefaultHandlerExpand =
+# self._parser.NotStandaloneHandler =
+ self._parser.ExternalEntityRefHandler = self.external_entity_ref
+ try:
+ self._parser.SkippedEntityHandler = self.skipped_entity_handler
+ except AttributeError:
+ # This pyexpat does not support SkippedEntity
+ pass
+ self._parser.SetParamEntityParsing(
+ expat.XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE)
+
+ self._parsing = 0
+ self._entity_stack = []
+
+ # Locator methods
+
+ def getColumnNumber(self):
+ if self._parser is None:
+ return None
+ return self._parser.ErrorColumnNumber
+
+ def getLineNumber(self):
+ if self._parser is None:
+ return 1
+ return self._parser.ErrorLineNumber
+
+ def getPublicId(self):
+ return self._source.getPublicId()
+
+ def getSystemId(self):
+ return self._source.getSystemId()
+
+ # event handlers
+ def start_element(self, name, attrs):
+ self._cont_handler.startElement(name, AttributesImpl(attrs))
+
+ def end_element(self, name):
+ self._cont_handler.endElement(name)
+
+ def start_element_ns(self, name, attrs):
+ pair = name.split()
+ if len(pair) == 1:
+ # no namespace
+ pair = (None, name)
+ elif len(pair) == 3:
+ pair = pair[0], pair[1]
+ else:
+ # default namespace
+ pair = tuple(pair)
+
+ newattrs = {}
+ qnames = {}
+ for (aname, value) in attrs.items():
+ parts = aname.split()
+ length = len(parts)
+ if length == 1:
+ # no namespace
+ qname = aname
+ apair = (None, aname)
+ elif length == 3:
+ qname = "%s:%s" % (parts[2], parts[1])
+ apair = parts[0], parts[1]
+ else:
+ # default namespace
+ qname = parts[1]
+ apair = tuple(parts)
+
+ newattrs[apair] = value
+ qnames[apair] = qname
+
+ self._cont_handler.startElementNS(pair, None,
+ AttributesNSImpl(newattrs, qnames))
+
+ def end_element_ns(self, name):
+ pair = name.split()
+ if len(pair) == 1:
+ pair = (None, name)
+ elif len(pair) == 3:
+ pair = pair[0], pair[1]
+ else:
+ pair = tuple(pair)
+
+ self._cont_handler.endElementNS(pair, None)
+
+ # this is not used (call directly to ContentHandler)
+ def processing_instruction(self, target, data):
+ self._cont_handler.processingInstruction(target, data)
+
+ # this is not used (call directly to ContentHandler)
+ def character_data(self, data):
+ self._cont_handler.characters(data)
+
+ def start_namespace_decl(self, prefix, uri):
+ self._cont_handler.startPrefixMapping(prefix, uri)
+
+ def end_namespace_decl(self, prefix):
+ self._cont_handler.endPrefixMapping(prefix)
+
+ def start_doctype_decl(self, name, sysid, pubid, has_internal_subset):
+ self._lex_handler_prop.startDTD(name, pubid, sysid)
+
+ def unparsed_entity_decl(self, name, base, sysid, pubid, notation_name):
+ self._dtd_handler.unparsedEntityDecl(name, pubid, sysid, notation_name)
+
+ def notation_decl(self, name, base, sysid, pubid):
+ self._dtd_handler.notationDecl(name, pubid, sysid)
+
+ def external_entity_ref(self, context, base, sysid, pubid):
+ if not self._external_ges:
+ return 1
+
+ source = self._ent_handler.resolveEntity(pubid, sysid)
+ source = saxutils.prepare_input_source(source,
+ self._source.getSystemId() or
+ "")
+
+ self._entity_stack.append((self._parser, self._source))
+ self._parser = self._parser.ExternalEntityParserCreate(context)
+ self._source = source
+
+ try:
+ xmlreader.IncrementalParser.parse(self, source)
+ except:
+ return 0 # FIXME: save error info here?
+
+ (self._parser, self._source) = self._entity_stack[-1]
+ del self._entity_stack[-1]
+ return 1
+
+ def skipped_entity_handler(self, name, is_pe):
+ if is_pe:
+ # The SAX spec requires to report skipped PEs with a '%'
+ name = '%'+name
+ self._cont_handler.skippedEntity(name)
+
+# ---
+
+def create_parser(*args, **kwargs):
+ return ExpatParser(*args, **kwargs)
+
+# ---
+
+if __name__ == "__main__":
+ import xml.sax.saxutils
+ p = create_parser()
+ p.setContentHandler(xml.sax.saxutils.XMLGenerator())
+ p.setErrorHandler(xml.sax.ErrorHandler())
+ p.parse("http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml")
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
index 0000000000..378f4f1756
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/handler.py
@@ -0,0 +1,342 @@
+"""
+This module contains the core classes of version 2.0 of SAX for Python.
+This file provides only default classes with absolutely minimum
+functionality, from which drivers and applications can be subclassed.
+
+Many of these classes are empty and are included only as documentation
+of the interfaces.
+
+$Id$
+"""
+
+version = '2.0beta'
+
+#============================================================================
+#
+# HANDLER INTERFACES
+#
+#============================================================================
+
+# ===== ERRORHANDLER =====
+
+class ErrorHandler:
+ """Basic interface for SAX error handlers.
+
+ If you create an object that implements this interface, then
+ register the object with your XMLReader, the parser will call the
+ methods in your object to report all warnings and errors. There
+ are three levels of errors available: warnings, (possibly)
+ recoverable errors, and unrecoverable errors. All methods take a
+ SAXParseException as the only parameter."""
+
+ def error(self, exception):
+ "Handle a recoverable error."
+ raise exception
+
+ def fatalError(self, exception):
+ "Handle a non-recoverable error."
+ raise exception
+
+ def warning(self, exception):
+ "Handle a warning."
+ print exception
+
+
+# ===== CONTENTHANDLER =====
+
+class ContentHandler:
+ """Interface for receiving logical document content events.
+
+ This is the main callback interface in SAX, and the one most
+ important to applications. The order of events in this interface
+ mirrors the order of the information in the document."""
+
+ def __init__(self):
+ self._locator = None
+
+ def setDocumentLocator(self, locator):
+ """Called by the parser to give the application a locator for
+ locating the origin of document events.
+
+ SAX parsers are strongly encouraged (though not absolutely
+ required) to supply a locator: if it does so, it must supply
+ the locator to the application by invoking this method before
+ invoking any of the other methods in the DocumentHandler
+ interface.
+
+ The locator allows the application to determine the end
+ position of any document-related event, even if the parser is
+ not reporting an error. Typically, the application will use
+ this information for reporting its own errors (such as
+ character content that does not match an application's
+ business rules). The information returned by the locator is
+ probably not sufficient for use with a search engine.
+
+ Note that the locator will return correct information only
+ during the invocation of the events in this interface. The
+ application should not attempt to use it at any other time."""
+ self._locator = locator
+
+ def startDocument(self):
+ """Receive notification of the beginning of a document.
+
+ The SAX parser will invoke this method only once, before any
+ other methods in this interface or in DTDHandler (except for
+ setDocumentLocator)."""
+
+ def endDocument(self):
+ """Receive notification of the end of a document.
+
+ The SAX parser will invoke this method only once, and it will
+ be the last method invoked during the parse. The parser shall
+ not invoke this method until it has either abandoned parsing
+ (because of an unrecoverable error) or reached the end of
+ input."""
+
+ def startPrefixMapping(self, prefix, uri):
+ """Begin the scope of a prefix-URI Namespace mapping.
+
+ The information from this event is not necessary for normal
+ Namespace processing: the SAX XML reader will automatically
+ replace prefixes for element and attribute names when the
+ http://xml.org/sax/features/namespaces feature is true (the
+ default).
+
+ There are cases, however, when applications need to use
+ prefixes in character data or in attribute values, where they
+ cannot safely be expanded automatically; the
+ start/endPrefixMapping event supplies the information to the
+ application to expand prefixes in those contexts itself, if
+ necessary.
+
+ Note that start/endPrefixMapping events are not guaranteed to
+ be properly nested relative to each-other: all
+ startPrefixMapping events will occur before the corresponding
+ startElement event, and all endPrefixMapping events will occur
+ after the corresponding endElement event, but their order is
+ not guaranteed."""
+
+ def endPrefixMapping(self, prefix):
+ """End the scope of a prefix-URI mapping.
+
+ See startPrefixMapping for details. This event will always
+ occur after the corresponding endElement event, but the order
+ of endPrefixMapping events is not otherwise guaranteed."""
+
+ def startElement(self, name, attrs):
+ """Signals the start of an element in non-namespace mode.
+
+ The name parameter contains the raw XML 1.0 name of the
+ element type as a string and the attrs parameter holds an
+ instance of the Attributes class containing the attributes of
+ the element."""
+
+ def endElement(self, name):
+ """Signals the end of an element in non-namespace mode.
+
+ The name parameter contains the name of the element type, just
+ as with the startElement event."""
+
+ def startElementNS(self, name, qname, attrs):
+ """Signals the start of an element in namespace mode.
+
+ The name parameter contains the name of the element type as a
+ (uri, localname) tuple, the qname parameter the raw XML 1.0
+ name used in the source document, and the attrs parameter
+ holds an instance of the Attributes class containing the
+ attributes of the element.
+
+ The uri part of the name tuple is None for elements which have
+ no namespace."""
+
+ def endElementNS(self, name, qname):
+ """Signals the end of an element in namespace mode.
+
+ The name parameter contains the name of the element type, just
+ as with the startElementNS event."""
+
+ def characters(self, content):
+ """Receive notification of character data.
+
+ The Parser will call this method to report each chunk of
+ character data. SAX parsers may return all contiguous
+ character data in a single chunk, or they may split it into
+ several chunks; however, all of the characters in any single
+ event must come from the same external entity so that the
+ Locator provides useful information."""
+
+ def ignorableWhitespace(self, whitespace):
+ """Receive notification of ignorable whitespace in element content.
+
+ Validating Parsers must use this method to report each chunk
+ of ignorable whitespace (see the W3C XML 1.0 recommendation,
+ section 2.10): non-validating parsers may also use this method
+ if they are capable of parsing and using content models.
+
+ SAX parsers may return all contiguous whitespace in a single
+ chunk, or they may split it into several chunks; however, all
+ of the characters in any single event must come from the same
+ external entity, so that the Locator provides useful
+ information."""
+
+ def processingInstruction(self, target, data):
+ """Receive notification of a processing instruction.
+
+ The Parser will invoke this method once for each processing
+ instruction found: note that processing instructions may occur
+ before or after the main document element.
+
+ A SAX parser should never report an XML declaration (XML 1.0,
+ section 2.8) or a text declaration (XML 1.0, section 4.3.1)
+ using this method."""
+
+ def skippedEntity(self, name):
+ """Receive notification of a skipped entity.
+
+ The Parser will invoke this method once for each entity
+ skipped. Non-validating processors may skip entities if they
+ have not seen the declarations (because, for example, the
+ entity was declared in an external DTD subset). All processors
+ may skip external entities, depending on the values of the
+ http://xml.org/sax/features/external-general-entities and the
+ http://xml.org/sax/features/external-parameter-entities
+ properties."""
+
+
+# ===== DTDHandler =====
+
+class DTDHandler:
+ """Handle DTD events.
+
+ This interface specifies only those DTD events required for basic
+ parsing (unparsed entities and attributes)."""
+
+ def notationDecl(self, name, publicId, systemId):
+ "Handle a notation declaration event."
+
+ def unparsedEntityDecl(self, name, publicId, systemId, ndata):
+ "Handle an unparsed entity declaration event."
+
+
+# ===== ENTITYRESOLVER =====
+
+class EntityResolver:
+ """Basic interface for resolving entities. If you create an object
+ implementing this interface, then register the object with your
+ Parser, the parser will call the method in your object to
+ resolve all external entities. Note that DefaultHandler implements
+ this interface with the default behaviour."""
+
+ def resolveEntity(self, publicId, systemId):
+ """Resolve the system identifier of an entity and return either
+ the system identifier to read from as a string, or an InputSource
+ to read from."""
+ return systemId
+
+
+#============================================================================
+#
+# CORE FEATURES
+#
+#============================================================================
+
+feature_namespaces = "http://xml.org/sax/features/namespaces"
+# true: Perform Namespace processing (default).
+# false: Optionally do not perform Namespace processing
+# (implies namespace-prefixes).
+# access: (parsing) read-only; (not parsing) read/write
+
+feature_namespace_prefixes = "http://xml.org/sax/features/namespace-prefixes"
+# true: Report the original prefixed names and attributes used for Namespace
+# declarations.
+# false: Do not report attributes used for Namespace declarations, and
+# optionally do not report original prefixed names (default).
+# access: (parsing) read-only; (not parsing) read/write
+
+feature_string_interning = "http://xml.org/sax/features/string-interning"
+# true: All element names, prefixes, attribute names, Namespace URIs, and
+# local names are interned using the built-in intern function.
+# false: Names are not necessarily interned, although they may be (default).
+# access: (parsing) read-only; (not parsing) read/write
+
+feature_validation = "http://xml.org/sax/features/validation"
+# true: Report all validation errors (implies external-general-entities and
+# external-parameter-entities).
+# false: Do not report validation errors.
+# access: (parsing) read-only; (not parsing) read/write
+
+feature_external_ges = "http://xml.org/sax/features/external-general-entities"
+# true: Include all external general (text) entities.
+# false: Do not include external general entities.
+# access: (parsing) read-only; (not parsing) read/write
+
+feature_external_pes = "http://xml.org/sax/features/external-parameter-entities"
+# true: Include all external parameter entities, including the external
+# DTD subset.
+# false: Do not include any external parameter entities, even the external
+# DTD subset.
+# access: (parsing) read-only; (not parsing) read/write
+
+all_features = [feature_namespaces,
+ feature_namespace_prefixes,
+ feature_string_interning,
+ feature_validation,
+ feature_external_ges,
+ feature_external_pes]
+
+
+#============================================================================
+#
+# CORE PROPERTIES
+#
+#============================================================================
+
+property_lexical_handler = "http://xml.org/sax/properties/lexical-handler"
+# data type: xml.sax.sax2lib.LexicalHandler
+# description: An optional extension handler for lexical events like comments.
+# access: read/write
+
+property_declaration_handler = "http://xml.org/sax/properties/declaration-handler"
+# data type: xml.sax.sax2lib.DeclHandler
+# description: An optional extension handler for DTD-related events other
+# than notations and unparsed entities.
+# access: read/write
+
+property_dom_node = "http://xml.org/sax/properties/dom-node"
+# data type: org.w3c.dom.Node
+# description: When parsing, the current DOM node being visited if this is
+# a DOM iterator; when not parsing, the root DOM node for
+# iteration.
+# access: (parsing) read-only; (not parsing) read/write
+
+property_xml_string = "http://xml.org/sax/properties/xml-string"
+# data type: String
+# description: The literal string of characters that was the source for
+# the current event.
+# access: read-only
+
+property_encoding = "http://www.python.org/sax/properties/encoding"
+# data type: String
+# description: The name of the encoding to assume for input data.
+# access: write: set the encoding, e.g. established by a higher-level
+# protocol. May change during parsing (e.g. after
+# processing a META tag)
+# read: return the current encoding (possibly established through
+# auto-detection.
+# initial value: UTF-8
+#
+
+property_interning_dict = "http://www.python.org/sax/properties/interning-dict"
+# data type: Dictionary
+# description: The dictionary used to intern common strings in the document
+# access: write: Request that the parser uses a specific dictionary, to
+# allow interning across different documents
+# read: return the current interning dictionary, or None
+#
+
+all_properties = [property_lexical_handler,
+ property_dom_node,
+ property_declaration_handler,
+ property_xml_string,
+ property_encoding,
+ property_interning_dict]
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
index 0000000000..674df6d74d
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/saxutils.py
@@ -0,0 +1,353 @@
+"""\
+A library of useful helper classes to the SAX classes, for the
+convenience of application and driver writers.
+"""
+
+import os, urlparse, urllib, types
+import io
+import sys
+import handler
+import xmlreader
+
+try:
+ _StringTypes = [types.StringType, types.UnicodeType]
+except AttributeError:
+ _StringTypes = [types.StringType]
+
+def __dict_replace(s, d):
+ """Replace substrings of a string using a dictionary."""
+ for key, value in d.items():
+ s = s.replace(key, value)
+ return s
+
+def escape(data, entities={}):
+ """Escape &, <, and > in a string of data.
+
+ You can escape other strings of data by passing a dictionary as
+ the optional entities parameter. The keys and values must all be
+ strings; each key will be replaced with its corresponding value.
+ """
+
+ # must do ampersand first
+ data = data.replace("&", "&amp;")
+ data = data.replace(">", "&gt;")
+ data = data.replace("<", "&lt;")
+ if entities:
+ data = __dict_replace(data, entities)
+ return data
+
+def unescape(data, entities={}):
+ """Unescape &amp;, &lt;, and &gt; in a string of data.
+
+ You can unescape other strings of data by passing a dictionary as
+ the optional entities parameter. The keys and values must all be
+ strings; each key will be replaced with its corresponding value.
+ """
+ data = data.replace("&lt;", "<")
+ data = data.replace("&gt;", ">")
+ if entities:
+ data = __dict_replace(data, entities)
+ # must do ampersand last
+ return data.replace("&amp;", "&")
+
+def quoteattr(data, entities={}):
+ """Escape and quote an attribute value.
+
+ Escape &, <, and > in a string of data, then quote it for use as
+ an attribute value. The \" character will be escaped as well, if
+ necessary.
+
+ You can escape other strings of data by passing a dictionary as
+ the optional entities parameter. The keys and values must all be
+ strings; each key will be replaced with its corresponding value.
+ """
+ entities = entities.copy()
+ entities.update({'\n': '&#10;', '\r': '&#13;', '\t':'&#9;'})
+ data = escape(data, entities)
+ if '"' in data:
+ if "'" in data:
+ data = '"%s"' % data.replace('"', "&quot;")
+ else:
+ data = "'%s'" % data
+ else:
+ data = '"%s"' % data
+ return data
+
+
+def _gettextwriter(out, encoding):
+ if out is None:
+ import sys
+ out = sys.stdout
+
+ if isinstance(out, io.RawIOBase):
+ buffer = io.BufferedIOBase(out)
+ # Keep the original file open when the TextIOWrapper is
+ # destroyed
+ buffer.close = lambda: None
+ else:
+ # This is to handle passed objects that aren't in the
+ # IOBase hierarchy, but just have a write method
+ buffer = io.BufferedIOBase()
+ buffer.writable = lambda: True
+ buffer.write = out.write
+ try:
+ # TextIOWrapper uses this methods to determine
+ # if BOM (for UTF-16, etc) should be added
+ buffer.seekable = out.seekable
+ buffer.tell = out.tell
+ except AttributeError:
+ pass
+ # wrap a binary writer with TextIOWrapper
+ return _UnbufferedTextIOWrapper(buffer, encoding=encoding,
+ errors='xmlcharrefreplace',
+ newline='\n')
+
+
+class _UnbufferedTextIOWrapper(io.TextIOWrapper):
+ def write(self, s):
+ super(_UnbufferedTextIOWrapper, self).write(s)
+ self.flush()
+
+
+class XMLGenerator(handler.ContentHandler):
+
+ def __init__(self, out=None, encoding="iso-8859-1"):
+ handler.ContentHandler.__init__(self)
+ out = _gettextwriter(out, encoding)
+ self._write = out.write
+ self._flush = out.flush
+ self._ns_contexts = [{}] # contains uri -> prefix dicts
+ self._current_context = self._ns_contexts[-1]
+ self._undeclared_ns_maps = []
+ self._encoding = encoding
+
+ def _qname(self, name):
+ """Builds a qualified name from a (ns_url, localname) pair"""
+ if name[0]:
+ # Per http://www.w3.org/XML/1998/namespace, The 'xml' prefix is
+ # bound by definition to http://www.w3.org/XML/1998/namespace. It
+ # does not need to be declared and will not usually be found in
+ # self._current_context.
+ if 'http://www.w3.org/XML/1998/namespace' == name[0]:
+ return 'xml:' + name[1]
+ # The name is in a non-empty namespace
+ prefix = self._current_context[name[0]]
+ if prefix:
+ # If it is not the default namespace, prepend the prefix
+ return prefix + ":" + name[1]
+ # Return the unqualified name
+ return name[1]
+
+ # ContentHandler methods
+
+ def startDocument(self):
+ self._write(u'<?xml version="1.0" encoding="%s"?>\n' %
+ self._encoding)
+
+ def endDocument(self):
+ self._flush()
+
+ def startPrefixMapping(self, prefix, uri):
+ self._ns_contexts.append(self._current_context.copy())
+ self._current_context[uri] = prefix
+ self._undeclared_ns_maps.append((prefix, uri))
+
+ def endPrefixMapping(self, prefix):
+ self._current_context = self._ns_contexts[-1]
+ del self._ns_contexts[-1]
+
+ def startElement(self, name, attrs):
+ self._write(u'<' + name)
+ for (name, value) in attrs.items():
+ self._write(u' %s=%s' % (name, quoteattr(value)))
+ self._write(u'>')
+
+ def endElement(self, name):
+ self._write(u'</%s>' % name)
+
+ def startElementNS(self, name, qname, attrs):
+ self._write(u'<' + self._qname(name))
+
+ for prefix, uri in self._undeclared_ns_maps:
+ if prefix:
+ self._write(u' xmlns:%s="%s"' % (prefix, uri))
+ else:
+ self._write(u' xmlns="%s"' % uri)
+ self._undeclared_ns_maps = []
+
+ for (name, value) in attrs.items():
+ self._write(u' %s=%s' % (self._qname(name), quoteattr(value)))
+ self._write(u'>')
+
+ def endElementNS(self, name, qname):
+ self._write(u'</%s>' % self._qname(name))
+
+ def characters(self, content):
+ if not isinstance(content, unicode):
+ content = unicode(content, self._encoding)
+ self._write(escape(content))
+
+ def ignorableWhitespace(self, content):
+ if not isinstance(content, unicode):
+ content = unicode(content, self._encoding)
+ self._write(content)
+
+ def processingInstruction(self, target, data):
+ self._write(u'<?%s %s?>' % (target, data))
+
+
+class XMLFilterBase(xmlreader.XMLReader):
+ """This class is designed to sit between an XMLReader and the
+ client application's event handlers. By default, it does nothing
+ but pass requests up to the reader and events on to the handlers
+ unmodified, but subclasses can override specific methods to modify
+ the event stream or the configuration requests as they pass
+ through."""
+
+ def __init__(self, parent = None):
+ xmlreader.XMLReader.__init__(self)
+ self._parent = parent
+
+ # ErrorHandler methods
+
+ def error(self, exception):
+ self._err_handler.error(exception)
+
+ def fatalError(self, exception):
+ self._err_handler.fatalError(exception)
+
+ def warning(self, exception):
+ self._err_handler.warning(exception)
+
+ # ContentHandler methods
+
+ def setDocumentLocator(self, locator):
+ self._cont_handler.setDocumentLocator(locator)
+
+ def startDocument(self):
+ self._cont_handler.startDocument()
+
+ def endDocument(self):
+ self._cont_handler.endDocument()
+
+ def startPrefixMapping(self, prefix, uri):
+ self._cont_handler.startPrefixMapping(prefix, uri)
+
+ def endPrefixMapping(self, prefix):
+ self._cont_handler.endPrefixMapping(prefix)
+
+ def startElement(self, name, attrs):
+ self._cont_handler.startElement(name, attrs)
+
+ def endElement(self, name):
+ self._cont_handler.endElement(name)
+
+ def startElementNS(self, name, qname, attrs):
+ self._cont_handler.startElementNS(name, qname, attrs)
+
+ def endElementNS(self, name, qname):
+ self._cont_handler.endElementNS(name, qname)
+
+ def characters(self, content):
+ self._cont_handler.characters(content)
+
+ def ignorableWhitespace(self, chars):
+ self._cont_handler.ignorableWhitespace(chars)
+
+ def processingInstruction(self, target, data):
+ self._cont_handler.processingInstruction(target, data)
+
+ def skippedEntity(self, name):
+ self._cont_handler.skippedEntity(name)
+
+ # DTDHandler methods
+
+ def notationDecl(self, name, publicId, systemId):
+ self._dtd_handler.notationDecl(name, publicId, systemId)
+
+ def unparsedEntityDecl(self, name, publicId, systemId, ndata):
+ self._dtd_handler.unparsedEntityDecl(name, publicId, systemId, ndata)
+
+ # EntityResolver methods
+
+ def resolveEntity(self, publicId, systemId):
+ return self._ent_handler.resolveEntity(publicId, systemId)
+
+ # XMLReader methods
+
+ def parse(self, source):
+ self._parent.setContentHandler(self)
+ self._parent.setErrorHandler(self)
+ self._parent.setEntityResolver(self)
+ self._parent.setDTDHandler(self)
+ self._parent.parse(source)
+
+ def setLocale(self, locale):
+ self._parent.setLocale(locale)
+
+ def getFeature(self, name):
+ return self._parent.getFeature(name)
+
+ def setFeature(self, name, state):
+ self._parent.setFeature(name, state)
+
+ def getProperty(self, name):
+ return self._parent.getProperty(name)
+
+ def setProperty(self, name, value):
+ self._parent.setProperty(name, value)
+
+ # XMLFilter methods
+
+ def getParent(self):
+ return self._parent
+
+ def setParent(self, parent):
+ self._parent = parent
+
+# --- Utility functions
+
+def prepare_input_source(source, base = ""):
+ """This function takes an InputSource and an optional base URL and
+ returns a fully resolved InputSource object ready for reading."""
+
+ if type(source) in _StringTypes:
+ source = xmlreader.InputSource(source)
+ elif hasattr(source, "read"):
+ f = source
+ source = xmlreader.InputSource()
+ source.setByteStream(f)
+ if hasattr(f, "name"):
+ source.setSystemId(f.name)
+
+ if source.getByteStream() is None:
+ try:
+ sysid = source.getSystemId()
+ basehead = os.path.dirname(os.path.normpath(base))
+ encoding = sys.getfilesystemencoding()
+ if isinstance(sysid, unicode):
+ if not isinstance(basehead, unicode):
+ try:
+ basehead = basehead.decode(encoding)
+ except UnicodeDecodeError:
+ sysid = sysid.encode(encoding)
+ else:
+ if isinstance(basehead, unicode):
+ try:
+ sysid = sysid.decode(encoding)
+ except UnicodeDecodeError:
+ basehead = basehead.encode(encoding)
+ sysidfilename = os.path.join(basehead, sysid)
+ isfile = os.path.isfile(sysidfilename)
+ except UnicodeError:
+ isfile = False
+ if isfile:
+ source.setSystemId(sysidfilename)
+ f = open(sysidfilename, "rb")
+ else:
+ source.setSystemId(urlparse.urljoin(base, source.getSystemId()))
+ f = urllib.urlopen(source.getSystemId())
+
+ source.setByteStream(f)
+
+ return source
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
index 0000000000..05f2506ee1
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/xmlreader.py
@@ -0,0 +1,381 @@
+"""An XML Reader is the SAX 2 name for an XML parser. XML Parsers
+should be based on this code. """
+
+import handler
+
+from _exceptions import SAXNotSupportedException, SAXNotRecognizedException
+
+
+# ===== XMLREADER =====
+
+class XMLReader:
+ """Interface for reading an XML document using callbacks.
+
+ XMLReader is the interface that an XML parser's SAX2 driver must
+ implement. This interface allows an application to set and query
+ features and properties in the parser, to register event handlers
+ for document processing, and to initiate a document parse.
+
+ All SAX interfaces are assumed to be synchronous: the parse
+ methods must not return until parsing is complete, and readers
+ must wait for an event-handler callback to return before reporting
+ the next event."""
+
+ def __init__(self):
+ self._cont_handler = handler.ContentHandler()
+ self._dtd_handler = handler.DTDHandler()
+ self._ent_handler = handler.EntityResolver()
+ self._err_handler = handler.ErrorHandler()
+
+ def parse(self, source):
+ "Parse an XML document from a system identifier or an InputSource."
+ raise NotImplementedError("This method must be implemented!")
+
+ def getContentHandler(self):
+ "Returns the current ContentHandler."
+ return self._cont_handler
+
+ def setContentHandler(self, handler):
+ "Registers a new object to receive document content events."
+ self._cont_handler = handler
+
+ def getDTDHandler(self):
+ "Returns the current DTD handler."
+ return self._dtd_handler
+
+ def setDTDHandler(self, handler):
+ "Register an object to receive basic DTD-related events."
+ self._dtd_handler = handler
+
+ def getEntityResolver(self):
+ "Returns the current EntityResolver."
+ return self._ent_handler
+
+ def setEntityResolver(self, resolver):
+ "Register an object to resolve external entities."
+ self._ent_handler = resolver
+
+ def getErrorHandler(self):
+ "Returns the current ErrorHandler."
+ return self._err_handler
+
+ def setErrorHandler(self, handler):
+ "Register an object to receive error-message events."
+ self._err_handler = handler
+
+ def setLocale(self, locale):
+ """Allow an application to set the locale for errors and warnings.
+
+ SAX parsers are not required to provide localization for errors
+ and warnings; if they cannot support the requested locale,
+ however, they must raise a SAX exception. Applications may
+ request a locale change in the middle of a parse."""
+ raise SAXNotSupportedException("Locale support not implemented")
+
+ def getFeature(self, name):
+ "Looks up and returns the state of a SAX2 feature."
+ raise SAXNotRecognizedException("Feature '%s' not recognized" % name)
+
+ def setFeature(self, name, state):
+ "Sets the state of a SAX2 feature."
+ raise SAXNotRecognizedException("Feature '%s' not recognized" % name)
+
+ def getProperty(self, name):
+ "Looks up and returns the value of a SAX2 property."
+ raise SAXNotRecognizedException("Property '%s' not recognized" % name)
+
+ def setProperty(self, name, value):
+ "Sets the value of a SAX2 property."
+ raise SAXNotRecognizedException("Property '%s' not recognized" % name)
+
+class IncrementalParser(XMLReader):
+ """This interface adds three extra methods to the XMLReader
+ interface that allow XML parsers to support incremental
+ parsing. Support for this interface is optional, since not all
+ underlying XML parsers support this functionality.
+
+ When the parser is instantiated it is ready to begin accepting
+ data from the feed method immediately. After parsing has been
+ finished with a call to close the reset method must be called to
+ make the parser ready to accept new data, either from feed or
+ using the parse method.
+
+ Note that these methods must _not_ be called during parsing, that
+ is, after parse has been called and before it returns.
+
+ By default, the class also implements the parse method of the XMLReader
+ interface using the feed, close and reset methods of the
+ IncrementalParser interface as a convenience to SAX 2.0 driver
+ writers."""
+
+ def __init__(self, bufsize=2**16):
+ self._bufsize = bufsize
+ XMLReader.__init__(self)
+
+ def parse(self, source):
+ import saxutils
+ source = saxutils.prepare_input_source(source)
+
+ self.prepareParser(source)
+ file = source.getByteStream()
+ buffer = file.read(self._bufsize)
+ while buffer != "":
+ self.feed(buffer)
+ buffer = file.read(self._bufsize)
+ self.close()
+
+ def feed(self, data):
+ """This method gives the raw XML data in the data parameter to
+ the parser and makes it parse the data, emitting the
+ corresponding events. It is allowed for XML constructs to be
+ split across several calls to feed.
+
+ feed may raise SAXException."""
+ raise NotImplementedError("This method must be implemented!")
+
+ def prepareParser(self, source):
+ """This method is called by the parse implementation to allow
+ the SAX 2.0 driver to prepare itself for parsing."""
+ raise NotImplementedError("prepareParser must be overridden!")
+
+ def close(self):
+ """This method is called when the entire XML document has been
+ passed to the parser through the feed method, to notify the
+ parser that there are no more data. This allows the parser to
+ do the final checks on the document and empty the internal
+ data buffer.
+
+ The parser will not be ready to parse another document until
+ the reset method has been called.
+
+ close may raise SAXException."""
+ raise NotImplementedError("This method must be implemented!")
+
+ def reset(self):
+ """This method is called after close has been called to reset
+ the parser so that it is ready to parse new documents. The
+ results of calling parse or feed after close without calling
+ reset are undefined."""
+ raise NotImplementedError("This method must be implemented!")
+
+# ===== LOCATOR =====
+
+class Locator:
+ """Interface for associating a SAX event with a document
+ location. A locator object will return valid results only during
+ calls to DocumentHandler methods; at any other time, the
+ results are unpredictable."""
+
+ def getColumnNumber(self):
+ "Return the column number where the current event ends."
+ return -1
+
+ def getLineNumber(self):
+ "Return the line number where the current event ends."
+ return -1
+
+ def getPublicId(self):
+ "Return the public identifier for the current event."
+ return None
+
+ def getSystemId(self):
+ "Return the system identifier for the current event."
+ return None
+
+# ===== INPUTSOURCE =====
+
+class InputSource:
+ """Encapsulation of the information needed by the XMLReader to
+ read entities.
+
+ This class may include information about the public identifier,
+ system identifier, byte stream (possibly with character encoding
+ information) and/or the character stream of an entity.
+
+ Applications will create objects of this class for use in the
+ XMLReader.parse method and for returning from
+ EntityResolver.resolveEntity.
+
+ An InputSource belongs to the application, the XMLReader is not
+ allowed to modify InputSource objects passed to it from the
+ application, although it may make copies and modify those."""
+
+ def __init__(self, system_id = None):
+ self.__system_id = system_id
+ self.__public_id = None
+ self.__encoding = None
+ self.__bytefile = None
+ self.__charfile = None
+
+ def setPublicId(self, public_id):
+ "Sets the public identifier of this InputSource."
+ self.__public_id = public_id
+
+ def getPublicId(self):
+ "Returns the public identifier of this InputSource."
+ return self.__public_id
+
+ def setSystemId(self, system_id):
+ "Sets the system identifier of this InputSource."
+ self.__system_id = system_id
+
+ def getSystemId(self):
+ "Returns the system identifier of this InputSource."
+ return self.__system_id
+
+ def setEncoding(self, encoding):
+ """Sets the character encoding of this InputSource.
+
+ The encoding must be a string acceptable for an XML encoding
+ declaration (see section 4.3.3 of the XML recommendation).
+
+ The encoding attribute of the InputSource is ignored if the
+ InputSource also contains a character stream."""
+ self.__encoding = encoding
+
+ def getEncoding(self):
+ "Get the character encoding of this InputSource."
+ return self.__encoding
+
+ def setByteStream(self, bytefile):
+ """Set the byte stream (a Python file-like object which does
+ not perform byte-to-character conversion) for this input
+ source.
+
+ The SAX parser will ignore this if there is also a character
+ stream specified, but it will use a byte stream in preference
+ to opening a URI connection itself.
+
+ If the application knows the character encoding of the byte
+ stream, it should set it with the setEncoding method."""
+ self.__bytefile = bytefile
+
+ def getByteStream(self):
+ """Get the byte stream for this input source.
+
+ The getEncoding method will return the character encoding for
+ this byte stream, or None if unknown."""
+ return self.__bytefile
+
+ def setCharacterStream(self, charfile):
+ """Set the character stream for this input source. (The stream
+ must be a Python 2.0 Unicode-wrapped file-like that performs
+ conversion to Unicode strings.)
+
+ If there is a character stream specified, the SAX parser will
+ ignore any byte stream and will not attempt to open a URI
+ connection to the system identifier."""
+ self.__charfile = charfile
+
+ def getCharacterStream(self):
+ "Get the character stream for this input source."
+ return self.__charfile
+
+# ===== ATTRIBUTESIMPL =====
+
+class AttributesImpl:
+
+ def __init__(self, attrs):
+ """Non-NS-aware implementation.
+
+ attrs should be of the form {name : value}."""
+ self._attrs = attrs
+
+ def getLength(self):
+ return len(self._attrs)
+
+ def getType(self, name):
+ return "CDATA"
+
+ def getValue(self, name):
+ return self._attrs[name]
+
+ def getValueByQName(self, name):
+ return self._attrs[name]
+
+ def getNameByQName(self, name):
+ if not name in self._attrs:
+ raise KeyError, name
+ return name
+
+ def getQNameByName(self, name):
+ if not name in self._attrs:
+ raise KeyError, name
+ return name
+
+ def getNames(self):
+ return self._attrs.keys()
+
+ def getQNames(self):
+ return self._attrs.keys()
+
+ def __len__(self):
+ return len(self._attrs)
+
+ def __getitem__(self, name):
+ return self._attrs[name]
+
+ def keys(self):
+ return self._attrs.keys()
+
+ def has_key(self, name):
+ return name in self._attrs
+
+ def __contains__(self, name):
+ return name in self._attrs
+
+ def get(self, name, alternative=None):
+ return self._attrs.get(name, alternative)
+
+ def copy(self):
+ return self.__class__(self._attrs)
+
+ def items(self):
+ return self._attrs.items()
+
+ def values(self):
+ return self._attrs.values()
+
+# ===== ATTRIBUTESNSIMPL =====
+
+class AttributesNSImpl(AttributesImpl):
+
+ def __init__(self, attrs, qnames):
+ """NS-aware implementation.
+
+ attrs should be of the form {(ns_uri, lname): value, ...}.
+ qnames of the form {(ns_uri, lname): qname, ...}."""
+ self._attrs = attrs
+ self._qnames = qnames
+
+ def getValueByQName(self, name):
+ for (nsname, qname) in self._qnames.items():
+ if qname == name:
+ return self._attrs[nsname]
+
+ raise KeyError, name
+
+ def getNameByQName(self, name):
+ for (nsname, qname) in self._qnames.items():
+ if qname == name:
+ return nsname
+
+ raise KeyError, name
+
+ def getQNameByName(self, name):
+ return self._qnames[name]
+
+ def getQNames(self):
+ return self._qnames.values()
+
+ def copy(self):
+ return self.__class__(self._attrs, self._qnames)
+
+
+def _test():
+ XMLReader()
+ IncrementalParser()
+ Locator()
+
+if __name__ == "__main__":
+ _test()
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
index 0000000000..79cd9c353f
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/xmllib.py
@@ -0,0 +1,930 @@
+"""A parser for XML, using the derived class as static DTD."""
+
+# Author: Sjoerd Mullender.
+
+import re
+import string
+
+import warnings
+warnings.warn("The xmllib module is obsolete. Use xml.sax instead.",
+ DeprecationWarning, 2)
+del warnings
+
+version = '0.3'
+
+class Error(RuntimeError):
+ pass
+
+# Regular expressions used for parsing
+
+_S = '[ \t\r\n]+' # white space
+_opS = '[ \t\r\n]*' # optional white space
+_Name = '[a-zA-Z_:][-a-zA-Z0-9._:]*' # valid XML name
+_QStr = "(?:'[^']*'|\"[^\"]*\")" # quoted XML string
+illegal = re.compile('[^\t\r\n -\176\240-\377]') # illegal chars in content
+interesting = re.compile('[]&<]')
+
+amp = re.compile('&')
+ref = re.compile('&(' + _Name + '|#[0-9]+|#x[0-9a-fA-F]+)[^-a-zA-Z0-9._:]')
+entityref = re.compile('&(?P<name>' + _Name + ')[^-a-zA-Z0-9._:]')
+charref = re.compile('&#(?P<char>[0-9]+[^0-9]|x[0-9a-fA-F]+[^0-9a-fA-F])')
+space = re.compile(_S + '$')
+newline = re.compile('\n')
+
+attrfind = re.compile(
+ _S + '(?P<name>' + _Name + ')'
+ '(' + _opS + '=' + _opS +
+ '(?P<value>'+_QStr+'|[-a-zA-Z0-9.:+*%?!\(\)_#=~]+))?')
+starttagopen = re.compile('<' + _Name)
+starttagend = re.compile(_opS + '(?P<slash>/?)>')
+starttagmatch = re.compile('<(?P<tagname>'+_Name+')'
+ '(?P<attrs>(?:'+attrfind.pattern+')*)'+
+ starttagend.pattern)
+endtagopen = re.compile('</')
+endbracket = re.compile(_opS + '>')
+endbracketfind = re.compile('(?:[^>\'"]|'+_QStr+')*>')
+tagfind = re.compile(_Name)
+cdataopen = re.compile(r'<!\[CDATA\[')
+cdataclose = re.compile(r'\]\]>')
+# this matches one of the following:
+# SYSTEM SystemLiteral
+# PUBLIC PubidLiteral SystemLiteral
+_SystemLiteral = '(?P<%s>'+_QStr+')'
+_PublicLiteral = '(?P<%s>"[-\'\(\)+,./:=?;!*#@$_%% \n\ra-zA-Z0-9]*"|' \
+ "'[-\(\)+,./:=?;!*#@$_%% \n\ra-zA-Z0-9]*')"
+_ExternalId = '(?:SYSTEM|' \
+ 'PUBLIC'+_S+_PublicLiteral%'pubid'+ \
+ ')'+_S+_SystemLiteral%'syslit'
+doctype = re.compile('<!DOCTYPE'+_S+'(?P<name>'+_Name+')'
+ '(?:'+_S+_ExternalId+')?'+_opS)
+xmldecl = re.compile('<\?xml'+_S+
+ 'version'+_opS+'='+_opS+'(?P<version>'+_QStr+')'+
+ '(?:'+_S+'encoding'+_opS+'='+_opS+
+ "(?P<encoding>'[A-Za-z][-A-Za-z0-9._]*'|"
+ '"[A-Za-z][-A-Za-z0-9._]*"))?'
+ '(?:'+_S+'standalone'+_opS+'='+_opS+
+ '(?P<standalone>\'(?:yes|no)\'|"(?:yes|no)"))?'+
+ _opS+'\?>')
+procopen = re.compile(r'<\?(?P<proc>' + _Name + ')' + _opS)
+procclose = re.compile(_opS + r'\?>')
+commentopen = re.compile('<!--')
+commentclose = re.compile('-->')
+doubledash = re.compile('--')
+attrtrans = string.maketrans(' \r\n\t', ' ')
+
+# definitions for XML namespaces
+_NCName = '[a-zA-Z_][-a-zA-Z0-9._]*' # XML Name, minus the ":"
+ncname = re.compile(_NCName + '$')
+qname = re.compile('(?:(?P<prefix>' + _NCName + '):)?' # optional prefix
+ '(?P<local>' + _NCName + ')$')
+
+xmlns = re.compile('xmlns(?::(?P<ncname>'+_NCName+'))?$')
+
+# XML parser base class -- find tags and call handler functions.
+# Usage: p = XMLParser(); p.feed(data); ...; p.close().
+# The dtd is defined by deriving a class which defines methods with
+# special names to handle tags: start_foo and end_foo to handle <foo>
+# and </foo>, respectively. The data between tags is passed to the
+# parser by calling self.handle_data() with some data as argument (the
+# data may be split up in arbitrary chunks).
+
+class XMLParser:
+ attributes = {} # default, to be overridden
+ elements = {} # default, to be overridden
+
+ # parsing options, settable using keyword args in __init__
+ __accept_unquoted_attributes = 0
+ __accept_missing_endtag_name = 0
+ __map_case = 0
+ __accept_utf8 = 0
+ __translate_attribute_references = 1
+
+ # Interface -- initialize and reset this instance
+ def __init__(self, **kw):
+ self.__fixed = 0
+ if 'accept_unquoted_attributes' in kw:
+ self.__accept_unquoted_attributes = kw['accept_unquoted_attributes']
+ if 'accept_missing_endtag_name' in kw:
+ self.__accept_missing_endtag_name = kw['accept_missing_endtag_name']
+ if 'map_case' in kw:
+ self.__map_case = kw['map_case']
+ if 'accept_utf8' in kw:
+ self.__accept_utf8 = kw['accept_utf8']
+ if 'translate_attribute_references' in kw:
+ self.__translate_attribute_references = kw['translate_attribute_references']
+ self.reset()
+
+ def __fixelements(self):
+ self.__fixed = 1
+ self.elements = {}
+ self.__fixdict(self.__dict__)
+ self.__fixclass(self.__class__)
+
+ def __fixclass(self, kl):
+ self.__fixdict(kl.__dict__)
+ for k in kl.__bases__:
+ self.__fixclass(k)
+
+ def __fixdict(self, dict):
+ for key in dict.keys():
+ if key[:6] == 'start_':
+ tag = key[6:]
+ start, end = self.elements.get(tag, (None, None))
+ if start is None:
+ self.elements[tag] = getattr(self, key), end
+ elif key[:4] == 'end_':
+ tag = key[4:]
+ start, end = self.elements.get(tag, (None, None))
+ if end is None:
+ self.elements[tag] = start, getattr(self, key)
+
+ # Interface -- reset this instance. Loses all unprocessed data
+ def reset(self):
+ self.rawdata = ''
+ self.stack = []
+ self.nomoretags = 0
+ self.literal = 0
+ self.lineno = 1
+ self.__at_start = 1
+ self.__seen_doctype = None
+ self.__seen_starttag = 0
+ self.__use_namespaces = 0
+ self.__namespaces = {'xml':None} # xml is implicitly declared
+ # backward compatibility hack: if elements not overridden,
+ # fill it in ourselves
+ if self.elements is XMLParser.elements:
+ self.__fixelements()
+
+ # For derived classes only -- enter literal mode (CDATA) till EOF
+ def setnomoretags(self):
+ self.nomoretags = self.literal = 1
+
+ # For derived classes only -- enter literal mode (CDATA)
+ def setliteral(self, *args):
+ self.literal = 1
+
+ # Interface -- feed some data to the parser. Call this as
+ # often as you want, with as little or as much text as you
+ # want (may include '\n'). (This just saves the text, all the
+ # processing is done by goahead().)
+ def feed(self, data):
+ self.rawdata = self.rawdata + data
+ self.goahead(0)
+
+ # Interface -- handle the remaining data
+ def close(self):
+ self.goahead(1)
+ if self.__fixed:
+ self.__fixed = 0
+ # remove self.elements so that we don't leak
+ del self.elements
+
+ # Interface -- translate references
+ def translate_references(self, data, all = 1):
+ if not self.__translate_attribute_references:
+ return data
+ i = 0
+ while 1:
+ res = amp.search(data, i)
+ if res is None:
+ return data
+ s = res.start(0)
+ res = ref.match(data, s)
+ if res is None:
+ self.syntax_error("bogus `&'")
+ i = s+1
+ continue
+ i = res.end(0)
+ str = res.group(1)
+ rescan = 0
+ if str[0] == '#':
+ if str[1] == 'x':
+ str = chr(int(str[2:], 16))
+ else:
+ str = chr(int(str[1:]))
+ if data[i - 1] != ';':
+ self.syntax_error("`;' missing after char reference")
+ i = i-1
+ elif all:
+ if str in self.entitydefs:
+ str = self.entitydefs[str]
+ rescan = 1
+ elif data[i - 1] != ';':
+ self.syntax_error("bogus `&'")
+ i = s + 1 # just past the &
+ continue
+ else:
+ self.syntax_error("reference to unknown entity `&%s;'" % str)
+ str = '&' + str + ';'
+ elif data[i - 1] != ';':
+ self.syntax_error("bogus `&'")
+ i = s + 1 # just past the &
+ continue
+
+ # when we get here, str contains the translated text and i points
+ # to the end of the string that is to be replaced
+ data = data[:s] + str + data[i:]
+ if rescan:
+ i = s
+ else:
+ i = s + len(str)
+
+ # Interface - return a dictionary of all namespaces currently valid
+ def getnamespace(self):
+ nsdict = {}
+ for t, d, nst in self.stack:
+ nsdict.update(d)
+ return nsdict
+
+ # Internal -- handle data as far as reasonable. May leave state
+ # and data to be processed by a subsequent call. If 'end' is
+ # true, force handling all data as if followed by EOF marker.
+ def goahead(self, end):
+ rawdata = self.rawdata
+ i = 0
+ n = len(rawdata)
+ while i < n:
+ if i > 0:
+ self.__at_start = 0
+ if self.nomoretags:
+ data = rawdata[i:n]
+ self.handle_data(data)
+ self.lineno = self.lineno + data.count('\n')
+ i = n
+ break
+ res = interesting.search(rawdata, i)
+ if res:
+ j = res.start(0)
+ else:
+ j = n
+ if i < j:
+ data = rawdata[i:j]
+ if self.__at_start and space.match(data) is None:
+ self.syntax_error('illegal data at start of file')
+ self.__at_start = 0
+ if not self.stack and space.match(data) is None:
+ self.syntax_error('data not in content')
+ if not self.__accept_utf8 and illegal.search(data):
+ self.syntax_error('illegal character in content')
+ self.handle_data(data)
+ self.lineno = self.lineno + data.count('\n')
+ i = j
+ if i == n: break
+ if rawdata[i] == '<':
+ if starttagopen.match(rawdata, i):
+ if self.literal:
+ data = rawdata[i]
+ self.handle_data(data)
+ self.lineno = self.lineno + data.count('\n')
+ i = i+1
+ continue
+ k = self.parse_starttag(i)
+ if k < 0: break
+ self.__seen_starttag = 1
+ self.lineno = self.lineno + rawdata[i:k].count('\n')
+ i = k
+ continue
+ if endtagopen.match(rawdata, i):
+ k = self.parse_endtag(i)
+ if k < 0: break
+ self.lineno = self.lineno + rawdata[i:k].count('\n')
+ i = k
+ continue
+ if commentopen.match(rawdata, i):
+ if self.literal:
+ data = rawdata[i]
+ self.handle_data(data)
+ self.lineno = self.lineno + data.count('\n')
+ i = i+1
+ continue
+ k = self.parse_comment(i)
+ if k < 0: break
+ self.lineno = self.lineno + rawdata[i:k].count('\n')
+ i = k
+ continue
+ if cdataopen.match(rawdata, i):
+ k = self.parse_cdata(i)
+ if k < 0: break
+ self.lineno = self.lineno + rawdata[i:k].count('\n')
+ i = k
+ continue
+ res = xmldecl.match(rawdata, i)
+ if res:
+ if not self.__at_start:
+ self.syntax_error("<?xml?> declaration not at start of document")
+ version, encoding, standalone = res.group('version',
+ 'encoding',
+ 'standalone')
+ if version[1:-1] != '1.0':
+ raise Error('only XML version 1.0 supported')
+ if encoding: encoding = encoding[1:-1]
+ if standalone: standalone = standalone[1:-1]
+ self.handle_xml(encoding, standalone)
+ i = res.end(0)
+ continue
+ res = procopen.match(rawdata, i)
+ if res:
+ k = self.parse_proc(i)
+ if k < 0: break
+ self.lineno = self.lineno + rawdata[i:k].count('\n')
+ i = k
+ continue
+ res = doctype.match(rawdata, i)
+ if res:
+ if self.literal:
+ data = rawdata[i]
+ self.handle_data(data)
+ self.lineno = self.lineno + data.count('\n')
+ i = i+1
+ continue
+ if self.__seen_doctype:
+ self.syntax_error('multiple DOCTYPE elements')
+ if self.__seen_starttag:
+ self.syntax_error('DOCTYPE not at beginning of document')
+ k = self.parse_doctype(res)
+ if k < 0: break
+ self.__seen_doctype = res.group('name')
+ if self.__map_case:
+ self.__seen_doctype = self.__seen_doctype.lower()
+ self.lineno = self.lineno + rawdata[i:k].count('\n')
+ i = k
+ continue
+ elif rawdata[i] == '&':
+ if self.literal:
+ data = rawdata[i]
+ self.handle_data(data)
+ i = i+1
+ continue
+ res = charref.match(rawdata, i)
+ if res is not None:
+ i = res.end(0)
+ if rawdata[i-1] != ';':
+ self.syntax_error("`;' missing in charref")
+ i = i-1
+ if not self.stack:
+ self.syntax_error('data not in content')
+ self.handle_charref(res.group('char')[:-1])
+ self.lineno = self.lineno + res.group(0).count('\n')
+ continue
+ res = entityref.match(rawdata, i)
+ if res is not None:
+ i = res.end(0)
+ if rawdata[i-1] != ';':
+ self.syntax_error("`;' missing in entityref")
+ i = i-1
+ name = res.group('name')
+ if self.__map_case:
+ name = name.lower()
+ if name in self.entitydefs:
+ self.rawdata = rawdata = rawdata[:res.start(0)] + self.entitydefs[name] + rawdata[i:]
+ n = len(rawdata)
+ i = res.start(0)
+ else:
+ self.unknown_entityref(name)
+ self.lineno = self.lineno + res.group(0).count('\n')
+ continue
+ elif rawdata[i] == ']':
+ if self.literal:
+ data = rawdata[i]
+ self.handle_data(data)
+ i = i+1
+ continue
+ if n-i < 3:
+ break
+ if cdataclose.match(rawdata, i):
+ self.syntax_error("bogus `]]>'")
+ self.handle_data(rawdata[i])
+ i = i+1
+ continue
+ else:
+ raise Error('neither < nor & ??')
+ # We get here only if incomplete matches but
+ # nothing else
+ break
+ # end while
+ if i > 0:
+ self.__at_start = 0
+ if end and i < n:
+ data = rawdata[i]
+ self.syntax_error("bogus `%s'" % data)
+ if not self.__accept_utf8 and illegal.search(data):
+ self.syntax_error('illegal character in content')
+ self.handle_data(data)
+ self.lineno = self.lineno + data.count('\n')
+ self.rawdata = rawdata[i+1:]
+ return self.goahead(end)
+ self.rawdata = rawdata[i:]
+ if end:
+ if not self.__seen_starttag:
+ self.syntax_error('no elements in file')
+ if self.stack:
+ self.syntax_error('missing end tags')
+ while self.stack:
+ self.finish_endtag(self.stack[-1][0])
+
+ # Internal -- parse comment, return length or -1 if not terminated
+ def parse_comment(self, i):
+ rawdata = self.rawdata
+ if rawdata[i:i+4] != '<!--':
+ raise Error('unexpected call to handle_comment')
+ res = commentclose.search(rawdata, i+4)
+ if res is None:
+ return -1
+ if doubledash.search(rawdata, i+4, res.start(0)):
+ self.syntax_error("`--' inside comment")
+ if rawdata[res.start(0)-1] == '-':
+ self.syntax_error('comment cannot end in three dashes')
+ if not self.__accept_utf8 and \
+ illegal.search(rawdata, i+4, res.start(0)):
+ self.syntax_error('illegal character in comment')
+ self.handle_comment(rawdata[i+4: res.start(0)])
+ return res.end(0)
+
+ # Internal -- handle DOCTYPE tag, return length or -1 if not terminated
+ def parse_doctype(self, res):
+ rawdata = self.rawdata
+ n = len(rawdata)
+ name = res.group('name')
+ if self.__map_case:
+ name = name.lower()
+ pubid, syslit = res.group('pubid', 'syslit')
+ if pubid is not None:
+ pubid = pubid[1:-1] # remove quotes
+ pubid = ' '.join(pubid.split()) # normalize
+ if syslit is not None: syslit = syslit[1:-1] # remove quotes
+ j = k = res.end(0)
+ if k >= n:
+ return -1
+ if rawdata[k] == '[':
+ level = 0
+ k = k+1
+ dq = sq = 0
+ while k < n:
+ c = rawdata[k]
+ if not sq and c == '"':
+ dq = not dq
+ elif not dq and c == "'":
+ sq = not sq
+ elif sq or dq:
+ pass
+ elif level <= 0 and c == ']':
+ res = endbracket.match(rawdata, k+1)
+ if res is None:
+ return -1
+ self.handle_doctype(name, pubid, syslit, rawdata[j+1:k])
+ return res.end(0)
+ elif c == '<':
+ level = level + 1
+ elif c == '>':
+ level = level - 1
+ if level < 0:
+ self.syntax_error("bogus `>' in DOCTYPE")
+ k = k+1
+ res = endbracketfind.match(rawdata, k)
+ if res is None:
+ return -1
+ if endbracket.match(rawdata, k) is None:
+ self.syntax_error('garbage in DOCTYPE')
+ self.handle_doctype(name, pubid, syslit, None)
+ return res.end(0)
+
+ # Internal -- handle CDATA tag, return length or -1 if not terminated
+ def parse_cdata(self, i):
+ rawdata = self.rawdata
+ if rawdata[i:i+9] != '<![CDATA[':
+ raise Error('unexpected call to parse_cdata')
+ res = cdataclose.search(rawdata, i+9)
+ if res is None:
+ return -1
+ if not self.__accept_utf8 and \
+ illegal.search(rawdata, i+9, res.start(0)):
+ self.syntax_error('illegal character in CDATA')
+ if not self.stack:
+ self.syntax_error('CDATA not in content')
+ self.handle_cdata(rawdata[i+9:res.start(0)])
+ return res.end(0)
+
+ __xml_namespace_attributes = {'ns':None, 'src':None, 'prefix':None}
+ # Internal -- handle a processing instruction tag
+ def parse_proc(self, i):
+ rawdata = self.rawdata
+ end = procclose.search(rawdata, i)
+ if end is None:
+ return -1
+ j = end.start(0)
+ if not self.__accept_utf8 and illegal.search(rawdata, i+2, j):
+ self.syntax_error('illegal character in processing instruction')
+ res = tagfind.match(rawdata, i+2)
+ if res is None:
+ raise Error('unexpected call to parse_proc')
+ k = res.end(0)
+ name = res.group(0)
+ if self.__map_case:
+ name = name.lower()
+ if name == 'xml:namespace':
+ self.syntax_error('old-fashioned namespace declaration')
+ self.__use_namespaces = -1
+ # namespace declaration
+ # this must come after the <?xml?> declaration (if any)
+ # and before the <!DOCTYPE> (if any).
+ if self.__seen_doctype or self.__seen_starttag:
+ self.syntax_error('xml:namespace declaration too late in document')
+ attrdict, namespace, k = self.parse_attributes(name, k, j)
+ if namespace:
+ self.syntax_error('namespace declaration inside namespace declaration')
+ for attrname in attrdict.keys():
+ if not attrname in self.__xml_namespace_attributes:
+ self.syntax_error("unknown attribute `%s' in xml:namespace tag" % attrname)
+ if not 'ns' in attrdict or not 'prefix' in attrdict:
+ self.syntax_error('xml:namespace without required attributes')
+ prefix = attrdict.get('prefix')
+ if ncname.match(prefix) is None:
+ self.syntax_error('xml:namespace illegal prefix value')
+ return end.end(0)
+ if prefix in self.__namespaces:
+ self.syntax_error('xml:namespace prefix not unique')
+ self.__namespaces[prefix] = attrdict['ns']
+ else:
+ if name.lower() == 'xml':
+ self.syntax_error('illegal processing instruction target name')
+ self.handle_proc(name, rawdata[k:j])
+ return end.end(0)
+
+ # Internal -- parse attributes between i and j
+ def parse_attributes(self, tag, i, j):
+ rawdata = self.rawdata
+ attrdict = {}
+ namespace = {}
+ while i < j:
+ res = attrfind.match(rawdata, i)
+ if res is None:
+ break
+ attrname, attrvalue = res.group('name', 'value')
+ if self.__map_case:
+ attrname = attrname.lower()
+ i = res.end(0)
+ if attrvalue is None:
+ self.syntax_error("no value specified for attribute `%s'" % attrname)
+ attrvalue = attrname
+ elif attrvalue[:1] == "'" == attrvalue[-1:] or \
+ attrvalue[:1] == '"' == attrvalue[-1:]:
+ attrvalue = attrvalue[1:-1]
+ elif not self.__accept_unquoted_attributes:
+ self.syntax_error("attribute `%s' value not quoted" % attrname)
+ res = xmlns.match(attrname)
+ if res is not None:
+ # namespace declaration
+ ncname = res.group('ncname')
+ namespace[ncname or ''] = attrvalue or None
+ if not self.__use_namespaces:
+ self.__use_namespaces = len(self.stack)+1
+ continue
+ if '<' in attrvalue:
+ self.syntax_error("`<' illegal in attribute value")
+ if attrname in attrdict:
+ self.syntax_error("attribute `%s' specified twice" % attrname)
+ attrvalue = attrvalue.translate(attrtrans)
+ attrdict[attrname] = self.translate_references(attrvalue)
+ return attrdict, namespace, i
+
+ # Internal -- handle starttag, return length or -1 if not terminated
+ def parse_starttag(self, i):
+ rawdata = self.rawdata
+ # i points to start of tag
+ end = endbracketfind.match(rawdata, i+1)
+ if end is None:
+ return -1
+ tag = starttagmatch.match(rawdata, i)
+ if tag is None or tag.end(0) != end.end(0):
+ self.syntax_error('garbage in starttag')
+ return end.end(0)
+ nstag = tagname = tag.group('tagname')
+ if self.__map_case:
+ nstag = tagname = nstag.lower()
+ if not self.__seen_starttag and self.__seen_doctype and \
+ tagname != self.__seen_doctype:
+ self.syntax_error('starttag does not match DOCTYPE')
+ if self.__seen_starttag and not self.stack:
+ self.syntax_error('multiple elements on top level')
+ k, j = tag.span('attrs')
+ attrdict, nsdict, k = self.parse_attributes(tagname, k, j)
+ self.stack.append((tagname, nsdict, nstag))
+ if self.__use_namespaces:
+ res = qname.match(tagname)
+ else:
+ res = None
+ if res is not None:
+ prefix, nstag = res.group('prefix', 'local')
+ if prefix is None:
+ prefix = ''
+ ns = None
+ for t, d, nst in self.stack:
+ if prefix in d:
+ ns = d[prefix]
+ if ns is None and prefix != '':
+ ns = self.__namespaces.get(prefix)
+ if ns is not None:
+ nstag = ns + ' ' + nstag
+ elif prefix != '':
+ nstag = prefix + ':' + nstag # undo split
+ self.stack[-1] = tagname, nsdict, nstag
+ # translate namespace of attributes
+ attrnamemap = {} # map from new name to old name (used for error reporting)
+ for key in attrdict.keys():
+ attrnamemap[key] = key
+ if self.__use_namespaces:
+ nattrdict = {}
+ for key, val in attrdict.items():
+ okey = key
+ res = qname.match(key)
+ if res is not None:
+ aprefix, key = res.group('prefix', 'local')
+ if self.__map_case:
+ key = key.lower()
+ if aprefix is not None:
+ ans = None
+ for t, d, nst in self.stack:
+ if aprefix in d:
+ ans = d[aprefix]
+ if ans is None:
+ ans = self.__namespaces.get(aprefix)
+ if ans is not None:
+ key = ans + ' ' + key
+ else:
+ key = aprefix + ':' + key
+ nattrdict[key] = val
+ attrnamemap[key] = okey
+ attrdict = nattrdict
+ attributes = self.attributes.get(nstag)
+ if attributes is not None:
+ for key in attrdict.keys():
+ if not key in attributes:
+ self.syntax_error("unknown attribute `%s' in tag `%s'" % (attrnamemap[key], tagname))
+ for key, val in attributes.items():
+ if val is not None and not key in attrdict:
+ attrdict[key] = val
+ method = self.elements.get(nstag, (None, None))[0]
+ self.finish_starttag(nstag, attrdict, method)
+ if tag.group('slash') == '/':
+ self.finish_endtag(tagname)
+ return tag.end(0)
+
+ # Internal -- parse endtag
+ def parse_endtag(self, i):
+ rawdata = self.rawdata
+ end = endbracketfind.match(rawdata, i+1)
+ if end is None:
+ return -1
+ res = tagfind.match(rawdata, i+2)
+ if res is None:
+ if self.literal:
+ self.handle_data(rawdata[i])
+ return i+1
+ if not self.__accept_missing_endtag_name:
+ self.syntax_error('no name specified in end tag')
+ tag = self.stack[-1][0]
+ k = i+2
+ else:
+ tag = res.group(0)
+ if self.__map_case:
+ tag = tag.lower()
+ if self.literal:
+ if not self.stack or tag != self.stack[-1][0]:
+ self.handle_data(rawdata[i])
+ return i+1
+ k = res.end(0)
+ if endbracket.match(rawdata, k) is None:
+ self.syntax_error('garbage in end tag')
+ self.finish_endtag(tag)
+ return end.end(0)
+
+ # Internal -- finish processing of start tag
+ def finish_starttag(self, tagname, attrdict, method):
+ if method is not None:
+ self.handle_starttag(tagname, method, attrdict)
+ else:
+ self.unknown_starttag(tagname, attrdict)
+
+ # Internal -- finish processing of end tag
+ def finish_endtag(self, tag):
+ self.literal = 0
+ if not tag:
+ self.syntax_error('name-less end tag')
+ found = len(self.stack) - 1
+ if found < 0:
+ self.unknown_endtag(tag)
+ return
+ else:
+ found = -1
+ for i in range(len(self.stack)):
+ if tag == self.stack[i][0]:
+ found = i
+ if found == -1:
+ self.syntax_error('unopened end tag')
+ return
+ while len(self.stack) > found:
+ if found < len(self.stack) - 1:
+ self.syntax_error('missing close tag for %s' % self.stack[-1][2])
+ nstag = self.stack[-1][2]
+ method = self.elements.get(nstag, (None, None))[1]
+ if method is not None:
+ self.handle_endtag(nstag, method)
+ else:
+ self.unknown_endtag(nstag)
+ if self.__use_namespaces == len(self.stack):
+ self.__use_namespaces = 0
+ del self.stack[-1]
+
+ # Overridable -- handle xml processing instruction
+ def handle_xml(self, encoding, standalone):
+ pass
+
+ # Overridable -- handle DOCTYPE
+ def handle_doctype(self, tag, pubid, syslit, data):
+ pass
+
+ # Overridable -- handle start tag
+ def handle_starttag(self, tag, method, attrs):
+ method(attrs)
+
+ # Overridable -- handle end tag
+ def handle_endtag(self, tag, method):
+ method()
+
+ # Example -- handle character reference, no need to override
+ def handle_charref(self, name):
+ try:
+ if name[0] == 'x':
+ n = int(name[1:], 16)
+ else:
+ n = int(name)
+ except ValueError:
+ self.unknown_charref(name)
+ return
+ if not 0 <= n <= 255:
+ self.unknown_charref(name)
+ return
+ self.handle_data(chr(n))
+
+ # Definition of entities -- derived classes may override
+ entitydefs = {'lt': '&#60;', # must use charref
+ 'gt': '&#62;',
+ 'amp': '&#38;', # must use charref
+ 'quot': '&#34;',
+ 'apos': '&#39;',
+ }
+
+ # Example -- handle data, should be overridden
+ def handle_data(self, data):
+ pass
+
+ # Example -- handle cdata, could be overridden
+ def handle_cdata(self, data):
+ pass
+
+ # Example -- handle comment, could be overridden
+ def handle_comment(self, data):
+ pass
+
+ # Example -- handle processing instructions, could be overridden
+ def handle_proc(self, name, data):
+ pass
+
+ # Example -- handle relatively harmless syntax errors, could be overridden
+ def syntax_error(self, message):
+ raise Error('Syntax error at line %d: %s' % (self.lineno, message))
+
+ # To be overridden -- handlers for unknown objects
+ def unknown_starttag(self, tag, attrs): pass
+ def unknown_endtag(self, tag): pass
+ def unknown_charref(self, ref): pass
+ def unknown_entityref(self, name):
+ self.syntax_error("reference to unknown entity `&%s;'" % name)
+
+
+class TestXMLParser(XMLParser):
+
+ def __init__(self, **kw):
+ self.testdata = ""
+ XMLParser.__init__(self, **kw)
+
+ def handle_xml(self, encoding, standalone):
+ self.flush()
+ print 'xml: encoding =',encoding,'standalone =',standalone
+
+ def handle_doctype(self, tag, pubid, syslit, data):
+ self.flush()
+ print 'DOCTYPE:',tag, repr(data)
+
+ def handle_data(self, data):
+ self.testdata = self.testdata + data
+ if len(repr(self.testdata)) >= 70:
+ self.flush()
+
+ def flush(self):
+ data = self.testdata
+ if data:
+ self.testdata = ""
+ print 'data:', repr(data)
+
+ def handle_cdata(self, data):
+ self.flush()
+ print 'cdata:', repr(data)
+
+ def handle_proc(self, name, data):
+ self.flush()
+ print 'processing:',name,repr(data)
+
+ def handle_comment(self, data):
+ self.flush()
+ r = repr(data)
+ if len(r) > 68:
+ r = r[:32] + '...' + r[-32:]
+ print 'comment:', r
+
+ def syntax_error(self, message):
+ print 'error at line %d:' % self.lineno, message
+
+ def unknown_starttag(self, tag, attrs):
+ self.flush()
+ if not attrs:
+ print 'start tag: <' + tag + '>'
+ else:
+ print 'start tag: <' + tag,
+ for name, value in attrs.items():
+ print name + '=' + '"' + value + '"',
+ print '>'
+
+ def unknown_endtag(self, tag):
+ self.flush()
+ print 'end tag: </' + tag + '>'
+
+ def unknown_entityref(self, ref):
+ self.flush()
+ print '*** unknown entity ref: &' + ref + ';'
+
+ def unknown_charref(self, ref):
+ self.flush()
+ print '*** unknown char ref: &#' + ref + ';'
+
+ def close(self):
+ XMLParser.close(self)
+ self.flush()
+
+def test(args = None):
+ import sys, getopt
+ from time import time
+
+ if not args:
+ args = sys.argv[1:]
+
+ opts, args = getopt.getopt(args, 'st')
+ klass = TestXMLParser
+ do_time = 0
+ for o, a in opts:
+ if o == '-s':
+ klass = XMLParser
+ elif o == '-t':
+ do_time = 1
+
+ if args:
+ file = args[0]
+ else:
+ file = 'test.xml'
+
+ if file == '-':
+ f = sys.stdin
+ else:
+ try:
+ f = open(file, 'r')
+ except IOError, msg:
+ print file, ":", msg
+ sys.exit(1)
+
+ data = f.read()
+ if f is not sys.stdin:
+ f.close()
+
+ x = klass()
+ t0 = time()
+ try:
+ if do_time:
+ x.feed(data)
+ x.close()
+ else:
+ for c in data:
+ x.feed(c)
+ x.close()
+ except Error, msg:
+ t1 = time()
+ print msg
+ if do_time:
+ print 'total time: %g' % (t1-t0)
+ sys.exit(1)
+ t1 = time()
+ if do_time:
+ print 'total time: %g' % (t1-t0)
+
+
+if __name__ == '__main__':
+ test()
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
index 0000000000..96010ecc31
--- /dev/null
+++ b/AppPkg/Applications/Python/Python-2.7.10/Lib/zipfile.py
@@ -0,0 +1,1539 @@
+"""
+Read and write ZIP files.
+"""
+import struct, os, time, sys, shutil
+import binascii, cStringIO, stat
+import io
+import re
+import string
+
+try:
+ import zlib # We may need its compression method
+ crc32 = zlib.crc32
+except ImportError:
+ zlib = None
+ crc32 = binascii.crc32
+
+__all__ = ["BadZipfile", "error", "ZIP_STORED", "ZIP_DEFLATED", "is_zipfile",
+ "ZipInfo", "ZipFile", "PyZipFile", "LargeZipFile" ]
+
+class BadZipfile(Exception):
+ pass
+
+
+class LargeZipFile(Exception):
+ """
+ Raised when writing a zipfile, the zipfile requires ZIP64 extensions
+ and those extensions are disabled.
+ """
+
+error = BadZipfile # The exception raised by this module
+
+ZIP64_LIMIT = (1 << 31) - 1
+ZIP_FILECOUNT_LIMIT = (1 << 16) - 1
+ZIP_MAX_COMMENT = (1 << 16) - 1
+
+# constants for Zip file compression methods
+ZIP_STORED = 0
+ZIP_DEFLATED = 8
+# Other ZIP compression methods not supported
+
+# Below are some formats and associated data for reading/writing headers using
+# the struct module. The names and structures of headers/records are those used
+# in the PKWARE description of the ZIP file format:
+# http://www.pkware.com/documents/casestudies/APPNOTE.TXT
+# (URL valid as of January 2008)
+
+# The "end of central directory" structure, magic number, size, and indices
+# (section V.I in the format document)
+structEndArchive = "<4s4H2LH"
+stringEndArchive = "PK\005\006"
+sizeEndCentDir = struct.calcsize(structEndArchive)
+
+_ECD_SIGNATURE = 0
+_ECD_DISK_NUMBER = 1
+_ECD_DISK_START = 2
+_ECD_ENTRIES_THIS_DISK = 3
+_ECD_ENTRIES_TOTAL = 4
+_ECD_SIZE = 5
+_ECD_OFFSET = 6
+_ECD_COMMENT_SIZE = 7
+# These last two indices are not part of the structure as defined in the
+# spec, but they are used internally by this module as a convenience
+_ECD_COMMENT = 8
+_ECD_LOCATION = 9
+
+# The "central directory" structure, magic number, size, and indices
+# of entries in the structure (section V.F in the format document)
+structCentralDir = "<4s4B4HL2L5H2L"
+stringCentralDir = "PK\001\002"
+sizeCentralDir = struct.calcsize(structCentralDir)
+
+# indexes of entries in the central directory structure
+_CD_SIGNATURE = 0
+_CD_CREATE_VERSION = 1
+_CD_CREATE_SYSTEM = 2
+_CD_EXTRACT_VERSION = 3
+_CD_EXTRACT_SYSTEM = 4
+_CD_FLAG_BITS = 5
+_CD_COMPRESS_TYPE = 6
+_CD_TIME = 7
+_CD_DATE = 8
+_CD_CRC = 9
+_CD_COMPRESSED_SIZE = 10
+_CD_UNCOMPRESSED_SIZE = 11
+_CD_FILENAME_LENGTH = 12
+_CD_EXTRA_FIELD_LENGTH = 13
+_CD_COMMENT_LENGTH = 14
+_CD_DISK_NUMBER_START = 15
+_CD_INTERNAL_FILE_ATTRIBUTES = 16
+_CD_EXTERNAL_FILE_ATTRIBUTES = 17
+_CD_LOCAL_HEADER_OFFSET = 18
+
+# The "local file header" structure, magic number, size, and indices
+# (section V.A in the format document)
+structFileHeader = "<4s2B4HL2L2H"
+stringFileHeader = "PK\003\004"
+sizeFileHeader = struct.calcsize(structFileHeader)
+
+_FH_SIGNATURE = 0
+_FH_EXTRACT_VERSION = 1
+_FH_EXTRACT_SYSTEM = 2
+_FH_GENERAL_PURPOSE_FLAG_BITS = 3
+_FH_COMPRESSION_METHOD = 4
+_FH_LAST_MOD_TIME = 5
+_FH_LAST_MOD_DATE = 6
+_FH_CRC = 7
+_FH_COMPRESSED_SIZE = 8
+_FH_UNCOMPRESSED_SIZE = 9
+_FH_FILENAME_LENGTH = 10
+_FH_EXTRA_FIELD_LENGTH = 11
+
+# The "Zip64 end of central directory locator" structure, magic number, and size
+structEndArchive64Locator = "<4sLQL"
+stringEndArchive64Locator = "PK\x06\x07"
+sizeEndCentDir64Locator = struct.calcsize(structEndArchive64Locator)
+
+# The "Zip64 end of central directory" record, magic number, size, and indices
+# (section V.G in the format document)
+structEndArchive64 = "<4sQ2H2L4Q"
+stringEndArchive64 = "PK\x06\x06"
+sizeEndCentDir64 = struct.calcsize(structEndArchive64)
+
+_CD64_SIGNATURE = 0
+_CD64_DIRECTORY_RECSIZE = 1
+_CD64_CREATE_VERSION = 2
+_CD64_EXTRACT_VERSION = 3
+_CD64_DISK_NUMBER = 4
+_CD64_DISK_NUMBER_START = 5
+_CD64_NUMBER_ENTRIES_THIS_DISK = 6
+_CD64_NUMBER_ENTRIES_TOTAL = 7
+_CD64_DIRECTORY_SIZE = 8
+_CD64_OFFSET_START_CENTDIR = 9
+
+def _check_zipfile(fp):
+ try:
+ if _EndRecData(fp):
+ return True # file has correct magic number
+ except IOError:
+ pass
+ return False
+
+def is_zipfile(filename):
+ """Quickly see if a file is a ZIP file by checking the magic number.
+
+ The filename argument may be a file or file-like object too.
+ """
+ result = False
+ try:
+ if hasattr(filename, "read"):
+ result = _check_zipfile(fp=filename)
+ else:
+ with open(filename, "rb") as fp:
+ result = _check_zipfile(fp)
+ except IOError:
+ pass
+ return result
+
+def _EndRecData64(fpin, offset, endrec):
+ """
+ Read the ZIP64 end-of-archive records and use that to update endrec
+ """
+ try:
+ fpin.seek(offset - sizeEndCentDir64Locator, 2)
+ except IOError:
+ # If the seek fails, the file is not large enough to contain a ZIP64
+ # end-of-archive record, so just return the end record we were given.
+ return endrec
+
+ data = fpin.read(sizeEndCentDir64Locator)
+ if len(data) != sizeEndCentDir64Locator:
+ return endrec
+ sig, diskno, reloff, disks = struct.unpack(structEndArchive64Locator, data)
+ if sig != stringEndArchive64Locator:
+ return endrec
+
+ if diskno != 0 or disks != 1:
+ raise BadZipfile("zipfiles that span multiple disks are not supported")
+
+ # Assume no 'zip64 extensible data'
+ fpin.seek(offset - sizeEndCentDir64Locator - sizeEndCentDir64, 2)
+ data = fpin.read(sizeEndCentDir64)
+ if len(data) != sizeEndCentDir64:
+ return endrec
+ sig, sz, create_version, read_version, disk_num, disk_dir, \
+ dircount, dircount2, dirsize, diroffset = \
+ struct.unpack(structEndArchive64, data)
+ if sig != stringEndArchive64:
+ return endrec
+
+ # Update the original endrec using data from the ZIP64 record
+ endrec[_ECD_SIGNATURE] = sig
+ endrec[_ECD_DISK_NUMBER] = disk_num
+ endrec[_ECD_DISK_START] = disk_dir
+ endrec[_ECD_ENTRIES_THIS_DISK] = dircount
+ endrec[_ECD_ENTRIES_TOTAL] = dircount2
+ endrec[_ECD_SIZE] = dirsize
+ endrec[_ECD_OFFSET] = diroffset
+ return endrec
+
+
+def _EndRecData(fpin):
+ """Return data from the "End of Central Directory" record, or None.
+
+ The data is a list of the nine items in the ZIP "End of central dir"
+ record followed by a tenth item, the file seek offset of this record."""
+
+ # Determine file size
+ fpin.seek(0, 2)
+ filesize = fpin.tell()
+
+ # Check to see if this is ZIP file with no archive comment (the
+ # "end of central directory" structure should be the last item in the
+ # file if this is the case).
+ try:
+ fpin.seek(-sizeEndCentDir, 2)
+ except IOError:
+ return None
+ data = fpin.read()
+ if (len(data) == sizeEndCentDir and
+ data[0:4] == stringEndArchive and
+ data[-2:] == b"\000\000"):
+ # the signature is correct and there's no comment, unpack structure
+ endrec = struct.unpack(structEndArchive, data)
+ endrec=list(endrec)
+
+ # Append a blank comment and record start offset
+ endrec.append("")
+ endrec.append(filesize - sizeEndCentDir)
+
+ # Try to read the "Zip64 end of central directory" structure
+ return _EndRecData64(fpin, -sizeEndCentDir, endrec)
+
+ # Either this is not a ZIP file, or it is a ZIP file with an archive
+ # comment. Search the end of the file for the "end of central directory"
+ # record signature. The comment is the last item in the ZIP file and may be
+ # up to 64K long. It is assumed that the "end of central directory" magic
+ # number does not appear in the comment.
+ maxCommentStart = max(filesize - (1 << 16) - sizeEndCentDir, 0)
+ fpin.seek(maxCommentStart, 0)
+ data = fpin.read()
+ start = data.rfind(stringEndArchive)
+ if start >= 0:
+ # found the magic number; attempt to unpack and interpret
+ recData = data[start:start+sizeEndCentDir]
+ if len(recData) != sizeEndCentDir:
+ # Zip file is corrupted.
+ return None
+ endrec = list(struct.unpack(structEndArchive, recData))
+ commentSize = endrec[_ECD_COMMENT_SIZE] #as claimed by the zip file
+ comment = data[start+sizeEndCentDir:start+sizeEndCentDir+commentSize]
+ endrec.append(comment)
+ endrec.append(maxCommentStart + start)
+
+ # Try to read the "Zip64 end of central directory" structure
+ return _EndRecData64(fpin, maxCommentStart + start - filesize,
+ endrec)
+
+ # Unable to find a valid end of central directory structure
+ return None
+
+
+class ZipInfo (object):
+ """Class with attributes describing each file in the ZIP archive."""
+
+ __slots__ = (
+ 'orig_filename',
+ 'filename',
+ 'date_time',
+ 'compress_type',
+ 'comment',
+ 'extra',
+ 'create_system',
+ 'create_version',
+ 'extract_version',
+ 'reserved',
+ 'flag_bits',
+ 'volume',
+ 'internal_attr',
+ 'external_attr',
+ 'header_offset',
+ 'CRC',
+ 'compress_size',
+ 'file_size',
+ '_raw_time',
+ )
+
+ def __init__(self, filename="NoName", date_time=(1980,1,1,0,0,0)):
+ self.orig_filename = filename # Original file name in archive
+
+ # Terminate the file name at the first null byte. Null bytes in file
+ # names are used as tricks by viruses in archives.
+ null_byte = filename.find(chr(0))
+ if null_byte >= 0:
+ filename = filename[0:null_byte]
+ # This is used to ensure paths in generated ZIP files always use
+ # forward slashes as the directory separator, as required by the
+ # ZIP format specification.
+ if os.sep != "/" and os.sep in filename:
+ filename = filename.replace(os.sep, "/")
+
+ self.filename = filename # Normalized file name
+ self.date_time = date_time # year, month, day, hour, min, sec
+
+ if date_time[0] < 1980:
+ raise ValueError('ZIP does not support timestamps before 1980')
+
+ # Standard values:
+ self.compress_type = ZIP_STORED # Type of compression for the file
+ self.comment = "" # Comment for each file
+ self.extra = "" # ZIP extra data
+ if sys.platform == 'win32':
+ self.create_system = 0 # System which created ZIP archive
+ else:
+ # Assume everything else is unix-y
+ self.create_system = 3 # System which created ZIP archive
+ self.create_version = 20 # Version which created ZIP archive
+ self.extract_version = 20 # Version needed to extract archive
+ self.reserved = 0 # Must be zero
+ self.flag_bits = 0 # ZIP flag bits
+ self.volume = 0 # Volume number of file header
+ self.internal_attr = 0 # Internal attributes
+ self.external_attr = 0 # External file attributes
+ # Other attributes are set by class ZipFile:
+ # header_offset Byte offset to the file header
+ # CRC CRC-32 of the uncompressed file
+ # compress_size Size of the compressed file
+ # file_size Size of the uncompressed file
+
+ def FileHeader(self, zip64=None):
+ """Return the per-file header as a string."""
+ dt = self.date_time
+ dosdate = (dt[0] - 1980) << 9 | dt[1] << 5 | dt[2]
+ dostime = dt[3] << 11 | dt[4] << 5 | (dt[5] // 2)
+ if self.flag_bits & 0x08:
+ # Set these to zero because we write them after the file data
+ CRC = compress_size = file_size = 0
+ else:
+ CRC = self.CRC
+ compress_size = self.compress_size
+ file_size = self.file_size
+
+ extra = self.extra
+
+ if zip64 is None:
+ zip64 = file_size > ZIP64_LIMIT or compress_size > ZIP64_LIMIT
+ if zip64:
+ fmt = '<HHQQ'
+ extra = extra + struct.pack(fmt,
+ 1, struct.calcsize(fmt)-4, file_size, compress_size)
+ if file_size > ZIP64_LIMIT or compress_size > ZIP64_LIMIT:
+ if not zip64:
+ raise LargeZipFile("Filesize would require ZIP64 extensions")
+ # File is larger than what fits into a 4 byte integer,
+ # fall back to the ZIP64 extension
+ file_size = 0xffffffff
+ compress_size = 0xffffffff
+ self.extract_version = max(45, self.extract_version)
+ self.create_version = max(45, self.extract_version)
+
+ filename, flag_bits = self._encodeFilenameFlags()
+ header = struct.pack(structFileHeader, stringFileHeader,
+ self.extract_version, self.reserved, flag_bits,
+ self.compress_type, dostime, dosdate, CRC,
+ compress_size, file_size,
+ len(filename), len(extra))
+ return header + filename + extra
+
+ def _encodeFilenameFlags(self):
+ if isinstance(self.filename, unicode):
+ try:
+ return self.filename.encode('ascii'), self.flag_bits
+ except UnicodeEncodeError:
+ return self.filename.encode('utf-8'), self.flag_bits | 0x800
+ else:
+ return self.filename, self.flag_bits
+
+ def _decodeFilename(self):
+ if self.flag_bits & 0x800:
+ return self.filename.decode('utf-8')
+ else:
+ return self.filename
+
+ def _decodeExtra(self):
+ # Try to decode the extra field.
+ extra = self.extra
+ unpack = struct.unpack
+ while len(extra) >= 4:
+ tp, ln = unpack('<HH', extra[:4])
+ if tp == 1:
+ if ln >= 24:
+ counts = unpack('<QQQ', extra[4:28])
+ elif ln == 16:
+ counts = unpack('<QQ', extra[4:20])
+ elif ln == 8:
+ counts = unpack('<Q', extra[4:12])
+ elif ln == 0:
+ counts = ()
+ else:
+ raise RuntimeError, "Corrupt extra field %s"%(ln,)
+
+ idx = 0
+
+ # ZIP64 extension (large files and/or large archives)
+ if self.file_size in (0xffffffffffffffffL, 0xffffffffL):
+ self.file_size = counts[idx]
+ idx += 1
+
+ if self.compress_size == 0xFFFFFFFFL:
+ self.compress_size = counts[idx]
+ idx += 1
+
+ if self.header_offset == 0xffffffffL:
+ old = self.header_offset
+ self.header_offset = counts[idx]
+ idx+=1
+
+ extra = extra[ln+4:]
+
+
+class _ZipDecrypter:
+ """Class to handle decryption of files stored within a ZIP archive.
+
+ ZIP supports a password-based form of encryption. Even though known
+ plaintext attacks have been found against it, it is still useful
+ to be able to get data out of such a file.
+
+ Usage:
+ zd = _ZipDecrypter(mypwd)
+ plain_char = zd(cypher_char)
+ plain_text = map(zd, cypher_text)
+ """
+
+ def _GenerateCRCTable():
+ """Generate a CRC-32 table.
+
+ ZIP encryption uses the CRC32 one-byte primitive for scrambling some
+ internal keys. We noticed that a direct implementation is faster than
+ relying on binascii.crc32().
+ """
+ poly = 0xedb88320
+ table = [0] * 256
+ for i in range(256):
+ crc = i
+ for j in range(8):
+ if crc & 1:
+ crc = ((crc >> 1) & 0x7FFFFFFF) ^ poly
+ else:
+ crc = ((crc >> 1) & 0x7FFFFFFF)
+ table[i] = crc
+ return table
+ crctable = _GenerateCRCTable()
+
+ def _crc32(self, ch, crc):
+ """Compute the CRC32 primitive on one byte."""
+ return ((crc >> 8) & 0xffffff) ^ self.crctable[(crc ^ ord(ch)) & 0xff]
+
+ def __init__(self, pwd):
+ self.key0 = 305419896
+ self.key1 = 591751049
+ self.key2 = 878082192
+ for p in pwd:
+ self._UpdateKeys(p)
+
+ def _UpdateKeys(self, c):
+ self.key0 = self._crc32(c, self.key0)
+ self.key1 = (self.key1 + (self.key0 & 255)) & 4294967295
+ self.key1 = (self.key1 * 134775813 + 1) & 4294967295
+ self.key2 = self._crc32(chr((self.key1 >> 24) & 255), self.key2)
+
+ def __call__(self, c):
+ """Decrypt a single character."""
+ c = ord(c)
+ k = self.key2 | 2
+ c = c ^ (((k * (k^1)) >> 8) & 255)
+ c = chr(c)
+ self._UpdateKeys(c)
+ return c
+
+
+compressor_names = {
+ 0: 'store',
+ 1: 'shrink',
+ 2: 'reduce',
+ 3: 'reduce',
+ 4: 'reduce',
+ 5: 'reduce',
+ 6: 'implode',
+ 7: 'tokenize',
+ 8: 'deflate',
+ 9: 'deflate64',
+ 10: 'implode',
+ 12: 'bzip2',
+ 14: 'lzma',
+ 18: 'terse',
+ 19: 'lz77',
+ 97: 'wavpack',
+ 98: 'ppmd',
+}
+
+
+class ZipExtFile(io.BufferedIOBase):
+ """File-like object for reading an archive member.
+ Is returned by ZipFile.open().
+ """
+
+ # Max size supported by decompressor.
+ MAX_N = 1 << 31 - 1
+
+ # Read from compressed files in 4k blocks.
+ MIN_READ_SIZE = 4096
+
+ # Search for universal newlines or line chunks.
+ PATTERN = re.compile(r'^(?P<chunk>[^\r\n]+)|(?P<newline>\n|\r\n?)')
+
+ def __init__(self, fileobj, mode, zipinfo, decrypter=None,
+ close_fileobj=False):
+ self._fileobj = fileobj
+ self._decrypter = decrypter
+ self._close_fileobj = close_fileobj
+
+ self._compress_type = zipinfo.compress_type
+ self._compress_size = zipinfo.compress_size
+ self._compress_left = zipinfo.compress_size
+
+ if self._compress_type == ZIP_DEFLATED:
+ self._decompressor = zlib.decompressobj(-15)
+ elif self._compress_type != ZIP_STORED:
+ descr = compressor_names.get(self._compress_type)
+ if descr:
+ raise NotImplementedError("compression type %d (%s)" % (self._compress_type, descr))
+ else:
+ raise NotImplementedError("compression type %d" % (self._compress_type,))
+ self._unconsumed = ''
+
+ self._readbuffer = ''
+ self._offset = 0
+
+ self._universal = 'U' in mode
+ self.newlines = None
+
+ # Adjust read size for encrypted files since the first 12 bytes
+ # are for the encryption/password information.
+ if self._decrypter is not None:
+ self._compress_left -= 12
+
+ self.mode = mode
+ self.name = zipinfo.filename
+
+ if hasattr(zipinfo, 'CRC'):
+ self._expected_crc = zipinfo.CRC
+ self._running_crc = crc32(b'') & 0xffffffff
+ else:
+ self._expected_crc = None
+
+ def readline(self, limit=-1):
+ """Read and return a line from the stream.
+
+ If limit is specified, at most limit bytes will be read.
+ """
+
+ if not self._universal and limit < 0:
+ # Shortcut common case - newline found in buffer.
+ i = self._readbuffer.find('\n', self._offset) + 1
+ if i > 0:
+ line = self._readbuffer[self._offset: i]
+ self._offset = i
+ return line
+
+ if not self._universal:
+ return io.BufferedIOBase.readline(self, limit)
+
+ line = ''
+ while limit < 0 or len(line) < limit:
+ readahead = self.peek(2)
+ if readahead == '':
+ return line
+
+ #
+ # Search for universal newlines or line chunks.
+ #
+ # The pattern returns either a line chunk or a newline, but not
+ # both. Combined with peek(2), we are assured that the sequence
+ # '\r\n' is always retrieved completely and never split into
+ # separate newlines - '\r', '\n' due to coincidental readaheads.
+ #
+ match = self.PATTERN.search(readahead)
+ newline = match.group('newline')
+ if newline is not None:
+ if self.newlines is None:
+ self.newlines = []
+ if newline not in self.newlines:
+ self.newlines.append(newline)
+ self._offset += len(newline)
+ return line + '\n'
+
+ chunk = match.group('chunk')
+ if limit >= 0:
+ chunk = chunk[: limit - len(line)]
+
+ self._offset += len(chunk)
+ line += chunk
+
+ return line
+
+ def peek(self, n=1):
+ """Returns buffered bytes without advancing the position."""
+ if n > len(self._readbuffer) - self._offset:
+ chunk = self.read(n)
+ if len(chunk) > self._offset:
+ self._readbuffer = chunk + self._readbuffer[self._offset:]
+ self._offset = 0
+ else:
+ self._offset -= len(chunk)
+
+ # Return up to 512 bytes to reduce allocation overhead for tight loops.
+ return self._readbuffer[self._offset: self._offset + 512]
+
+ def readable(self):
+ return True
+
+ def read(self, n=-1):
+ """Read and return up to n bytes.
+ If the argument is omitted, None, or negative, data is read and returned until EOF is reached..
+ """
+ buf = ''
+ if n is None:
+ n = -1
+ while True:
+ if n < 0:
+ data = self.read1(n)
+ elif n > len(buf):
+ data = self.read1(n - len(buf))
+ else:
+ return buf
+ if len(data) == 0:
+ return buf
+ buf += data
+
+ def _update_crc(self, newdata, eof):
+ # Update the CRC using the given data.
+ if self._expected_crc is None:
+ # No need to compute the CRC if we don't have a reference value
+ return
+ self._running_crc = crc32(newdata, self._running_crc) & 0xffffffff
+ # Check the CRC if we're at the end of the file
+ if eof and self._running_crc != self._expected_crc:
+ raise BadZipfile("Bad CRC-32 for file %r" % self.name)
+
+ def read1(self, n):
+ """Read up to n bytes with at most one read() system call."""
+
+ # Simplify algorithm (branching) by transforming negative n to large n.
+ if n < 0 or n is None:
+ n = self.MAX_N
+
+ # Bytes available in read buffer.
+ len_readbuffer = len(self._readbuffer) - self._offset
+
+ # Read from file.
+ if self._compress_left > 0 and n > len_readbuffer + len(self._unconsumed):
+ nbytes = n - len_readbuffer - len(self._unconsumed)
+ nbytes = max(nbytes, self.MIN_READ_SIZE)
+ nbytes = min(nbytes, self._compress_left)
+
+ data = self._fileobj.read(nbytes)
+ self._compress_left -= len(data)
+
+ if data and self._decrypter is not None:
+ data = ''.join(map(self._decrypter, data))
+
+ if self._compress_type == ZIP_STORED:
+ self._update_crc(data, eof=(self._compress_left==0))
+ self._readbuffer = self._readbuffer[self._offset:] + data
+ self._offset = 0
+ else:
+ # Prepare deflated bytes for decompression.
+ self._unconsumed += data
+
+ # Handle unconsumed data.
+ if (len(self._unconsumed) > 0 and n > len_readbuffer and
+ self._compress_type == ZIP_DEFLATED):
+ data = self._decompressor.decompress(
+ self._unconsumed,
+ max(n - len_readbuffer, self.MIN_READ_SIZE)
+ )
+
+ self._unconsumed = self._decompressor.unconsumed_tail
+ eof = len(self._unconsumed) == 0 and self._compress_left == 0
+ if eof:
+ data += self._decompressor.flush()
+
+ self._update_crc(data, eof=eof)
+ self._readbuffer = self._readbuffer[self._offset:] + data
+ self._offset = 0
+
+ # Read from buffer.
+ data = self._readbuffer[self._offset: self._offset + n]
+ self._offset += len(data)
+ return data
+
+ def close(self):
+ try :
+ if self._close_fileobj:
+ self._fileobj.close()
+ finally:
+ super(ZipExtFile, self).close()
+
+
+class ZipFile(object):
+ """ Class with methods to open, read, write, close, list zip files.
+
+ z = ZipFile(file, mode="r", compression=ZIP_STORED, allowZip64=False)
+
+ file: Either the path to the file, or a file-like object.
+ If it is a path, the file will be opened and closed by ZipFile.
+ mode: The mode can be either read "r", write "w" or append "a".
+ compression: ZIP_STORED (no compression) or ZIP_DEFLATED (requires zlib).
+ allowZip64: if True ZipFile will create files with ZIP64 extensions when
+ needed, otherwise it will raise an exception when this would
+ be necessary.
+
+ """
+
+ fp = None # Set here since __del__ checks it
+
+ def __init__(self, file, mode="r", compression=ZIP_STORED, allowZip64=False):
+ """Open the ZIP file with mode read "r", write "w" or append "a"."""
+ if mode not in ("r", "w", "a"):
+ raise RuntimeError('ZipFile() requires mode "r", "w", or "a"')
+
+ if compression == ZIP_STORED:
+ pass
+ elif compression == ZIP_DEFLATED:
+ if not zlib:
+ raise RuntimeError,\
+ "Compression requires the (missing) zlib module"
+ else:
+ raise RuntimeError, "That compression method is not supported"
+
+ self._allowZip64 = allowZip64
+ self._didModify = False
+ self.debug = 0 # Level of printing: 0 through 3
+ self.NameToInfo = {} # Find file info given name
+ self.filelist = [] # List of ZipInfo instances for archive
+ self.compression = compression # Method of compression
+ self.mode = key = mode.replace('b', '')[0]
+ self.pwd = None
+ self._comment = ''
+
+ # Check if we were passed a file-like object
+ if isinstance(file, basestring):
+ self._filePassed = 0
+ self.filename = file
+ modeDict = {'r' : 'rb', 'w': 'wb', 'a' : 'r+b'}
+ try:
+ self.fp = open(file, modeDict[mode])
+ except IOError:
+ if mode == 'a':
+ mode = key = 'w'
+ self.fp = open(file, modeDict[mode])
+ else:
+ raise
+ else:
+ self._filePassed = 1
+ self.fp = file
+ self.filename = getattr(file, 'name', None)
+
+ try:
+ if key == 'r':
+ self._RealGetContents()
+ elif key == 'w':
+ # set the modified flag so central directory gets written
+ # even if no files are added to the archive
+ self._didModify = True
+ elif key == 'a':
+ try:
+ # See if file is a zip file
+ self._RealGetContents()
+ # seek to start of directory and overwrite
+ self.fp.seek(self.start_dir, 0)
+ except BadZipfile:
+ # file is not a zip file, just append
+ self.fp.seek(0, 2)
+
+ # set the modified flag so central directory gets written
+ # even if no files are added to the archive
+ self._didModify = True
+ else:
+ raise RuntimeError('Mode must be "r", "w" or "a"')
+ except:
+ fp = self.fp
+ self.fp = None
+ if not self._filePassed:
+ fp.close()
+ raise
+
+ def __enter__(self):
+ return self
+
+ def __exit__(self, type, value, traceback):
+ self.close()
+
+ def _RealGetContents(self):
+ """Read in the table of contents for the ZIP file."""
+ fp = self.fp
+ try:
+ endrec = _EndRecData(fp)
+ except IOError:
+ raise BadZipfile("File is not a zip file")
+ if not endrec:
+ raise BadZipfile, "File is not a zip file"
+ if self.debug > 1:
+ print endrec
+ size_cd = endrec[_ECD_SIZE] # bytes in central directory
+ offset_cd = endrec[_ECD_OFFSET] # offset of central directory
+ self._comment = endrec[_ECD_COMMENT] # archive comment
+
+ # "concat" is zero, unless zip was concatenated to another file
+ concat = endrec[_ECD_LOCATION] - size_cd - offset_cd
+ if endrec[_ECD_SIGNATURE] == stringEndArchive64:
+ # If Zip64 extension structures are present, account for them
+ concat -= (sizeEndCentDir64 + sizeEndCentDir64Locator)
+
+ if self.debug > 2:
+ inferred = concat + offset_cd
+ print "given, inferred, offset", offset_cd, inferred, concat
+ # self.start_dir: Position of start of central directory
+ self.start_dir = offset_cd + concat
+ fp.seek(self.start_dir, 0)
+ data = fp.read(size_cd)
+ fp = cStringIO.StringIO(data)
+ total = 0
+ while total < size_cd:
+ centdir = fp.read(sizeCentralDir)
+ if len(centdir) != sizeCentralDir:
+ raise BadZipfile("Truncated central directory")
+ centdir = struct.unpack(structCentralDir, centdir)
+ if centdir[_CD_SIGNATURE] != stringCentralDir:
+ raise BadZipfile("Bad magic number for central directory")
+ if self.debug > 2:
+ print centdir
+ filename = fp.read(centdir[_CD_FILENAME_LENGTH])
+ # Create ZipInfo instance to store file information
+ x = ZipInfo(filename)
+ x.extra = fp.read(centdir[_CD_EXTRA_FIELD_LENGTH])
+ x.comment = fp.read(centdir[_CD_COMMENT_LENGTH])
+ x.header_offset = centdir[_CD_LOCAL_HEADER_OFFSET]
+ (x.create_version, x.create_system, x.extract_version, x.reserved,
+ x.flag_bits, x.compress_type, t, d,
+ x.CRC, x.compress_size, x.file_size) = centdir[1:12]
+ x.volume, x.internal_attr, x.external_attr = centdir[15:18]
+ # Convert date/time code to (year, month, day, hour, min, sec)
+ x._raw_time = t
+ x.date_time = ( (d>>9)+1980, (d>>5)&0xF, d&0x1F,
+ t>>11, (t>>5)&0x3F, (t&0x1F) * 2 )
+
+ x._decodeExtra()
+ x.header_offset = x.header_offset + concat
+ x.filename = x._decodeFilename()
+ self.filelist.append(x)
+ self.NameToInfo[x.filename] = x
+
+ # update total bytes read from central directory
+ total = (total + sizeCentralDir + centdir[_CD_FILENAME_LENGTH]
+ + centdir[_CD_EXTRA_FIELD_LENGTH]
+ + centdir[_CD_COMMENT_LENGTH])
+
+ if self.debug > 2:
+ print "total", total
+
+
+ def namelist(self):
+ """Return a list of file names in the archive."""
+ l = []
+ for data in self.filelist:
+ l.append(data.filename)
+ return l
+
+ def infolist(self):
+ """Return a list of class ZipInfo instances for files in the
+ archive."""
+ return self.filelist
+
+ def printdir(self):
+ """Print a table of contents for the zip file."""
+ print "%-46s %19s %12s" % ("File Name", "Modified ", "Size")
+ for zinfo in self.filelist:
+ date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time[:6]
+ print "%-46s %s %12d" % (zinfo.filename, date, zinfo.file_size)
+
+ def testzip(self):
+ """Read all the files and check the CRC."""
+ chunk_size = 2 ** 20
+ for zinfo in self.filelist:
+ try:
+ # Read by chunks, to avoid an OverflowError or a
+ # MemoryError with very large embedded files.
+ with self.open(zinfo.filename, "r") as f:
+ while f.read(chunk_size): # Check CRC-32
+ pass
+ except BadZipfile:
+ return zinfo.filename
+
+ def getinfo(self, name):
+ """Return the instance of ZipInfo given 'name'."""
+ info = self.NameToInfo.get(name)
+ if info is None:
+ raise KeyError(
+ 'There is no item named %r in the archive' % name)
+
+ return info
+
+ def setpassword(self, pwd):
+ """Set default password for encrypted files."""
+ self.pwd = pwd
+
+ @property
+ def comment(self):
+ """The comment text associated with the ZIP file."""
+ return self._comment
+
+ @comment.setter
+ def comment(self, comment):
+ # check for valid comment length
+ if len(comment) > ZIP_MAX_COMMENT:
+ import warnings
+ warnings.warn('Archive comment is too long; truncating to %d bytes'
+ % ZIP_MAX_COMMENT, stacklevel=2)
+ comment = comment[:ZIP_MAX_COMMENT]
+ self._comment = comment
+ self._didModify = True
+
+ def read(self, name, pwd=None):
+ """Return file bytes (as a string) for name."""
+ return self.open(name, "r", pwd).read()
+
+ def open(self, name, mode="r", pwd=None):
+ """Return file-like object for 'name'."""
+ if mode not in ("r", "U", "rU"):
+ raise RuntimeError, 'open() requires mode "r", "U", or "rU"'
+ if not self.fp:
+ raise RuntimeError, \
+ "Attempt to read ZIP archive that was already closed"
+
+ # Only open a new file for instances where we were not
+ # given a file object in the constructor
+ if self._filePassed:
+ zef_file = self.fp
+ should_close = False
+ else:
+ zef_file = open(self.filename, 'rb')
+ should_close = True
+
+ try:
+ # Make sure we have an info object
+ if isinstance(name, ZipInfo):
+ # 'name' is already an info object
+ zinfo = name
+ else:
+ # Get info object for name
+ zinfo = self.getinfo(name)
+
+ zef_file.seek(zinfo.header_offset, 0)
+
+ # Skip the file header:
+ fheader = zef_file.read(sizeFileHeader)
+ if len(fheader) != sizeFileHeader:
+ raise BadZipfile("Truncated file header")
+ fheader = struct.unpack(structFileHeader, fheader)
+ if fheader[_FH_SIGNATURE] != stringFileHeader:
+ raise BadZipfile("Bad magic number for file header")
+
+ fname = zef_file.read(fheader[_FH_FILENAME_LENGTH])
+ if fheader[_FH_EXTRA_FIELD_LENGTH]:
+ zef_file.read(fheader[_FH_EXTRA_FIELD_LENGTH])
+
+ if fname != zinfo.orig_filename:
+ raise BadZipfile, \
+ 'File name in directory "%s" and header "%s" differ.' % (
+ zinfo.orig_filename, fname)
+
+ # check for encrypted flag & handle password
+ is_encrypted = zinfo.flag_bits & 0x1
+ zd = None
+ if is_encrypted:
+ if not pwd:
+ pwd = self.pwd
+ if not pwd:
+ raise RuntimeError, "File %s is encrypted, " \
+ "password required for extraction" % name
+
+ zd = _ZipDecrypter(pwd)
+ # The first 12 bytes in the cypher stream is an encryption header
+ # used to strengthen the algorithm. The first 11 bytes are
+ # completely random, while the 12th contains the MSB of the CRC,
+ # or the MSB of the file time depending on the header type
+ # and is used to check the correctness of the password.
+ bytes = zef_file.read(12)
+ h = map(zd, bytes[0:12])
+ if zinfo.flag_bits & 0x8:
+ # compare against the file type from extended local headers
+ check_byte = (zinfo._raw_time >> 8) & 0xff
+ else:
+ # compare against the CRC otherwise
+ check_byte = (zinfo.CRC >> 24) & 0xff
+ if ord(h[11]) != check_byte:
+ raise RuntimeError("Bad password for file", name)
+
+ return ZipExtFile(zef_file, mode, zinfo, zd,
+ close_fileobj=should_close)
+ except:
+ if should_close:
+ zef_file.close()
+ raise
+
+ def extract(self, member, path=None, pwd=None):
+ """Extract a member from the archive to the current working directory,
+ using its full name. Its file information is extracted as accurately
+ as possible. `member' may be a filename or a ZipInfo object. You can
+ specify a different directory using `path'.
+ """
+ if not isinstance(member, ZipInfo):
+ member = self.getinfo(member)
+
+ if path is None:
+ path = os.getcwd()
+
+ return self._extract_member(member, path, pwd)
+
+ def extractall(self, path=None, members=None, pwd=None):
+ """Extract all members from the archive to the current working
+ directory. `path' specifies a different directory to extract to.
+ `members' is optional and must be a subset of the list returned
+ by namelist().
+ """
+ if members is None:
+ members = self.namelist()
+
+ for zipinfo in members:
+ self.extract(zipinfo, path, pwd)
+
+ def _extract_member(self, member, targetpath, pwd):
+ """Extract the ZipInfo object 'member' to a physical
+ file on the path targetpath.
+ """
+ # build the destination pathname, replacing
+ # forward slashes to platform specific separators.
+ arcname = member.filename.replace('/', os.path.sep)
+
+ if os.path.altsep:
+ arcname = arcname.replace(os.path.altsep, os.path.sep)
+ # interpret absolute pathname as relative, remove drive letter or
+ # UNC path, redundant separators, "." and ".." components.
+ arcname = os.path.splitdrive(arcname)[1]
+ arcname = os.path.sep.join(x for x in arcname.split(os.path.sep)
+ if x not in ('', os.path.curdir, os.path.pardir))
+ if os.path.sep == '\\':
+ # filter illegal characters on Windows
+ illegal = ':<>|"?*'
+ if isinstance(arcname, unicode):
+ table = {ord(c): ord('_') for c in illegal}
+ else:
+ table = string.maketrans(illegal, '_' * len(illegal))
+ arcname = arcname.translate(table)
+ # remove trailing dots
+ arcname = (x.rstrip('.') for x in arcname.split(os.path.sep))
+ arcname = os.path.sep.join(x for x in arcname if x)
+
+ targetpath = os.path.join(targetpath, arcname)
+ targetpath = os.path.normpath(targetpath)
+
+ # Create all upper directories if necessary.
+ upperdirs = os.path.dirname(targetpath)
+ if upperdirs and not os.path.exists(upperdirs):
+ os.makedirs(upperdirs)
+
+ if member.filename[-1] == '/':
+ if not os.path.isdir(targetpath):
+ os.mkdir(targetpath)
+ return targetpath
+
+ with self.open(member, pwd=pwd) as source, \
+ file(targetpath, "wb") as target:
+ shutil.copyfileobj(source, target)
+
+ return targetpath
+
+ def _writecheck(self, zinfo):
+ """Check for errors before writing a file to the archive."""
+ if zinfo.filename in self.NameToInfo:
+ import warnings
+ warnings.warn('Duplicate name: %r' % zinfo.filename, stacklevel=3)
+ if self.mode not in ("w", "a"):
+ raise RuntimeError, 'write() requires mode "w" or "a"'
+ if not self.fp:
+ raise RuntimeError, \
+ "Attempt to write ZIP archive that was already closed"
+ if zinfo.compress_type == ZIP_DEFLATED and not zlib:
+ raise RuntimeError, \
+ "Compression requires the (missing) zlib module"
+ if zinfo.compress_type not in (ZIP_STORED, ZIP_DEFLATED):
+ raise RuntimeError, \
+ "That compression method is not supported"
+ if not self._allowZip64:
+ requires_zip64 = None
+ if len(self.filelist) >= ZIP_FILECOUNT_LIMIT:
+ requires_zip64 = "Files count"
+ elif zinfo.file_size > ZIP64_LIMIT:
+ requires_zip64 = "Filesize"
+ elif zinfo.header_offset > ZIP64_LIMIT:
+ requires_zip64 = "Zipfile size"
+ if requires_zip64:
+ raise LargeZipFile(requires_zip64 +
+ " would require ZIP64 extensions")
+
+ def write(self, filename, arcname=None, compress_type=None):
+ """Put the bytes from filename into the archive under the name
+ arcname."""
+ if not self.fp:
+ raise RuntimeError(
+ "Attempt to write to ZIP archive that was already closed")
+
+ st = os.stat(filename)
+ isdir = stat.S_ISDIR(st.st_mode)
+ mtime = time.localtime(st.st_mtime)
+ date_time = mtime[0:6]
+ # Create ZipInfo instance to store file information
+ if arcname is None:
+ arcname = filename
+ arcname = os.path.normpath(os.path.splitdrive(arcname)[1])
+ while arcname[0] in (os.sep, os.altsep):
+ arcname = arcname[1:]
+ if isdir:
+ arcname += '/'
+ zinfo = ZipInfo(arcname, date_time)
+ zinfo.external_attr = (st[0] & 0xFFFF) << 16L # Unix attributes
+ if compress_type is None:
+ zinfo.compress_type = self.compression
+ else:
+ zinfo.compress_type = compress_type
+
+ zinfo.file_size = st.st_size
+ zinfo.flag_bits = 0x00
+ zinfo.header_offset = self.fp.tell() # Start of header bytes
+
+ self._writecheck(zinfo)
+ self._didModify = True
+
+ if isdir:
+ zinfo.file_size = 0
+ zinfo.compress_size = 0
+ zinfo.CRC = 0
+ zinfo.external_attr |= 0x10 # MS-DOS directory flag
+ self.filelist.append(zinfo)
+ self.NameToInfo[zinfo.filename] = zinfo
+ self.fp.write(zinfo.FileHeader(False))
+ return
+
+ with open(filename, "rb") as fp:
+ # Must overwrite CRC and sizes with correct data later
+ zinfo.CRC = CRC = 0
+ zinfo.compress_size = compress_size = 0
+ # Compressed size can be larger than uncompressed size
+ zip64 = self._allowZip64 and \
+ zinfo.file_size * 1.05 > ZIP64_LIMIT
+ self.fp.write(zinfo.FileHeader(zip64))
+ if zinfo.compress_type == ZIP_DEFLATED:
+ cmpr = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION,
+ zlib.DEFLATED, -15)
+ else:
+ cmpr = None
+ file_size = 0
+ while 1:
+ buf = fp.read(1024 * 8)
+ if not buf:
+ break
+ file_size = file_size + len(buf)
+ CRC = crc32(buf, CRC) & 0xffffffff
+ if cmpr:
+ buf = cmpr.compress(buf)
+ compress_size = compress_size + len(buf)
+ self.fp.write(buf)
+ if cmpr:
+ buf = cmpr.flush()
+ compress_size = compress_size + len(buf)
+ self.fp.write(buf)
+ zinfo.compress_size = compress_size
+ else:
+ zinfo.compress_size = file_size
+ zinfo.CRC = CRC
+ zinfo.file_size = file_size
+ if not zip64 and self._allowZip64:
+ if file_size > ZIP64_LIMIT:
+ raise RuntimeError('File size has increased during compressing')
+ if compress_size > ZIP64_LIMIT:
+ raise RuntimeError('Compressed size larger than uncompressed size')
+ # Seek backwards and write file header (which will now include
+ # correct CRC and file sizes)
+ position = self.fp.tell() # Preserve current position in file
+ self.fp.seek(zinfo.header_offset, 0)
+ self.fp.write(zinfo.FileHeader(zip64))
+ self.fp.seek(position, 0)
+ self.filelist.append(zinfo)
+ self.NameToInfo[zinfo.filename] = zinfo
+
+ def writestr(self, zinfo_or_arcname, bytes, compress_type=None):
+ """Write a file into the archive. The contents is the string
+ 'bytes'. 'zinfo_or_arcname' is either a ZipInfo instance or
+ the name of the file in the archive."""
+ if not isinstance(zinfo_or_arcname, ZipInfo):
+ zinfo = ZipInfo(filename=zinfo_or_arcname,
+ date_time=time.localtime(time.time())[:6])
+
+ zinfo.compress_type = self.compression
+ if zinfo.filename[-1] == '/':
+ zinfo.external_attr = 0o40775 << 16 # drwxrwxr-x
+ zinfo.external_attr |= 0x10 # MS-DOS directory flag
+ else:
+ zinfo.external_attr = 0o600 << 16 # ?rw-------
+ else:
+ zinfo = zinfo_or_arcname
+
+ if not self.fp:
+ raise RuntimeError(
+ "Attempt to write to ZIP archive that was already closed")
+
+ if compress_type is not None:
+ zinfo.compress_type = compress_type
+
+ zinfo.file_size = len(bytes) # Uncompressed size
+ zinfo.header_offset = self.fp.tell() # Start of header bytes
+ self._writecheck(zinfo)
+ self._didModify = True
+ zinfo.CRC = crc32(bytes) & 0xffffffff # CRC-32 checksum
+ if zinfo.compress_type == ZIP_DEFLATED:
+ co = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION,
+ zlib.DEFLATED, -15)
+ bytes = co.compress(bytes) + co.flush()
+ zinfo.compress_size = len(bytes) # Compressed size
+ else:
+ zinfo.compress_size = zinfo.file_size
+ zip64 = zinfo.file_size > ZIP64_LIMIT or \
+ zinfo.compress_size > ZIP64_LIMIT
+ if zip64 and not self._allowZip64:
+ raise LargeZipFile("Filesize would require ZIP64 extensions")
+ self.fp.write(zinfo.FileHeader(zip64))
+ self.fp.write(bytes)
+ if zinfo.flag_bits & 0x08:
+ # Write CRC and file sizes after the file data
+ fmt = '<LQQ' if zip64 else '<LLL'
+ self.fp.write(struct.pack(fmt, zinfo.CRC, zinfo.compress_size,
+ zinfo.file_size))
+ self.fp.flush()
+ self.filelist.append(zinfo)
+ self.NameToInfo[zinfo.filename] = zinfo
+
+ def __del__(self):
+ """Call the "close()" method in case the user forgot."""
+ self.close()
+
+ def close(self):
+ """Close the file, and for mode "w" and "a" write the ending
+ records."""
+ if self.fp is None:
+ return
+
+ try:
+ if self.mode in ("w", "a") and self._didModify: # write ending records
+ pos1 = self.fp.tell()
+ for zinfo in self.filelist: # write central directory
+ dt = zinfo.date_time
+ dosdate = (dt[0] - 1980) << 9 | dt[1] << 5 | dt[2]
+ dostime = dt[3] << 11 | dt[4] << 5 | (dt[5] // 2)
+ extra = []
+ if zinfo.file_size > ZIP64_LIMIT \
+ or zinfo.compress_size > ZIP64_LIMIT:
+ extra.append(zinfo.file_size)
+ extra.append(zinfo.compress_size)
+ file_size = 0xffffffff
+ compress_size = 0xffffffff
+ else:
+ file_size = zinfo.file_size
+ compress_size = zinfo.compress_size
+
+ if zinfo.header_offset > ZIP64_LIMIT:
+ extra.append(zinfo.header_offset)
+ header_offset = 0xffffffffL
+ else:
+ header_offset = zinfo.header_offset
+
+ extra_data = zinfo.extra
+ if extra:
+ # Append a ZIP64 field to the extra's
+ extra_data = struct.pack(
+ '<HH' + 'Q'*len(extra),
+ 1, 8*len(extra), *extra) + extra_data
+
+ extract_version = max(45, zinfo.extract_version)
+ create_version = max(45, zinfo.create_version)
+ else:
+ extract_version = zinfo.extract_version
+ create_version = zinfo.create_version
+
+ try:
+ filename, flag_bits = zinfo._encodeFilenameFlags()
+ centdir = struct.pack(structCentralDir,
+ stringCentralDir, create_version,
+ zinfo.create_system, extract_version, zinfo.reserved,
+ flag_bits, zinfo.compress_type, dostime, dosdate,
+ zinfo.CRC, compress_size, file_size,
+ len(filename), len(extra_data), len(zinfo.comment),
+ 0, zinfo.internal_attr, zinfo.external_attr,
+ header_offset)
+ except DeprecationWarning:
+ print >>sys.stderr, (structCentralDir,
+ stringCentralDir, create_version,
+ zinfo.create_system, extract_version, zinfo.reserved,
+ zinfo.flag_bits, zinfo.compress_type, dostime, dosdate,
+ zinfo.CRC, compress_size, file_size,
+ len(zinfo.filename), len(extra_data), len(zinfo.comment),
+ 0, zinfo.internal_attr, zinfo.external_attr,
+ header_offset)
+ raise
+ self.fp.write(centdir)
+ self.fp.write(filename)
+ self.fp.write(extra_data)
+ self.fp.write(zinfo.comment)
+
+ pos2 = self.fp.tell()
+ # Write end-of-zip-archive record
+ centDirCount = len(self.filelist)
+ centDirSize = pos2 - pos1
+ centDirOffset = pos1
+ requires_zip64 = None
+ if centDirCount > ZIP_FILECOUNT_LIMIT:
+ requires_zip64 = "Files count"
+ elif centDirOffset > ZIP64_LIMIT:
+ requires_zip64 = "Central directory offset"
+ elif centDirSize > ZIP64_LIMIT:
+ requires_zip64 = "Central directory size"
+ if requires_zip64:
+ # Need to write the ZIP64 end-of-archive records
+ if not self._allowZip64:
+ raise LargeZipFile(requires_zip64 +
+ " would require ZIP64 extensions")
+ zip64endrec = struct.pack(
+ structEndArchive64, stringEndArchive64,
+ 44, 45, 45, 0, 0, centDirCount, centDirCount,
+ centDirSize, centDirOffset)
+ self.fp.write(zip64endrec)
+
+ zip64locrec = struct.pack(
+ structEndArchive64Locator,
+ stringEndArchive64Locator, 0, pos2, 1)
+ self.fp.write(zip64locrec)
+ centDirCount = min(centDirCount, 0xFFFF)
+ centDirSize = min(centDirSize, 0xFFFFFFFF)
+ centDirOffset = min(centDirOffset, 0xFFFFFFFF)
+
+ endrec = struct.pack(structEndArchive, stringEndArchive,
+ 0, 0, centDirCount, centDirCount,
+ centDirSize, centDirOffset, len(self._comment))
+ self.fp.write(endrec)
+ self.fp.write(self._comment)
+ self.fp.flush()
+ finally:
+ fp = self.fp
+ self.fp = None
+ if not self._filePassed:
+ fp.close()
+
+
+class PyZipFile(ZipFile):
+ """Class to create ZIP archives with Python library files and packages."""
+
+ def writepy(self, pathname, basename = ""):
+ """Add all files from "pathname" to the ZIP archive.
+
+ If pathname is a package directory, search the directory and
+ all package subdirectories recursively for all *.py and enter
+ the modules into the archive. If pathname is a plain
+ directory, listdir *.py and enter all modules. Else, pathname
+ must be a Python *.py file and the module will be put into the
+ archive. Added modules are always module.pyo or module.pyc.
+ This method will compile the module.py into module.pyc if
+ necessary.
+ """
+ dir, name = os.path.split(pathname)
+ if os.path.isdir(pathname):
+ initname = os.path.join(pathname, "__init__.py")
+ if os.path.isfile(initname):
+ # This is a package directory, add it
+ if basename:
+ basename = "%s/%s" % (basename, name)
+ else:
+ basename = name
+ if self.debug:
+ print "Adding package in", pathname, "as", basename
+ fname, arcname = self._get_codename(initname[0:-3], basename)
+ if self.debug:
+ print "Adding", arcname
+ self.write(fname, arcname)
+ dirlist = os.listdir(pathname)
+ dirlist.remove("__init__.py")
+ # Add all *.py files and package subdirectories
+ for filename in dirlist:
+ path = os.path.join(pathname, filename)
+ root, ext = os.path.splitext(filename)
+ if os.path.isdir(path):
+ if os.path.isfile(os.path.join(path, "__init__.py")):
+ # This is a package directory, add it
+ self.writepy(path, basename) # Recursive call
+ elif ext == ".py":
+ fname, arcname = self._get_codename(path[0:-3],
+ basename)
+ if self.debug:
+ print "Adding", arcname
+ self.write(fname, arcname)
+ else:
+ # This is NOT a package directory, add its files at top level
+ if self.debug:
+ print "Adding files from directory", pathname
+ for filename in os.listdir(pathname):
+ path = os.path.join(pathname, filename)
+ root, ext = os.path.splitext(filename)
+ if ext == ".py":
+ fname, arcname = self._get_codename(path[0:-3],
+ basename)
+ if self.debug:
+ print "Adding", arcname
+ self.write(fname, arcname)
+ else:
+ if pathname[-3:] != ".py":
+ raise RuntimeError, \
+ 'Files added with writepy() must end with ".py"'
+ fname, arcname = self._get_codename(pathname[0:-3], basename)
+ if self.debug:
+ print "Adding file", arcname
+ self.write(fname, arcname)
+
+ def _get_codename(self, pathname, basename):
+ """Return (filename, archivename) for the path.
+
+ Given a module name path, return the correct file path and
+ archive name, compiling if necessary. For example, given
+ /python/lib/string, return (/python/lib/string.pyc, string).
+ """
+ file_py = pathname + ".py"
+ file_pyc = pathname + ".pyc"
+ file_pyo = pathname + ".pyo"
+ if os.path.isfile(file_pyo) and \
+ os.stat(file_pyo).st_mtime >= os.stat(file_py).st_mtime:
+ fname = file_pyo # Use .pyo file
+ elif not os.path.isfile(file_pyc) or \
+ os.stat(file_pyc).st_mtime < os.stat(file_py).st_mtime:
+ import py_compile
+ if self.debug:
+ print "Compiling", file_py
+ try:
+ py_compile.compile(file_py, file_pyc, None, True)
+ except py_compile.PyCompileError,err:
+ print err.msg
+ fname = file_pyc
+ else:
+ fname = file_pyc
+ archivename = os.path.split(fname)[1]
+ if basename:
+ archivename = "%s/%s" % (basename, archivename)
+ return (fname, archivename)
+
+
+def main(args = None):
+ import textwrap
+ USAGE=textwrap.dedent("""\
+ Usage:
+ zipfile.py -l zipfile.zip # Show listing of a zipfile
+ zipfile.py -t zipfile.zip # Test if a zipfile is valid
+ zipfile.py -e zipfile.zip target # Extract zipfile into target dir
+ zipfile.py -c zipfile.zip src ... # Create zipfile from sources
+ """)
+ if args is None:
+ args = sys.argv[1:]
+
+ if not args or args[0] not in ('-l', '-c', '-e', '-t'):
+ print USAGE
+ sys.exit(1)
+
+ if args[0] == '-l':
+ if len(args) != 2:
+ print USAGE
+ sys.exit(1)
+ with ZipFile(args[1], 'r') as zf:
+ zf.printdir()
+
+ elif args[0] == '-t':
+ if len(args) != 2:
+ print USAGE
+ sys.exit(1)
+ with ZipFile(args[1], 'r') as zf:
+ badfile = zf.testzip()
+ if badfile:
+ print("The following enclosed file is corrupted: {!r}".format(badfile))
+ print "Done testing"
+
+ elif args[0] == '-e':
+ if len(args) != 3:
+ print USAGE
+ sys.exit(1)
+
+ with ZipFile(args[1], 'r') as zf:
+ zf.extractall(args[2])
+
+ elif args[0] == '-c':
+ if len(args) < 3:
+ print USAGE
+ sys.exit(1)
+
+ def addToZip(zf, path, zippath):
+ if os.path.isfile(path):
+ zf.write(path, zippath, ZIP_DEFLATED)
+ elif os.path.isdir(path):
+ if zippath:
+ zf.write(path, zippath)
+ for nm in os.listdir(path):
+ addToZip(zf,
+ os.path.join(path, nm), os.path.join(zippath, nm))
+ # else: ignore
+
+ with ZipFile(args[1], 'w', allowZip64=True) as zf:
+ for path in args[2:]:
+ zippath = os.path.basename(path)
+ if not zippath:
+ zippath = os.path.basename(os.path.dirname(path))
+ if zippath in ('', os.curdir, os.pardir):
+ zippath = ''
+ addToZip(zf, path, zippath)
+
+if __name__ == "__main__":
+ main()