mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-20 10:51:15 +08:00
Make 2.7's json.load use a protocol for fp (#2826)
This matches what the 3 stub does
This commit is contained in:
committed by
Jelle Zijlstra
parent
e0211269d1
commit
939be9a787
@@ -1,4 +1,4 @@
|
||||
from typing import Any, IO, Optional, Tuple, Callable, Dict, List, Union, Text
|
||||
from typing import Any, IO, Optional, Tuple, Callable, Dict, List, Union, Text, Protocol
|
||||
|
||||
class JSONDecodeError(ValueError):
|
||||
def dumps(self, obj: Any) -> str: ...
|
||||
@@ -43,7 +43,10 @@ def loads(s: Union[Text, bytes],
|
||||
object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
|
||||
**kwds: Any) -> Any: ...
|
||||
|
||||
def load(fp: IO[str],
|
||||
class _Reader(Protocol):
|
||||
def read(self) -> Union[Text, bytes]: ...
|
||||
|
||||
def load(fp: _Reader,
|
||||
encoding: Optional[str] = ...,
|
||||
cls: Any = ...,
|
||||
object_hook: Optional[Callable[[Dict], Any]] = ...,
|
||||
|
||||
Reference in New Issue
Block a user