(self)
| 77 | self._closed = True |
| 78 | |
| 79 | def readline(self): |
| 80 | if not self._lines: |
| 81 | if self._closed: |
| 82 | return '' |
| 83 | return NeedMoreData |
| 84 | # Pop the line off the stack and see if it matches the current |
| 85 | # false-EOF predicate. |
| 86 | line = self._lines.popleft() |
| 87 | # RFC 2046, section 5.1.2 requires us to recognize outer level |
| 88 | # boundaries at any level of inner nesting. Do this, but be sure it's |
| 89 | # in the order of most to least nested. |
| 90 | for ateof in reversed(self._eofstack): |
| 91 | if ateof(line): |
| 92 | # We're at the false EOF. But push the last line back first. |
| 93 | self._lines.appendleft(line) |
| 94 | return '' |
| 95 | return line |
| 96 | |
| 97 | def unreadline(self, line): |
| 98 | # Let the consumer push a line back into the buffer. |
no test coverage detected