Skip to content

Commit febe0a3

Browse files
authored
Better type return value of json.detect_encoding
1 parent 97d1089 commit febe0a3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stdlib/json/__init__.pyi

Lines changed: 2 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,4 @@ 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(b: bytes | bytearray) -> 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)