From d2c0cc6f6340ab2be2bec72e49d3b764971a5579 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Thu, 15 Aug 2024 21:24:08 -0400 Subject: [PATCH 1/3] remove enumerate start --- adbnx_adapter/adapter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adbnx_adapter/adapter.py b/adbnx_adapter/adapter.py index 1c42602..d90e84b 100644 --- a/adbnx_adapter/adapter.py +++ b/adbnx_adapter/adapter.py @@ -345,7 +345,7 @@ def networkx_to_arangodb( bar_progress_task = bar_progress.add_task("Nodes", total=len(nx_nodes)) with Live(Group(bar_progress, spinner_progress)): - for i, (nx_id, nx_node) in enumerate(nx_nodes, 1): + for i, (nx_id, nx_node) in enumerate(nx_nodes): bar_progress.advance(bar_progress_task) # 1. Process NetworkX node @@ -385,7 +385,7 @@ def networkx_to_arangodb( bar_progress_task = bar_progress.add_task("Edges", total=len(nx_edges)) with Live(Group(bar_progress, spinner_progress)): - for i, (from_node_id, to_node_id, nx_edge) in enumerate(nx_edges, 1): + for i, (from_node_id, to_node_id, nx_edge) in enumerate(nx_edges): bar_progress.advance(bar_progress_task) # 1. Process NetworkX edge From 07ce3a761a3178b1194a8a662c0d2be0170032d6 Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Thu, 15 Aug 2024 21:26:26 -0400 Subject: [PATCH 2/3] fix: remove 1 --- tests/test_adapter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_adapter.py b/tests/test_adapter.py index fe92a48..e4e045c 100644 --- a/tests/test_adapter.py +++ b/tests/test_adapter.py @@ -493,7 +493,7 @@ def assert_arangodb_data( has_one_vcol = len(adb_v_cols) == 1 has_one_ecol = len(adb_e_cols) == 1 - for i, (nx_id, nx_node) in enumerate(nx_g.nodes(data=True), 1): + for i, (nx_id, nx_node) in enumerate(nx_g.nodes(data=True)): col = ( adb_v_cols[0] if has_one_vcol From 2cd3f5e3332d9b6179989c08a426da6e4dd4d25b Mon Sep 17 00:00:00 2001 From: Anthony Mahanna Date: Thu, 15 Aug 2024 21:53:25 -0400 Subject: [PATCH 3/3] fix: tricky check --- adbnx_adapter/adapter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adbnx_adapter/adapter.py b/adbnx_adapter/adapter.py index d90e84b..2b61de7 100644 --- a/adbnx_adapter/adapter.py +++ b/adbnx_adapter/adapter.py @@ -360,7 +360,7 @@ def networkx_to_arangodb( ) # 2. Insert batch of nodes - if i % node_batch_size == 0: + if i and i % node_batch_size == 0: self.__insert_adb_docs( spinner_progress, adb_docs, use_async, **adb_import_kwargs ) @@ -401,7 +401,7 @@ def networkx_to_arangodb( ) # 2. Insert batch of edges - if i % edge_batch_size == 0: + if i and i % edge_batch_size == 0: self.__insert_adb_docs( spinner_progress, adb_docs, use_async, **adb_import_kwargs )