File tree 1 file changed +11
-8
lines changed
1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -108,21 +108,24 @@ def _generate_query_params(
108
108
yield key , json_obj
109
109
elif isinstance (json_obj , (int , float , Decimal )):
110
110
key = "." .join (current_param )
111
- if math .isnan (json_obj ):
112
- value = "NaN"
113
- elif json_obj == math .inf :
114
- value = "Infinity"
115
- elif json_obj == - math .inf :
116
- value = "-Infinity"
117
- else :
118
- value = str (json_obj )
111
+ value = _number_to_str (json_obj )
119
112
yield key , value
120
113
elif isinstance (json_obj , str ):
121
114
yield from _generate_query_params_for_str (json_obj , current_param )
122
115
else :
123
116
raise JsonUrleyError (f"unexpected_type:{ json_obj } " )
124
117
125
118
119
+ def _number_to_str (value ):
120
+ if math .isnan (value ):
121
+ return "NaN"
122
+ if value == math .inf :
123
+ return "Infinity"
124
+ if value == - math .inf :
125
+ return "-Infinity"
126
+ return str (value )
127
+
128
+
126
129
def _generate_query_params_for_list (
127
130
json_obj : List , current_param : List [str ], is_nested_list : bool
128
131
):
You can’t perform that action at this time.
0 commit comments