mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-10-12 18:38:03 +00:00
Use orjson when already installed or with speedups extra (#466)
* Use orjson when already installed * Use orjson when already installed * fix patch target * fix patch target * add speedups extra * Update README.md * Update README.md
This commit is contained in:
15
kasa/json.py
Executable file
15
kasa/json.py
Executable file
@@ -0,0 +1,15 @@
|
||||
"""JSON abstraction."""
|
||||
|
||||
try:
|
||||
import orjson
|
||||
|
||||
def dumps(obj, *, default=None):
|
||||
"""Dump JSON."""
|
||||
return orjson.dumps(obj).decode()
|
||||
|
||||
loads = orjson.loads
|
||||
except ImportError:
|
||||
import json
|
||||
|
||||
dumps = json.dumps
|
||||
loads = json.loads
|
Reference in New Issue
Block a user