mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-22 03:41:28 +08:00
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:
committed by
Jelle Zijlstra
parent
48fc8d6d82
commit
6d6894e1ef
25
third_party/2and3/werkzeug/wsgi.pyi
vendored
25
third_party/2and3/werkzeug/wsgi.pyi
vendored
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Optional
|
||||
from typing import Any, Optional, Protocol, Iterable
|
||||
from wsgiref.types import WSGIEnvironment, InputStream
|
||||
|
||||
def responder(f): ...
|
||||
@@ -40,18 +40,21 @@ class ClosingIterator:
|
||||
def __next__(self): ...
|
||||
def close(self): ...
|
||||
|
||||
def wrap_file(environ, file, buffer_size=8192): ...
|
||||
class _Readable(Protocol):
|
||||
def read(self, size: int = ...) -> bytes: ...
|
||||
|
||||
def wrap_file(environ: WSGIEnvironment, file: _Readable, buffer_size: int = ...) -> Iterable[bytes]: ...
|
||||
|
||||
class FileWrapper:
|
||||
file = ... # type: Any
|
||||
buffer_size = ... # type: Any
|
||||
def __init__(self, file, buffer_size=8192): ...
|
||||
def close(self): ...
|
||||
def seekable(self): ...
|
||||
def seek(self, *args): ...
|
||||
def tell(self): ...
|
||||
def __iter__(self): ...
|
||||
def __next__(self): ...
|
||||
file: _Readable
|
||||
buffer_size: int
|
||||
def __init__(self, file: _Readable, buffer_size: int = ...) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def seekable(self) -> bool: ...
|
||||
def seek(self, offset: int, whence: int = ...) -> None: ...
|
||||
def tell(self) -> Optional[int]: ...
|
||||
def __iter__(self) -> FileWrapper: ...
|
||||
def __next__(self) -> bytes: ...
|
||||
|
||||
class _RangeWrapper:
|
||||
iterable = ... # type: Any
|
||||
|
||||
Reference in New Issue
Block a user