diff options
author | Guido van Rossum <guido@python.org> | 2000-04-11 15:41:38 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-04-11 15:41:38 (GMT) |
commit | 1c89b0eeef94f159824ab10738056f7f8eac2cbb (patch) | |
tree | 8ce596d5c6fd5b1e2512f6c94e1521e689cbac77 /Lib/codecs.py | |
parent | 004d64f362eb0bd0d3e2f257b2b7721fecba87af (diff) | |
download | cpython-1c89b0eeef94f159824ab10738056f7f8eac2cbb.zip cpython-1c89b0eeef94f159824ab10738056f7f8eac2cbb.tar.gz cpython-1c89b0eeef94f159824ab10738056f7f8eac2cbb.tar.bz2 |
Deleted trailing whitespace. This is really a way to be able to add
a missing part of the previous checkin message:
Marc-Andre Lemburg:
Added encoding name attributes to wrapper classes which
allow applications to check the used encoding names.
Diffstat (limited to 'Lib/codecs.py')
-rw-r--r-- | Lib/codecs.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Lib/codecs.py b/Lib/codecs.py index 6a61e1a..917fc25 100644 --- a/Lib/codecs.py +++ b/Lib/codecs.py @@ -27,7 +27,7 @@ BOM = struct.pack('=H',0xFEFF) BOM_BE = BOM32_BE = '\376\377' # corresponds to Unicode U+FEFF in UTF-16 on big endian # platforms == ZERO WIDTH NO-BREAK SPACE -BOM_LE = BOM32_LE = '\377\376' +BOM_LE = BOM32_LE = '\377\376' # corresponds to Unicode U+FFFE in UTF-16 on little endian # platforms == defined as being an illegal Unicode character @@ -58,7 +58,7 @@ class Codec: """ def encode(self,input,errors='strict'): - + """ Encodes the object input and returns a tuple (output object, length consumed). @@ -84,7 +84,7 @@ class Codec: input must be an object which provides the bf_getreadbuf buffer slot. Python strings, buffer objects and memory mapped files are examples of objects providing this slot. - + errors defines the error handling to apply. It defaults to 'strict' handling. @@ -96,7 +96,7 @@ class Codec: return an empty object of the output object type in this situation. - """ + """ raise NotImplementedError # @@ -104,7 +104,7 @@ class Codec: # interfaces which can be used to implement new encodings submodules # very easily. See encodings/utf_8.py for an example on how this is # done. -# +# class StreamWriter(Codec): @@ -140,7 +140,7 @@ class StreamWriter(Codec): using .write(). """ self.write(''.join(list)) - + def reset(self): """ Flushes and resets the codec buffers used for keeping state. @@ -206,7 +206,7 @@ class StreamReader(Codec): # Unsliced reading: if size < 0: return self.decode(self.stream.read())[0] - + # Sliced reading: read = self.stream.read decode = self.decode @@ -238,14 +238,14 @@ class StreamReader(Codec): size, if given, is passed as size argument to the stream's .readline() method. - + """ if size is None: line = self.stream.readline() else: line = self.stream.readline(size) return self.decode(line)[0] - + def readlines(self, sizehint=0): @@ -254,7 +254,7 @@ class StreamReader(Codec): Line breaks are implemented using the codec's decoder method and are included in the list entries. - + sizehint, if given, is passed as size argument to the stream's .read() method. @@ -354,7 +354,7 @@ class StreamRecoder: """ Creates a StreamRecoder instance which implements a two-way conversion: encode and decode work on the frontend (the - input to .read() and output of .write()) while + input to .read() and output of .write()) while Reader and Writer work on the backend (reading and writing to the stream). @@ -502,13 +502,13 @@ def EncodedFile(file, data_encoding, file_encoding=None, errors='strict'): return sr ### Tests - + if __name__ == '__main__': import sys - + # Make stdout translate Latin-1 output into UTF-8 output sys.stdout = EncodedFile(sys.stdout, 'latin-1', 'utf-8') - + # Have stdin translate Latin-1 input into UTF-8 input sys.stdin = EncodedFile(sys.stdin, 'utf-8', 'latin-1') |