• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""
2Python 'utf-32-be' Codec
3"""
4import codecs
5
6### Codec APIs
7
8encode = codecs.utf_32_be_encode
9
10def decode(input, errors='strict'):
11    return codecs.utf_32_be_decode(input, errors, True)
12
13class IncrementalEncoder(codecs.IncrementalEncoder):
14    def encode(self, input, final=False):
15        return codecs.utf_32_be_encode(input, self.errors)[0]
16
17class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
18    _buffer_decode = codecs.utf_32_be_decode
19
20class StreamWriter(codecs.StreamWriter):
21    encode = codecs.utf_32_be_encode
22
23class StreamReader(codecs.StreamReader):
24    decode = codecs.utf_32_be_decode
25
26### encodings module API
27
28def 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