mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-14 22:21:44 +08:00
Add IO protocols to _typeshed (#4230)
This commit is contained in:
@@ -9,7 +9,6 @@ from typing import (
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Protocol,
|
||||
Text,
|
||||
TextIO,
|
||||
Tuple,
|
||||
@@ -20,6 +19,7 @@ from typing import (
|
||||
from types import TracebackType
|
||||
from socket import socket
|
||||
from ssl import SSLContext
|
||||
from _typeshed import SupportsRead, SupportsReadline
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_IntOrStr = Union[int, Text]
|
||||
@@ -39,12 +39,6 @@ class error_proto(Error): ...
|
||||
|
||||
all_errors = Tuple[Type[Exception], ...]
|
||||
|
||||
class _Readable(Protocol):
|
||||
def read(self, __length: int) -> bytes: ...
|
||||
|
||||
class _ReadLineable(Protocol):
|
||||
def readline(self, _length: int) -> bytes: ...
|
||||
|
||||
class FTP:
|
||||
debugging: int
|
||||
|
||||
@@ -118,13 +112,13 @@ class FTP:
|
||||
def storbinary(
|
||||
self,
|
||||
cmd: Text,
|
||||
fp: _Readable,
|
||||
fp: SupportsRead[bytes],
|
||||
blocksize: int = ...,
|
||||
callback: Optional[Callable[[bytes], Any]] = ...,
|
||||
rest: Optional[_IntOrStr] = ...,
|
||||
) -> str: ...
|
||||
def retrlines(self, cmd: Text, callback: Optional[Callable[[str], Any]] = ...) -> str: ...
|
||||
def storlines(self, cmd: Text, fp: _ReadLineable, callback: Optional[Callable[[bytes], Any]] = ...) -> str: ...
|
||||
def storlines(self, cmd: Text, fp: SupportsReadline[bytes], callback: Optional[Callable[[bytes], Any]] = ...) -> str: ...
|
||||
def acct(self, password: Text) -> str: ...
|
||||
def nlst(self, *args: Text) -> List[str]: ...
|
||||
# Technically only the last arg can be a Callable but ...
|
||||
|
||||
Reference in New Issue
Block a user