mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-27 18:40:36 +00:00
add dump and load methods to the json module if it isn't simplejson
This commit is contained in:
parent
2bece0e03d
commit
33d889aaf8
@ -53,6 +53,15 @@ if not hasattr(json, "dumps"):
|
|||||||
json.dumps = json.write
|
json.dumps = json.write
|
||||||
json.loads = json.read
|
json.loads = json.read
|
||||||
|
|
||||||
|
def dump(obj, fp, **kw):
|
||||||
|
fp.write(json.dumps(obj))
|
||||||
|
|
||||||
|
def load(fp, **kw):
|
||||||
|
return json.loads(fp.read())
|
||||||
|
|
||||||
|
json.dump = dump
|
||||||
|
json.load = load
|
||||||
|
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
import xdg, xdg.BaseDirectory
|
import xdg, xdg.BaseDirectory
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user