Skip to content

Commit

Permalink
fix: add util to convert numric to string
Browse files Browse the repository at this point in the history
  • Loading branch information
manjeet9727 committed Apr 24, 2024
1 parent b157061 commit bf5899e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ethereumetl/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@
from ethereumetl.misc.retriable_value_error import RetriableValueError
from typing import List, Union

def convert_numeric_to_string(obj):
if isinstance(obj, dict):
for key, value in obj.items():
obj[key] = convert_numeric_to_string(value)
elif isinstance(obj, list):
for i in range(len(obj)):
obj[i] = convert_numeric_to_string(obj[i])
elif isinstance(obj, (int, float)) and not isinstance(obj, bool):
obj = str(obj)
return obj

def hex_to_dec(hex_string):
if hex_string is None:
return None
Expand Down

0 comments on commit bf5899e

Please sign in to comment.