NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

hp_roman8.py (2282B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\carbon\common\stdlib\encodings\hp_roman8.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_map)
     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_map)[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='hp-roman8', encode=Codec().encode, decode=Codec().decode, incrementalencoder=IncrementalEncoder, incrementaldecoder=IncrementalDecoder, streamwriter=StreamWriter, streamreader=StreamReader)
     35 
     36 
     37 decoding_map = codecs.make_identity_dict(range(256))
     38 decoding_map.update({161: 192,
     39  162: 194,
     40  163: 200,
     41  164: 202,
     42  165: 203,
     43  166: 206,
     44  167: 207,
     45  168: 180,
     46  169: 715,
     47  170: 710,
     48  171: 168,
     49  172: 732,
     50  173: 217,
     51  174: 219,
     52  175: 8356,
     53  176: 175,
     54  177: 221,
     55  178: 253,
     56  179: 176,
     57  180: 199,
     58  181: 231,
     59  182: 209,
     60  183: 241,
     61  184: 161,
     62  185: 191,
     63  186: 164,
     64  187: 163,
     65  188: 165,
     66  189: 167,
     67  190: 402,
     68  191: 162,
     69  192: 226,
     70  193: 234,
     71  194: 244,
     72  195: 251,
     73  196: 225,
     74  197: 233,
     75  198: 243,
     76  199: 250,
     77  200: 224,
     78  201: 232,
     79  202: 242,
     80  203: 249,
     81  204: 228,
     82  205: 235,
     83  206: 246,
     84  207: 252,
     85  208: 197,
     86  209: 238,
     87  210: 216,
     88  211: 198,
     89  212: 229,
     90  213: 237,
     91  214: 248,
     92  215: 230,
     93  216: 196,
     94  217: 236,
     95  218: 214,
     96  219: 220,
     97  220: 201,
     98  221: 239,
     99  222: 223,
    100  223: 212,
    101  224: 193,
    102  225: 195,
    103  226: 227,
    104  227: 208,
    105  228: 240,
    106  229: 205,
    107  230: 204,
    108  231: 211,
    109  232: 210,
    110  233: 213,
    111  234: 245,
    112  235: 352,
    113  236: 353,
    114  237: 218,
    115  238: 376,
    116  239: 255,
    117  240: 222,
    118  241: 254,
    119  242: 183,
    120  243: 181,
    121  244: 182,
    122  245: 190,
    123  246: 8212,
    124  247: 188,
    125  248: 189,
    126  249: 170,
    127  250: 186,
    128  251: 171,
    129  252: 9632,
    130  253: 187,
    131  254: 177,
    132  255: None})
    133 encoding_map = codecs.make_encoding_map(decoding_map)