| 207 | |
| 208 | |
| 209 | class InputWrapper: |
| 210 | |
| 211 | def __init__(self, wsgi_input): |
| 212 | self.input = wsgi_input |
| 213 | |
| 214 | def read(self, *args): |
| 215 | assert len(args) <= 1 |
| 216 | v = self.input.read(*args) |
| 217 | assert type(v) is bytes |
| 218 | return v |
| 219 | |
| 220 | def readline(self, *args): |
| 221 | v = self.input.readline(*args) |
| 222 | assert type(v) is bytes |
| 223 | return v |
| 224 | |
| 225 | def readlines(self, *args): |
| 226 | assert len(args) <= 1 |
| 227 | lines = self.input.readlines(*args) |
| 228 | assert isinstance(lines, list) |
| 229 | for line in lines: |
| 230 | assert type(line) is bytes |
| 231 | return lines |
| 232 | |
| 233 | def __iter__(self): |
| 234 | while 1: |
| 235 | line = self.readline() |
| 236 | if not line: |
| 237 | return |
| 238 | yield line |
| 239 | |
| 240 | def close(self): |
| 241 | raise AssertionError("input.close() must not be called") |
| 242 | |
| 243 | def seek(self, *a, **kw): |
| 244 | return self.input.seek(*a, **kw) |
| 245 | |
| 246 | |
| 247 | class ErrorWrapper: |
no outgoing calls
searching dependent graphs…