cp852.py (6180B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\carbon\common\stdlib\encodings\cp852.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='cp852', 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: 367, 44 134: 263, 45 135: 231, 46 136: 322, 47 137: 235, 48 138: 336, 49 139: 337, 50 140: 238, 51 141: 377, 52 142: 196, 53 143: 262, 54 144: 201, 55 145: 313, 56 146: 314, 57 147: 244, 58 148: 246, 59 149: 317, 60 150: 318, 61 151: 346, 62 152: 347, 63 153: 214, 64 154: 220, 65 155: 356, 66 156: 357, 67 157: 321, 68 158: 215, 69 159: 269, 70 160: 225, 71 161: 237, 72 162: 243, 73 163: 250, 74 164: 260, 75 165: 261, 76 166: 381, 77 167: 382, 78 168: 280, 79 169: 281, 80 170: 172, 81 171: 378, 82 172: 268, 83 173: 351, 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: 282, 94 184: 350, 95 185: 9571, 96 186: 9553, 97 187: 9559, 98 188: 9565, 99 189: 379, 100 190: 380, 101 191: 9488, 102 192: 9492, 103 193: 9524, 104 194: 9516, 105 195: 9500, 106 196: 9472, 107 197: 9532, 108 198: 258, 109 199: 259, 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: 273, 119 209: 272, 120 210: 270, 121 211: 203, 122 212: 271, 123 213: 327, 124 214: 205, 125 215: 206, 126 216: 283, 127 217: 9496, 128 218: 9484, 129 219: 9608, 130 220: 9604, 131 221: 354, 132 222: 366, 133 223: 9600, 134 224: 211, 135 225: 223, 136 226: 212, 137 227: 323, 138 228: 324, 139 229: 328, 140 230: 352, 141 231: 353, 142 232: 340, 143 233: 218, 144 234: 341, 145 235: 368, 146 236: 253, 147 237: 221, 148 238: 355, 149 239: 180, 150 240: 173, 151 241: 733, 152 242: 731, 153 243: 711, 154 244: 728, 155 245: 167, 156 246: 247, 157 247: 184, 158 248: 176, 159 249: 168, 160 250: 729, 161 251: 369, 162 252: 344, 163 253: 345, 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\xc7\xfc\xe9\xe2\xe4\u016f\u0107\xe7\u0142\xeb\u0150\u0151\xee\u0179\xc4\u0106\xc9\u0139\u013a\xf4\xf6\u013d\u013e\u015a\u015b\xd6\xdc\u0164\u0165\u0141\xd7\u010d\xe1\xed\xf3\xfa\u0104\u0105\u017d\u017e\u0118\u0119\xac\u017a\u010c\u015f\xab\xbb\u2591\u2592\u2593\u2502\u2524\xc1\xc2\u011a\u015e\u2563\u2551\u2557\u255d\u017b\u017c\u2510\u2514\u2534\u252c\u251c\u2500\u253c\u0102\u0103\u255a\u2554\u2569\u2566\u2560\u2550\u256c\xa4\u0111\u0110\u010e\xcb\u010f\u0147\xcd\xce\u011b\u2518\u250c\u2588\u2584\u0162\u016e\u2580\xd3\xdf\xd4\u0143\u0144\u0148\u0160\u0161\u0154\xda\u0155\u0170\xfd\xdd\u0163\xb4\xad\u02dd\u02db\u02c7\u02d8\xa7\xf7\xb8\xb0\xa8\u02d9\u0171\u0158\u0159\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: 207, 297 167: 245, 298 168: 249, 299 171: 174, 300 172: 170, 301 173: 240, 302 176: 248, 303 180: 239, 304 184: 247, 305 187: 175, 306 193: 181, 307 194: 182, 308 196: 142, 309 199: 128, 310 201: 144, 311 203: 211, 312 205: 214, 313 206: 215, 314 211: 224, 315 212: 226, 316 214: 153, 317 215: 158, 318 218: 233, 319 220: 154, 320 221: 237, 321 223: 225, 322 225: 160, 323 226: 131, 324 228: 132, 325 231: 135, 326 233: 130, 327 235: 137, 328 237: 161, 329 238: 140, 330 243: 162, 331 244: 147, 332 246: 148, 333 247: 246, 334 250: 163, 335 252: 129, 336 253: 236, 337 258: 198, 338 259: 199, 339 260: 164, 340 261: 165, 341 262: 143, 342 263: 134, 343 268: 172, 344 269: 159, 345 270: 210, 346 271: 212, 347 272: 209, 348 273: 208, 349 280: 168, 350 281: 169, 351 282: 183, 352 283: 216, 353 313: 145, 354 314: 146, 355 317: 149, 356 318: 150, 357 321: 157, 358 322: 136, 359 323: 227, 360 324: 228, 361 327: 213, 362 328: 229, 363 336: 138, 364 337: 139, 365 340: 232, 366 341: 234, 367 344: 252, 368 345: 253, 369 346: 151, 370 347: 152, 371 350: 184, 372 351: 173, 373 352: 230, 374 353: 231, 375 354: 221, 376 355: 238, 377 356: 155, 378 357: 156, 379 366: 222, 380 367: 133, 381 368: 235, 382 369: 251, 383 377: 141, 384 378: 171, 385 379: 189, 386 380: 190, 387 381: 166, 388 382: 167, 389 711: 243, 390 728: 244, 391 729: 250, 392 731: 242, 393 733: 241, 394 9472: 196, 395 9474: 179, 396 9484: 218, 397 9488: 191, 398 9492: 192, 399 9496: 217, 400 9500: 195, 401 9508: 180, 402 9516: 194, 403 9524: 193, 404 9532: 197, 405 9552: 205, 406 9553: 186, 407 9556: 201, 408 9559: 187, 409 9562: 200, 410 9565: 188, 411 9568: 204, 412 9571: 185, 413 9574: 203, 414 9577: 202, 415 9580: 206, 416 9600: 223, 417 9604: 220, 418 9608: 219, 419 9617: 176, 420 9618: 177, 421 9619: 178, 422 9632: 254}