Skip to content

Commit

Permalink
remove enumerate start (#97)
Browse files Browse the repository at this point in the history
* remove enumerate start

* fix: remove 1

* fix: tricky check
  • Loading branch information
aMahanna authored Aug 16, 2024
1 parent 4d9e96d commit db1da5a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions adbnx_adapter/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
)
Expand All @@ -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
Expand All @@ -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
)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit db1da5a

Please sign in to comment.