| 52 | simple abstraction -- it parses until EOF closes the current message. |
| 53 | """ |
| 54 | def __init__(self): |
| 55 | # Text stream of the last partial line pushed into this object. |
| 56 | # See issue 22233 for why this is a text stream and not a list. |
| 57 | self._partial = StringIO(newline='') |
| 58 | # A deque of full, pushed lines |
| 59 | self._lines = deque() |
| 60 | # The stack of false-EOF checking predicates. |
| 61 | self._eofstack = [] |
| 62 | # A flag indicating whether the file has been closed or not. |
| 63 | self._closed = False |
| 64 | |
| 65 | def push_eof_matcher(self, pred): |
| 66 | self._eofstack.append(pred) |