Skip to content

Commit 68c8548

Browse files
authored
[json] Use literal return type for detect_encoding (#15609)
1 parent 1ff88bf commit 68c8548

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

stdlib/json/__init__.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from _typeshed import SupportsRead, SupportsWrite
22
from collections.abc import Callable
3-
from typing import Any
3+
from typing import Any, Literal
44

55
from .decoder import JSONDecodeError as JSONDecodeError, JSONDecoder as JSONDecoder
66
from .encoder import JSONEncoder as JSONEncoder
@@ -58,4 +58,6 @@ def load(
5858
object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = None,
5959
**kwds: Any,
6060
) -> Any: ...
61-
def detect_encoding(b: bytes | bytearray) -> str: ... # undocumented
61+
def detect_encoding(
62+
b: bytes | bytearray,
63+
) -> Literal["utf-8", "utf-8-sig", "utf-16", "utf-16-be", "utf-16-le", "utf-32", "utf-32-be", "utf-32-le"]: ... # undocumented

0 commit comments

Comments
 (0)