Skip to content

Commit

Permalink
rename fn
Browse files Browse the repository at this point in the history
  • Loading branch information
melgazar9 committed Oct 11, 2023
1 parent 46e612c commit ae48025
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tap_mongodb/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@

DEFAULT_START_DATE: str = "1970-01-01"

def recursive_replace_inf_in_dict(dct):
def recursive_replace_empty_in_dict(dct):
for key, value in dct.items():
if value in [-math.inf, math.inf, math.nan]:
dct[key] = None
elif isinstance(value, list):
for i, item in enumerate(value):
if isinstance(item, dict):
recursive_replace_inf_in_dict(item)
recursive_replace_empty_in_dict(item)
elif item in [-math.inf, math.inf, math.nan]:
value[i] = None
elif isinstance(value, dict):
recursive_replace_inf_in_dict(value)
recursive_replace_empty_in_dict(value)
return

def to_object_id(replication_key_value: str) -> ObjectId:
Expand Down Expand Up @@ -214,7 +214,7 @@ def get_records(self, context: dict | None) -> Iterable[dict]:
object_id: ObjectId = record["_id"]
incremental_id: IncrementalId = IncrementalId.from_object_id(object_id)

recursive_replace_inf_in_dict(record)
recursive_replace_empty_in_dict(record)

parsed_record = {
"replication_key": str(incremental_id),
Expand Down

0 comments on commit ae48025

Please sign in to comment.