File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -11,10 +11,11 @@ def dumps(self, obj) -> str:
1111 def loads (self , s : str ):
1212 pass
1313
14+
1415class OrJsonAdapter (JsonInterface ):
1516 def __init__ (self ):
16- import orjson
17- self .orjson = orjson
17+ import orjson
18+ self .orjson = orjson
1819
1920 def dumps (self , obj ) -> str :
2021 return self .orjson .dumps (obj ).decode ("utf-8" )
@@ -55,16 +56,19 @@ def loads(self, s: str):
5556 except ImportError :
5657 continue
5758
59+
5860def dumps (obj , ** kwargs ) -> str :
5961 if json_impl is None :
6062 raise ImportError ("No JSON adapter found" )
6163 return json_impl .dumps (obj , ** kwargs )
6264
65+
6366def loads (s : str ):
6467 if json_impl is None :
6568 raise ImportError ("No JSON adapter found" )
6669 return json_impl .loads (s )
6770
71+
6872json = types .SimpleNamespace (
6973 dumps = dumps ,
7074 loads = loads
You can’t perform that action at this time.
0 commit comments