test codecs used by testcharmapcodec written by marcandre lemburg mallemburg com c 2000 guido van rossum codec apis encodings module api decoding map encoding map codec apis encodings module api decoding map 1 n decoding mapping 1 n encoding mapping decoding mapping to undefined decoding mapping to remove character encoding map
import codecs



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 StreamWriter(Codec,codecs.StreamWriter):
    pass

class StreamReader(Codec,codecs.StreamReader):
    pass



def getregentry():

    return (Codec().encode,Codec().decode,StreamReader,StreamWriter)



decoding_map = codecs.make_identity_dict(range(256))
decoding_map.update({
        0x78: "abc", 
        b"abc": 0x0078,
        0x01: None,   
        0x79: "",    
})



encoding_map = {}
for k,v in decoding_map.items():
    encoding_map[v] = k