cp857.py (6043B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\carbon\common\stdlib\encodings\cp857.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='cp857', 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: 199, 39 129: 252, 40 130: 233, 41 131: 226, 42 132: 228, 43 133: 224, 44 134: 229, 45 135: 231, 46 136: 234, 47 137: 235, 48 138: 232, 49 139: 239, 50 140: 238, 51 141: 305, 52 142: 196, 53 143: 197, 54 144: 201, 55 145: 230, 56 146: 198, 57 147: 244, 58 148: 246, 59 149: 242, 60 150: 251, 61 151: 249, 62 152: 304, 63 153: 214, 64 154: 220, 65 155: 248, 66 156: 163, 67 157: 216, 68 158: 350, 69 159: 351, 70 160: 225, 71 161: 237, 72 162: 243, 73 163: 250, 74 164: 241, 75 165: 209, 76 166: 286, 77 167: 287, 78 168: 191, 79 169: 174, 80 170: 172, 81 171: 189, 82 172: 188, 83 173: 161, 84 174: 171, 85 175: 187, 86 176: 9617, 87 177: 9618, 88 178: 9619, 89 179: 9474, 90 180: 9508, 91 181: 193, 92 182: 194, 93 183: 192, 94 184: 169, 95 185: 9571, 96 186: 9553, 97 187: 9559, 98 188: 9565, 99 189: 162, 100 190: 165, 101 191: 9488, 102 192: 9492, 103 193: 9524, 104 194: 9516, 105 195: 9500, 106 196: 9472, 107 197: 9532, 108 198: 227, 109 199: 195, 110 200: 9562, 111 201: 9556, 112 202: 9577, 113 203: 9574, 114 204: 9568, 115 205: 9552, 116 206: 9580, 117 207: 164, 118 208: 186, 119 209: 170, 120 210: 202, 121 211: 203, 122 212: 200, 123 213: None, 124 214: 205, 125 215: 206, 126 216: 207, 127 217: 9496, 128 218: 9484, 129 219: 9608, 130 220: 9604, 131 221: 166, 132 222: 204, 133 223: 9600, 134 224: 211, 135 225: 223, 136 226: 212, 137 227: 210, 138 228: 245, 139 229: 213, 140 230: 181, 141 231: None, 142 232: 215, 143 233: 218, 144 234: 219, 145 235: 217, 146 237: 255, 147 238: 175, 148 239: 180, 149 240: 173, 150 241: 177, 151 242: None, 152 243: 190, 153 244: 182, 154 245: 167, 155 246: 247, 156 247: 184, 157 248: 176, 158 249: 168, 159 250: 183, 160 251: 185, 161 252: 179, 162 253: 178, 163 254: 9632, 164 255: 160}) 165 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\xc7\xfc\xe9\xe2\xe4\xe0\xe5\xe7\xea\xeb\xe8\xef\xee\u0131\xc4\xc5\xc9\xe6\xc6\xf4\xf6\xf2\xfb\xf9\u0130\xd6\xdc\xf8\xa3\xd8\u015e\u015f\xe1\xed\xf3\xfa\xf1\xd1\u011e\u011f\xbf\xae\xac\xbd\xbc\xa1\xab\xbb\u2591\u2592\u2593\u2502\u2524\xc1\xc2\xc0\xa9\u2563\u2551\u2557\u255d\xa2\xa5\u2510\u2514\u2534\u252c\u251c\u2500\u253c\xe3\xc3\u255a\u2554\u2569\u2566\u2560\u2550\u256c\xa4\xba\xaa\xca\xcb\xc8\ufffe\xcd\xce\xcf\u2518\u250c\u2588\u2584\xa6\xcc\u2580\xd3\xdf\xd4\xd2\xf5\xd5\xb5\ufffe\xd7\xda\xdb\xd9\xec\xff\xaf\xb4\xad\xb1\ufffe\xbe\xb6\xa7\xf7\xb8\xb0\xa8\xb7\xb9\xb3\xb2\u25a0\xa0' 166 encoding_map = {0: 0, 167 1: 1, 168 2: 2, 169 3: 3, 170 4: 4, 171 5: 5, 172 6: 6, 173 7: 7, 174 8: 8, 175 9: 9, 176 10: 10, 177 11: 11, 178 12: 12, 179 13: 13, 180 14: 14, 181 15: 15, 182 16: 16, 183 17: 17, 184 18: 18, 185 19: 19, 186 20: 20, 187 21: 21, 188 22: 22, 189 23: 23, 190 24: 24, 191 25: 25, 192 26: 26, 193 27: 27, 194 28: 28, 195 29: 29, 196 30: 30, 197 31: 31, 198 32: 32, 199 33: 33, 200 34: 34, 201 35: 35, 202 36: 36, 203 37: 37, 204 38: 38, 205 39: 39, 206 40: 40, 207 41: 41, 208 42: 42, 209 43: 43, 210 44: 44, 211 45: 45, 212 46: 46, 213 47: 47, 214 48: 48, 215 49: 49, 216 50: 50, 217 51: 51, 218 52: 52, 219 53: 53, 220 54: 54, 221 55: 55, 222 56: 56, 223 57: 57, 224 58: 58, 225 59: 59, 226 60: 60, 227 61: 61, 228 62: 62, 229 63: 63, 230 64: 64, 231 65: 65, 232 66: 66, 233 67: 67, 234 68: 68, 235 69: 69, 236 70: 70, 237 71: 71, 238 72: 72, 239 73: 73, 240 74: 74, 241 75: 75, 242 76: 76, 243 77: 77, 244 78: 78, 245 79: 79, 246 80: 80, 247 81: 81, 248 82: 82, 249 83: 83, 250 84: 84, 251 85: 85, 252 86: 86, 253 87: 87, 254 88: 88, 255 89: 89, 256 90: 90, 257 91: 91, 258 92: 92, 259 93: 93, 260 94: 94, 261 95: 95, 262 96: 96, 263 97: 97, 264 98: 98, 265 99: 99, 266 100: 100, 267 101: 101, 268 102: 102, 269 103: 103, 270 104: 104, 271 105: 105, 272 106: 106, 273 107: 107, 274 108: 108, 275 109: 109, 276 110: 110, 277 111: 111, 278 112: 112, 279 113: 113, 280 114: 114, 281 115: 115, 282 116: 116, 283 117: 117, 284 118: 118, 285 119: 119, 286 120: 120, 287 121: 121, 288 122: 122, 289 123: 123, 290 124: 124, 291 125: 125, 292 126: 126, 293 127: 127, 294 160: 255, 295 161: 173, 296 162: 189, 297 163: 156, 298 164: 207, 299 165: 190, 300 166: 221, 301 167: 245, 302 168: 249, 303 169: 184, 304 170: 209, 305 171: 174, 306 172: 170, 307 173: 240, 308 174: 169, 309 175: 238, 310 176: 248, 311 177: 241, 312 178: 253, 313 179: 252, 314 180: 239, 315 181: 230, 316 182: 244, 317 183: 250, 318 184: 247, 319 185: 251, 320 186: 208, 321 187: 175, 322 188: 172, 323 189: 171, 324 190: 243, 325 191: 168, 326 192: 183, 327 193: 181, 328 194: 182, 329 195: 199, 330 196: 142, 331 197: 143, 332 198: 146, 333 199: 128, 334 200: 212, 335 201: 144, 336 202: 210, 337 203: 211, 338 204: 222, 339 205: 214, 340 206: 215, 341 207: 216, 342 209: 165, 343 210: 227, 344 211: 224, 345 212: 226, 346 213: 229, 347 214: 153, 348 215: 232, 349 216: 157, 350 217: 235, 351 218: 233, 352 219: 234, 353 220: 154, 354 223: 225, 355 224: 133, 356 225: 160, 357 226: 131, 358 227: 198, 359 228: 132, 360 229: 134, 361 230: 145, 362 231: 135, 363 232: 138, 364 233: 130, 365 234: 136, 366 235: 137, 367 236: 236, 368 237: 161, 369 238: 140, 370 239: 139, 371 241: 164, 372 242: 149, 373 243: 162, 374 244: 147, 375 245: 228, 376 246: 148, 377 247: 246, 378 248: 155, 379 249: 151, 380 250: 163, 381 251: 150, 382 252: 129, 383 255: 237, 384 286: 166, 385 287: 167, 386 304: 152, 387 305: 141, 388 350: 158, 389 351: 159, 390 9472: 196, 391 9474: 179, 392 9484: 218, 393 9488: 191, 394 9492: 192, 395 9496: 217, 396 9500: 195, 397 9508: 180, 398 9516: 194, 399 9524: 193, 400 9532: 197, 401 9552: 205, 402 9553: 186, 403 9556: 201, 404 9559: 187, 405 9562: 200, 406 9565: 188, 407 9568: 204, 408 9571: 185, 409 9574: 203, 410 9577: 202, 411 9580: 206, 412 9600: 223, 413 9604: 220, 414 9608: 219, 415 9617: 176, 416 9618: 177, 417 9619: 178, 418 9632: 254}