[Python-checkins] CVS: python/dist/src/Lib codecs.py,1.6,1.7
Guido van Rossum
python-dev@python.org
Tue, 11 Apr 2000 11:41:40 -0400 (EDT)
Update of /projects/cvsroot/python/dist/src/Lib
In directory eric:/projects/python/develop/guido/src/Lib
Modified Files:
codecs.py
Log Message:
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.
Index: codecs.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Lib/codecs.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** codecs.py 2000/04/11 15:37:43 1.6
--- codecs.py 2000/04/11 15:41:38 1.7
***************
*** 28,32 ****
# corresponds to Unicode U+FEFF in UTF-16 on big endian
# platforms == ZERO WIDTH NO-BREAK SPACE
! 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
--- 28,32 ----
# corresponds to Unicode U+FEFF in UTF-16 on big endian
# platforms == ZERO WIDTH NO-BREAK SPACE
! 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
***************
*** 59,63 ****
"""
def encode(self,input,errors='strict'):
!
""" Encodes the object input and returns a tuple (output
object, length consumed).
--- 59,63 ----
"""
def encode(self,input,errors='strict'):
!
""" Encodes the object input and returns a tuple (output
object, length consumed).
***************
*** 85,89 ****
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.
--- 85,89 ----
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.
***************
*** 97,101 ****
situation.
! """
raise NotImplementedError
--- 97,101 ----
situation.
! """
raise NotImplementedError
***************
*** 105,109 ****
# very easily. See encodings/utf_8.py for an example on how this is
# done.
! #
class StreamWriter(Codec):
--- 105,109 ----
# very easily. See encodings/utf_8.py for an example on how this is
# done.
! #
class StreamWriter(Codec):
***************
*** 141,145 ****
"""
self.write(''.join(list))
!
def reset(self):
--- 141,145 ----
"""
self.write(''.join(list))
!
def reset(self):
***************
*** 207,211 ****
if size < 0:
return self.decode(self.stream.read())[0]
!
# Sliced reading:
read = self.stream.read
--- 207,211 ----
if size < 0:
return self.decode(self.stream.read())[0]
!
# Sliced reading:
read = self.stream.read
***************
*** 239,243 ****
size, if given, is passed as size argument to the stream's
.readline() method.
!
"""
if size is None:
--- 239,243 ----
size, if given, is passed as size argument to the stream's
.readline() method.
!
"""
if size is None:
***************
*** 246,250 ****
line = self.stream.readline(size)
return self.decode(line)[0]
!
def readlines(self, sizehint=0):
--- 246,250 ----
line = self.stream.readline(size)
return self.decode(line)[0]
!
def readlines(self, sizehint=0):
***************
*** 255,259 ****
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.
--- 255,259 ----
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.
***************
*** 355,359 ****
""" 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
Reader and Writer work on the backend (reading and
writing to the stream).
--- 355,359 ----
""" 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
Reader and Writer work on the backend (reading and
writing to the stream).
***************
*** 503,514 ****
### 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')
--- 503,514 ----
### 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')