File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 2
2
# Licensed under the MIT License.
3
3
4
4
from enum import Enum
5
+ from typing import AnyStr , Any
5
6
import os
6
7
7
8
AZUREFUNCTIONS_UJSON_ENV_VAR = 'AZUREFUNCTIONS_UJSON'
@@ -40,21 +41,21 @@ def default(self, o):
40
41
JSONDecodeError = json .JSONDecodeError
41
42
42
43
if HAS_UJSON :
43
- def dumps (v , ** kwargs ):
44
+ def dumps (v : Any , ** kwargs ) -> str :
44
45
if 'default' in kwargs :
45
46
return json .dumps (v , ** kwargs )
46
47
47
48
if 'cls' in kwargs :
48
49
del kwargs ['cls' ]
49
-
50
+
50
51
return ujson .dumps (v , ** kwargs )
51
52
52
- def loads (* args , ** kwargs ):
53
+ def loads (s : AnyStr , ** kwargs ):
53
54
if kwargs :
54
- return json .loads (* args , ** kwargs )
55
+ return json .loads (s , ** kwargs )
55
56
else : # ujson takes no kwargs
56
- return ujson .loads (* args )
57
+ return ujson .loads (s )
57
58
58
59
else :
59
- dumps = json .dumps
60
+ dumps = json .dumps # type: ignore
60
61
loads = json .loads
Original file line number Diff line number Diff line change 12
12
'pytest-cov' ,
13
13
'pytest-benchmark' ,
14
14
'requests==2.*' ,
15
- 'coverage'
15
+ 'coverage' ,
16
+ 'types-ujson'
16
17
],
17
18
'ujson' : ['ujson>=5.3.0,<6.0' ]
18
19
}
You can’t perform that action at this time.
0 commit comments