summaryrefslogtreecommitdiffstats
path: root/Lib/encodings/utf_7.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/encodings/utf_7.py')
-rw-r--r--Lib/encodings/utf_7.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/Lib/encodings/utf_7.py b/Lib/encodings/utf_7.py
index ee78d09..d78d192 100644
--- a/Lib/encodings/utf_7.py
+++ b/Lib/encodings/utf_7.py
@@ -13,6 +13,14 @@ class Codec(codecs.Codec):
encode = codecs.utf_7_encode
decode = codecs.utf_7_decode
+class IncrementalEncoder(codecs.IncrementalEncoder):
+ def encode(self, input, final=False):
+ return codecs.utf_7_encode(input, self.errors)[0]
+
+class IncrementalDecoder(codecs.BufferedIncrementalDecoder):
+ def _buffer_decode(self, input, errors, final):
+ return codecs.utf_7_decode(input, self.errors)
+
class StreamWriter(Codec,codecs.StreamWriter):
pass
@@ -22,5 +30,12 @@ class StreamReader(Codec,codecs.StreamReader):
### encodings module API
def getregentry():
-
- return (Codec.encode,Codec.decode,StreamReader,StreamWriter)
+ return codecs.CodecInfo(
+ name='utf-7',
+ encode=Codec.encode,
+ decode=Codec.decode,
+ incrementalencoder=IncrementalEncoder,
+ incrementaldecoder=IncrementalDecoder,
+ streamreader=StreamReader,
+ streamwriter=StreamWriter,
+ )