Skip to content
Snippets Groups Projects
Commit 7392340e authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[hash] Import simplejson as json to make it easy to swap

parent 8a28d08f
No related branches found
No related tags found
1 merge request!64Factorize simplejson
...@@ -46,7 +46,7 @@ Also forward importing from :py:mod:`beat.backend.python.hash` ...@@ -46,7 +46,7 @@ Also forward importing from :py:mod:`beat.backend.python.hash`
import collections import collections
import simplejson import simplejson as json
from beat.backend.python.hash import * # noqa from beat.backend.python.hash import * # noqa
from beat.backend.python.hash import _sha256 # noqa from beat.backend.python.hash import _sha256 # noqa
...@@ -165,9 +165,8 @@ def hashJSONStr(contents, description): ...@@ -165,9 +165,8 @@ def hashJSONStr(contents, description):
try: try:
return hashJSON( # noqa return hashJSON( # noqa
simplejson.loads(contents, object_pairs_hook=collections.OrderedDict), json.loads(contents, object_pairs_hook=collections.OrderedDict), description
description,
) # preserve order ) # preserve order
except simplejson.JSONDecodeError: except json.JSONDecodeError:
# falls back to normal file content hashing # falls back to normal file content hashing
return hash(contents) return hash(contents)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment