Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove enumerate start #97

Merged
merged 3 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading