Skip to content

Commit 94e0625

Browse files
timabbottgvanrossum
authored andcommitted
Fix ujson stubs to properly use AnyStr. (#540)
The ujson module apparently will accept both bytes and text format input, however, it does always output a str (both on Python 2 and Python 3). Some discussion in: #460
1 parent 052574d commit 94e0625

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

third_party/2and3/ujson.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Stubs for ujson
22
# See: https://pypi.python.org/pypi/ujson
3-
from typing import Any, IO, Optional
3+
from typing import Any, AnyStr, IO, Optional
44

55
__version__ = ... # type: str
66

@@ -32,14 +32,14 @@ def dump(obj: Any,
3232
indent: int = ...,
3333
) -> None: ...
3434

35-
def decode(s: str,
35+
def decode(s: AnyStr,
3636
precise_float: bool = ...,
3737
) -> Any: ...
3838

39-
def loads(s: str,
39+
def loads(s: AnyStr,
4040
precise_float: bool = ...,
4141
) -> Any: ...
4242

43-
def load(fp: IO[str],
43+
def load(fp: IO[AnyStr],
4444
precise_float: bool = ...,
4545
) -> Any: ...

0 commit comments

Comments
 (0)