Author: Brian Kearns <bdkea...@gmail.com> Branch: stdlib-2.7.6 Changeset: r69740:0a4d945c60dc Date: 2014-03-05 16:58 -0500 http://bitbucket.org/pypy/pypy/changeset/0a4d945c60dc/
Log: cleanup diff --git a/pypy/module/_file/test/test_file_extra.py b/pypy/module/_file/test/test_file_extra.py --- a/pypy/module/_file/test/test_file_extra.py +++ b/pypy/module/_file/test/test_file_extra.py @@ -217,9 +217,7 @@ expected_filename = str(udir.join('sample')) expected_mode = 'rb' extra_args = () - spaceconfig = { - "usemodules": ["binascii", "rctime"], - } + spaceconfig = {"usemodules": ["binascii", "rctime"]} def setup_method(self, method): space = self.space @@ -279,9 +277,7 @@ expected_filename = '<fdopen>' expected_mode = 'rb' extra_args = () - spaceconfig = { - "usemodules": ["binascii", "rctime"], - } + spaceconfig = {"usemodules": ["binascii", "rctime"]} def setup_method(self, method): space = self.space @@ -359,9 +355,7 @@ # A few extra tests class AppTestAFewExtra: - spaceconfig = { - "usemodules": ['array', '_socket', 'binascii', 'rctime'], - } + spaceconfig = {"usemodules": ['array', '_socket', 'binascii', 'rctime']} def setup_method(self, method): fn = str(udir.join('temptestfile')) diff --git a/rpython/rlib/streamio.py b/rpython/rlib/streamio.py --- a/rpython/rlib/streamio.py +++ b/rpython/rlib/streamio.py @@ -26,16 +26,13 @@ You typically take a basis stream, place zero or more filtering streams on top of it, and then top it off with an input-buffering and/or an outout-buffering stream. - """ -# # File offsets are all 'r_longlong', but a single read or write cannot # transfer more data that fits in an RPython 'int' (because that would not # fit in a single string anyway). This module needs to be careful about # where r_longlong values end up: as argument to seek() and truncate() and # return value of tell(), but not as argument to read(). -# import os, sys, errno from rpython.rlib.objectmodel import specialize, we_are_translated @@ -56,14 +53,12 @@ } class MyNotImplementedError(Exception): - """ - Catching NotImplementedError is not RPython, so we use this custom class + """Catching NotImplementedError is not RPython, so we use this custom class instead of it """ # ____________________________________________________________ - def replace_crlf_with_lf(s): substrings = s.split("\r") result = [substrings[0]] @@ -206,7 +201,6 @@ class Stream(object): - """Base class for streams. Provides a default implementation of some methods.""" @@ -281,7 +275,6 @@ class DiskFile(Stream): - """Standard I/O basis stream using os.open/close/read/write/lseek""" def __init__(self, fd): @@ -361,7 +354,6 @@ # next class is not RPython class MMapFile(Stream): - """Standard I/O basis stream using mmap.""" def __init__(self, fd, mmapaccess): @@ -508,7 +500,6 @@ return intoffset class BufferingInputStream(Stream): - """Standard buffering input stream. This, and BufferingOutputStream if needed, are typically at the top of @@ -722,7 +713,6 @@ class BufferingOutputStream(Stream): - """Standard buffering output stream. This, and BufferingInputStream if needed, are typically at the top of @@ -780,7 +770,6 @@ class LineBufferingOutputStream(BufferingOutputStream): - """Line buffering output stream. This is typically the top of the stack. @@ -811,12 +800,9 @@ self.buf = [data[p:]] self.buflen = len(self.buf[0]) - # ____________________________________________________________ - class CRLFFilter(Stream): - """Filtering stream for universal newlines. TextInputFilter is more general, but this is faster when you don't @@ -846,7 +832,6 @@ flush_buffers=False) class TextCRLFFilter(Stream): - """Filtering stream for universal newlines. TextInputFilter is more general, but this is faster when you don't @@ -913,9 +898,8 @@ close1 = PassThrough("close1", flush_buffers=False) try_to_find_file_descriptor = PassThrough("try_to_find_file_descriptor", flush_buffers=False) - + class TextInputFilter(Stream): - """Filtering input stream for universal newline translation.""" def __init__(self, base): @@ -948,7 +932,7 @@ # CR separator or half of a CRLF separator. Neither will be marked # as seen, since you are waiting for your next read to determine # what you have seen. But there's no more to read ... - + if self.atcr: if data.startswith("\n"): data = data[1:] @@ -958,7 +942,7 @@ else: self.CR = True self.atcr = False - + for i in range(len(data)): if data[i] == '\n': if i > 0 and data[i-1] == '\r': @@ -968,11 +952,11 @@ elif data[i] == '\r': if i < len(data)-1 and data[i+1] != '\n': self.CR = True - + if "\r" in data: self.atcr = data.endswith("\r") data = replace_crlf_with_lf(data) - + return data def readline(self): @@ -1013,7 +997,7 @@ if self.atcr: # Must read the next byte to see if it's \n, # because then we must report the next position. - assert not self.buf + assert not self.buf self.buf = self.do_read(1) pos += 1 self.atcr = False @@ -1050,7 +1034,6 @@ class TextOutputFilter(Stream): - """Filtering output stream for universal newline translation.""" def __init__(self, base, linesep=os.linesep): @@ -1105,7 +1088,6 @@ # The following functions are _not_ RPython! class DecodingInputFilter(Stream): - """Filtering input stream that decodes an encoded file.""" def __init__(self, base, encoding="utf8", errors="strict"): @@ -1152,7 +1134,6 @@ flush_buffers=False) class EncodingOutputFilter(Stream): - """Filtering output stream that writes to an encoded file.""" def __init__(self, base, encoding="utf8", errors="strict"): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit