Annotate werkzeug wrap_file() and FileWrapper (#2519)

* Add FileWrapper protocol to wsgiref.types

* Annotate werkzeug's wrap_file and FileWrapper

* Remove empty line at end of file

* Fix _Readable protocols
This commit is contained in:
Sebastian Rittau
2018-10-23 13:43:53 +02:00
committed by Jelle Zijlstra
parent 48fc8d6d82
commit 6d6894e1ef
2 changed files with 20 additions and 11 deletions

View File

@@ -36,3 +36,9 @@ class ErrorStream(Protocol):
def flush(self) -> None: ...
def write(self, s: str) -> None: ...
def writelines(self, seq: List[str]) -> None: ...
class _Readable(Protocol):
def read(self, size: int = ...) -> bytes: ...
# Optional file wrapper in wsgi.file_wrapper
class FileWrapper(Protocol):
def __call__(self, file: _Readable, block_size: int = ...) -> Iterable[bytes]: ...