32
32
default_meta_format = ".json"
33
33
supported_meta_formats = (".json" , ".yml" , ".yaml" )
34
34
35
+ # This is for python 3.7
36
+ # where latest deepdiff is 6.7.1
37
+ if hasattr (deepdiff .diff , "PrettyOrderedSet" ):
38
+ diff_set = getattr (deepdiff .diff , "PrettyOrderedSet" )
39
+ else :
40
+ diff_set = deepdiff .diff .SetOrdered
35
41
36
42
class CustomEncoder (JSONEncoder ):
37
43
def default (self , obj : Any ) -> Any :
@@ -62,10 +68,10 @@ def default(self, obj: Any) -> Any:
62
68
):
63
69
return int (obj )
64
70
65
- elif isinstance (obj , (np .float_ , np . float16 , np .float32 , np .float64 )): # type: ignore
71
+ elif isinstance (obj , (np .float16 , np .float32 , np .float64 )): # type: ignore
66
72
return float (obj )
67
73
68
- elif isinstance (obj , (np .complex_ , np . complex64 , np .complex128 )): # type: ignore
74
+ elif isinstance (obj , (np .complex64 , np .complex128 )): # type: ignore
69
75
return {"real" : obj .real , "imag" : obj .imag }
70
76
71
77
elif isinstance (obj , (np .ndarray ,)):
@@ -77,7 +83,7 @@ def default(self, obj: Any) -> Any:
77
83
elif isinstance (obj , np .void ):
78
84
return None
79
85
80
- elif isinstance (obj , deepdiff . diff . PrettyOrderedSet ):
86
+ elif isinstance (obj , diff_set ):
81
87
return list (obj )
82
88
83
89
elif isinstance (obj , deepdiff .DeepDiff ):
0 commit comments