(*args, **kw)
| 161 | """ |
| 162 | |
| 163 | def lint_app(*args, **kw): |
| 164 | assert len(args) == 2, "Two arguments required" |
| 165 | assert not kw, "No keyword arguments allowed" |
| 166 | environ, start_response = args |
| 167 | |
| 168 | check_environ(environ) |
| 169 | |
| 170 | # We use this to check if the application returns without |
| 171 | # calling start_response: |
| 172 | start_response_started = [] |
| 173 | |
| 174 | def start_response_wrapper(*args, **kw): |
| 175 | assert len(args) == 2 or len(args) == 3, ( |
| 176 | "Invalid number of arguments: %s" % args) |
| 177 | assert not kw, "No keyword arguments allowed" |
| 178 | status = args[0] |
| 179 | headers = args[1] |
| 180 | if len(args) == 3: |
| 181 | exc_info = args[2] |
| 182 | else: |
| 183 | exc_info = None |
| 184 | |
| 185 | check_status(status) |
| 186 | check_headers(headers) |
| 187 | check_content_type(status, headers) |
| 188 | check_exc_info(exc_info) |
| 189 | |
| 190 | start_response_started.append(None) |
| 191 | return WriteWrapper(start_response(*args)) |
| 192 | |
| 193 | environ['wsgi.input'] = InputWrapper(environ['wsgi.input']) |
| 194 | environ['wsgi.errors'] = ErrorWrapper(environ['wsgi.errors']) |
| 195 | |
| 196 | iterator = application(environ, start_response_wrapper) |
| 197 | if not isinstance(iterator, Iterable): |
| 198 | raise AssertionError( |
| 199 | "The application must return an iterator, if only an empty list" |
| 200 | ) |
| 201 | |
| 202 | check_iterator(iterator) |
| 203 | |
| 204 | return IteratorWrapper(iterator, start_response_started) |
| 205 | |
| 206 | return lint_app |
| 207 |
nothing calls this directly
no test coverage detected
searching dependent graphs…