1 """ 2 Python 'utf-32-be' Codec 3 """ 4 import codecs 5 6 ### Codec APIs 7 8 encode = codecs.utf_32_be_encode 9 10 def decode(input, errors='strict'): 11 return codecs.utf_32_be_decode(input, errors, True) 12 13 class IncrementalEncoder(codecs.IncrementalEncoder): 14 def encode(self, input, final=False): 15 return codecs.utf_32_be_encode(input, self.errors)[0] 16 17 class IncrementalDecoder(codecs.BufferedIncrementalDecoder): 18 _buffer_decode = codecs.utf_32_be_decode 19 20 class StreamWriter(codecs.StreamWriter): 21 encode = codecs.utf_32_be_encode 22 23 class StreamReader(codecs.StreamReader): 24 decode = codecs.utf_32_be_decode 25 26 ### encodings module API 27 28 def getregentry(): 29 return codecs.CodecInfo( 30 name='utf-32-be', 31 encode=encode, 32 decode=decode, 33 incrementalencoder=IncrementalEncoder, 34 incrementaldecoder=IncrementalDecoder, 35 streamreader=StreamReader, 36 streamwriter=StreamWriter, 37 ) 38