remove encoder
This commit is contained in:
@@ -1,7 +1,3 @@
|
|||||||
import decimal
|
|
||||||
import json
|
|
||||||
import math
|
|
||||||
|
|
||||||
import dictdiffer
|
import dictdiffer
|
||||||
from arnparse import arnparse
|
from arnparse import arnparse
|
||||||
|
|
||||||
@@ -21,20 +17,3 @@ def diff(first: dict, second: dict) -> list[str]:
|
|||||||
changed.append(path)
|
changed.append(path)
|
||||||
|
|
||||||
return changed
|
return changed
|
||||||
|
|
||||||
|
|
||||||
class JSONEncoder(json.JSONEncoder):
|
|
||||||
def default(self, o):
|
|
||||||
if isinstance(o, decimal.Decimal):
|
|
||||||
if o.is_nan():
|
|
||||||
return math.nan
|
|
||||||
|
|
||||||
if o % 1 != 0:
|
|
||||||
return float(o.quantize(decimal.Decimal('0.00')))
|
|
||||||
|
|
||||||
return int(o)
|
|
||||||
|
|
||||||
if isinstance(o, set):
|
|
||||||
return list(o)
|
|
||||||
|
|
||||||
return super().default(o)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user