cp866.py (6446B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\carbon\common\stdlib\encodings\cp866.py 2 import codecs 3 4 class Codec(codecs.Codec): 5 6 def encode(self, input, errors = 'strict'): 7 return codecs.charmap_encode(input, errors, encoding_map) 8 9 def decode(self, input, errors = 'strict'): 10 return codecs.charmap_decode(input, errors, decoding_table) 11 12 13 class IncrementalEncoder(codecs.IncrementalEncoder): 14 15 def encode(self, input, final = False): 16 return codecs.charmap_encode(input, self.errors, encoding_map)[0] 17 18 19 class IncrementalDecoder(codecs.IncrementalDecoder): 20 21 def decode(self, input, final = False): 22 return codecs.charmap_decode(input, self.errors, decoding_table)[0] 23 24 25 class StreamWriter(Codec, codecs.StreamWriter): 26 pass 27 28 29 class StreamReader(Codec, codecs.StreamReader): 30 pass 31 32 33 def getregentry(): 34 return codecs.CodecInfo(name='cp866', encode=Codec().encode, decode=Codec().decode, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamreader=StreamReader, streamwriter=StreamWriter) 35 36 37 decoding_map = codecs.make_identity_dict(range(256)) 38 decoding_map.update({128: 1040, 39 129: 1041, 40 130: 1042, 41 131: 1043, 42 132: 1044, 43 133: 1045, 44 134: 1046, 45 135: 1047, 46 136: 1048, 47 137: 1049, 48 138: 1050, 49 139: 1051, 50 140: 1052, 51 141: 1053, 52 142: 1054, 53 143: 1055, 54 144: 1056, 55 145: 1057, 56 146: 1058, 57 147: 1059, 58 148: 1060, 59 149: 1061, 60 150: 1062, 61 151: 1063, 62 152: 1064, 63 153: 1065, 64 154: 1066, 65 155: 1067, 66 156: 1068, 67 157: 1069, 68 158: 1070, 69 159: 1071, 70 160: 1072, 71 161: 1073, 72 162: 1074, 73 163: 1075, 74 164: 1076, 75 165: 1077, 76 166: 1078, 77 167: 1079, 78 168: 1080, 79 169: 1081, 80 170: 1082, 81 171: 1083, 82 172: 1084, 83 173: 1085, 84 174: 1086, 85 175: 1087, 86 176: 9617, 87 177: 9618, 88 178: 9619, 89 179: 9474, 90 180: 9508, 91 181: 9569, 92 182: 9570, 93 183: 9558, 94 184: 9557, 95 185: 9571, 96 186: 9553, 97 187: 9559, 98 188: 9565, 99 189: 9564, 100 190: 9563, 101 191: 9488, 102 192: 9492, 103 193: 9524, 104 194: 9516, 105 195: 9500, 106 196: 9472, 107 197: 9532, 108 198: 9566, 109 199: 9567, 110 200: 9562, 111 201: 9556, 112 202: 9577, 113 203: 9574, 114 204: 9568, 115 205: 9552, 116 206: 9580, 117 207: 9575, 118 208: 9576, 119 209: 9572, 120 210: 9573, 121 211: 9561, 122 212: 9560, 123 213: 9554, 124 214: 9555, 125 215: 9579, 126 216: 9578, 127 217: 9496, 128 218: 9484, 129 219: 9608, 130 220: 9604, 131 221: 9612, 132 222: 9616, 133 223: 9600, 134 224: 1088, 135 225: 1089, 136 226: 1090, 137 227: 1091, 138 228: 1092, 139 229: 1093, 140 230: 1094, 141 231: 1095, 142 232: 1096, 143 233: 1097, 144 234: 1098, 145 235: 1099, 146 236: 1100, 147 237: 1101, 148 238: 1102, 149 239: 1103, 150 240: 1025, 151 241: 1105, 152 242: 1028, 153 243: 1108, 154 244: 1031, 155 245: 1111, 156 246: 1038, 157 247: 1118, 158 248: 176, 159 249: 8729, 160 250: 183, 161 251: 8730, 162 252: 8470, 163 253: 164, 164 254: 9632, 165 255: 160}) 166 decoding_table = u'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041a\u041b\u041c\u041d\u041e\u041f\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042a\u042b\u042c\u042d\u042e\u042f\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255d\u255c\u255b\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u255e\u255f\u255a\u2554\u2569\u2566\u2560\u2550\u256c\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256b\u256a\u2518\u250c\u2588\u2584\u258c\u2590\u2580\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044b\u044c\u044d\u044e\u044f\u0401\u0451\u0404\u0454\u0407\u0457\u040e\u045e\xb0\u2219\xb7\u221a\u2116\xa4\u25a0\xa0' 167 encoding_map = {0: 0, 168 1: 1, 169 2: 2, 170 3: 3, 171 4: 4, 172 5: 5, 173 6: 6, 174 7: 7, 175 8: 8, 176 9: 9, 177 10: 10, 178 11: 11, 179 12: 12, 180 13: 13, 181 14: 14, 182 15: 15, 183 16: 16, 184 17: 17, 185 18: 18, 186 19: 19, 187 20: 20, 188 21: 21, 189 22: 22, 190 23: 23, 191 24: 24, 192 25: 25, 193 26: 26, 194 27: 27, 195 28: 28, 196 29: 29, 197 30: 30, 198 31: 31, 199 32: 32, 200 33: 33, 201 34: 34, 202 35: 35, 203 36: 36, 204 37: 37, 205 38: 38, 206 39: 39, 207 40: 40, 208 41: 41, 209 42: 42, 210 43: 43, 211 44: 44, 212 45: 45, 213 46: 46, 214 47: 47, 215 48: 48, 216 49: 49, 217 50: 50, 218 51: 51, 219 52: 52, 220 53: 53, 221 54: 54, 222 55: 55, 223 56: 56, 224 57: 57, 225 58: 58, 226 59: 59, 227 60: 60, 228 61: 61, 229 62: 62, 230 63: 63, 231 64: 64, 232 65: 65, 233 66: 66, 234 67: 67, 235 68: 68, 236 69: 69, 237 70: 70, 238 71: 71, 239 72: 72, 240 73: 73, 241 74: 74, 242 75: 75, 243 76: 76, 244 77: 77, 245 78: 78, 246 79: 79, 247 80: 80, 248 81: 81, 249 82: 82, 250 83: 83, 251 84: 84, 252 85: 85, 253 86: 86, 254 87: 87, 255 88: 88, 256 89: 89, 257 90: 90, 258 91: 91, 259 92: 92, 260 93: 93, 261 94: 94, 262 95: 95, 263 96: 96, 264 97: 97, 265 98: 98, 266 99: 99, 267 100: 100, 268 101: 101, 269 102: 102, 270 103: 103, 271 104: 104, 272 105: 105, 273 106: 106, 274 107: 107, 275 108: 108, 276 109: 109, 277 110: 110, 278 111: 111, 279 112: 112, 280 113: 113, 281 114: 114, 282 115: 115, 283 116: 116, 284 117: 117, 285 118: 118, 286 119: 119, 287 120: 120, 288 121: 121, 289 122: 122, 290 123: 123, 291 124: 124, 292 125: 125, 293 126: 126, 294 127: 127, 295 160: 255, 296 164: 253, 297 176: 248, 298 183: 250, 299 1025: 240, 300 1028: 242, 301 1031: 244, 302 1038: 246, 303 1040: 128, 304 1041: 129, 305 1042: 130, 306 1043: 131, 307 1044: 132, 308 1045: 133, 309 1046: 134, 310 1047: 135, 311 1048: 136, 312 1049: 137, 313 1050: 138, 314 1051: 139, 315 1052: 140, 316 1053: 141, 317 1054: 142, 318 1055: 143, 319 1056: 144, 320 1057: 145, 321 1058: 146, 322 1059: 147, 323 1060: 148, 324 1061: 149, 325 1062: 150, 326 1063: 151, 327 1064: 152, 328 1065: 153, 329 1066: 154, 330 1067: 155, 331 1068: 156, 332 1069: 157, 333 1070: 158, 334 1071: 159, 335 1072: 160, 336 1073: 161, 337 1074: 162, 338 1075: 163, 339 1076: 164, 340 1077: 165, 341 1078: 166, 342 1079: 167, 343 1080: 168, 344 1081: 169, 345 1082: 170, 346 1083: 171, 347 1084: 172, 348 1085: 173, 349 1086: 174, 350 1087: 175, 351 1088: 224, 352 1089: 225, 353 1090: 226, 354 1091: 227, 355 1092: 228, 356 1093: 229, 357 1094: 230, 358 1095: 231, 359 1096: 232, 360 1097: 233, 361 1098: 234, 362 1099: 235, 363 1100: 236, 364 1101: 237, 365 1102: 238, 366 1103: 239, 367 1105: 241, 368 1108: 243, 369 1111: 245, 370 1118: 247, 371 8470: 252, 372 8729: 249, 373 8730: 251, 374 9472: 196, 375 9474: 179, 376 9484: 218, 377 9488: 191, 378 9492: 192, 379 9496: 217, 380 9500: 195, 381 9508: 180, 382 9516: 194, 383 9524: 193, 384 9532: 197, 385 9552: 205, 386 9553: 186, 387 9554: 213, 388 9555: 214, 389 9556: 201, 390 9557: 184, 391 9558: 183, 392 9559: 187, 393 9560: 212, 394 9561: 211, 395 9562: 200, 396 9563: 190, 397 9564: 189, 398 9565: 188, 399 9566: 198, 400 9567: 199, 401 9568: 204, 402 9569: 181, 403 9570: 182, 404 9571: 185, 405 9572: 209, 406 9573: 210, 407 9574: 203, 408 9575: 207, 409 9576: 208, 410 9577: 202, 411 9578: 216, 412 9579: 215, 413 9580: 206, 414 9600: 223, 415 9604: 220, 416 9608: 219, 417 9612: 221, 418 9616: 222, 419 9617: 176, 420 9618: 177, 421 9619: 178, 422 9632: 254}