From 62fbc59f3c4ed1cb3bf0a212b1e658ec83b718db Mon Sep 17 00:00:00 2001 From: karming Date: Thu, 14 Apr 2022 21:24:25 -0400 Subject: [PATCH] update #loads param's type annotation --- src/flask/json/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/flask/json/__init__.py b/src/flask/json/__init__.py index 43c018e7..95baf138 100644 --- a/src/flask/json/__init__.py +++ b/src/flask/json/__init__.py @@ -153,13 +153,16 @@ def dump( _json.dump(obj, fp, **kwargs) -def loads(s: str, app: t.Optional["Flask"] = None, **kwargs: t.Any) -> t.Any: - """Deserialize an object from a string of JSON. +def loads( + s: t.Union[str, bytes, bytearray], app: t.Optional["Flask"] = None, **kwargs: t.Any +) -> t.Any: + """Deserialize a string, bytes or bytearray instance containing + a JSON document to a Python object. Takes the same arguments as the built-in :func:`json.loads`, with some defaults from application configuration. - :param s: JSON string to deserialize. + :param s: String, bytes or bytearray instance to deserialize. :param app: Use this app's config instead of the active app context or defaults. :param kwargs: Extra arguments passed to :func:`json.loads`.