diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-03-06 23:59:29 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-03-06 23:59:29 (GMT) |
commit | 113f60740e48a485c483c44db4cb3f9c67e1714d (patch) | |
tree | 063a823ecf613e4ebdc2c3889b8a09021a83c715 /Lib/io.py | |
parent | 0e94189e1b271b8d986a0d7804a2c87bf44ea320 (diff) | |
download | cpython-113f60740e48a485c483c44db4cb3f9c67e1714d.zip cpython-113f60740e48a485c483c44db4cb3f9c67e1714d.tar.gz cpython-113f60740e48a485c483c44db4cb3f9c67e1714d.tar.bz2 |
simplify and beautify code
Diffstat (limited to 'Lib/io.py')
-rw-r--r-- | Lib/io.py | 35 |
1 files changed, 12 insertions, 23 deletions
@@ -58,12 +58,12 @@ __all__ = ["BlockingIOError", "open", "IOBase", "RawIOBase", "FileIO", import _io import abc -# open() uses st_blksize whenever we can -DEFAULT_BUFFER_SIZE = _io.DEFAULT_BUFFER_SIZE -BlockingIOError = _io.BlockingIOError -UnsupportedOperation = _io.UnsupportedOperation -open = _io.open -OpenWrapper = _io.open +from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError, UnsupportedOperation, + open, FileIO, BytesIO, StringIO, BufferedReader, + BufferedWriter, BufferedRWPair, BufferedRandom, + IncrementalNewlineDecoder, TextIOWrapper) + +OpenWrapper = _io.open # for compatibility with _pyio # Declaring ABCs in C is tricky so we do it here. # Method descriptions and default implementations are inherited from the C @@ -80,23 +80,12 @@ class BufferedIOBase(_io._BufferedIOBase, IOBase): class TextIOBase(_io._TextIOBase, IOBase): pass -FileIO = _io.FileIO -BytesIO = _io.BytesIO -StringIO = _io.StringIO -BufferedReader = _io.BufferedReader -BufferedWriter = _io.BufferedWriter -BufferedRWPair = _io.BufferedRWPair -BufferedRandom = _io.BufferedRandom -IncrementalNewlineDecoder = _io.IncrementalNewlineDecoder -TextIOWrapper = _io.TextIOWrapper - RawIOBase.register(FileIO) -BufferedIOBase.register(BytesIO) -BufferedIOBase.register(BufferedReader) -BufferedIOBase.register(BufferedWriter) -BufferedIOBase.register(BufferedRandom) -BufferedIOBase.register(BufferedRWPair) +for klass in (BytesIO, BufferedReader, BufferedWriter, BufferedRandom, + BufferedRWPair): + BufferedIOBase.register(klass) -TextIOBase.register(StringIO) -TextIOBase.register(TextIOWrapper) +for klass in (StringIO, TextIOWrapper): + TextIOBase.register(klass) +del klass |