Skip to content

Commit 8c6065b

Browse files
committed
Add an option to disable tqdm
1 parent b724ce9 commit 8c6065b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

fedivertex/main.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def get_graph(
142142
index: Optional[int] = None,
143143
date: Optional[str] = None,
144144
only_largest_component: bool = False,
145+
disable_tqdm: bool = False,
145146
) -> nx.Graph:
146147
"""Provide a graph for a given software and graph type.
147148
By default, we provide the latest graph but it can also be selected using the date or index.
@@ -156,6 +157,8 @@ def get_graph(
156157
:type date: Optional[str], optional
157158
:param only_largest_component: only returns the largest connected component, defaults to False
158159
:type only_largest_component: bool, optional
160+
:param disable_tqdm: disables the TQDM progress bars, defaults to False
161+
:type disable_tqdm: bool, optional
159162
:raises ValueError: if both a date and an index are provided.
160163
:return: a graph in the NetworkX format
161164
:rtype: nx.Graph
@@ -185,7 +188,9 @@ def get_graph(
185188
else:
186189
graph = nx.DiGraph()
187190

188-
for record in tqdm(instance_records, desc="Adding the nodes"):
191+
for record in tqdm(
192+
instance_records, desc="Adding the nodes", disable=disable_tqdm
193+
):
189194
host = record[instances_csv_file + "/host"].decode()
190195
graph.add_node(host)
191196
graph.nodes[host]["domain"] = host.split("[DOT]")[-1]
@@ -196,7 +201,9 @@ def get_graph(
196201
if col_name not in ["host", "Id", "Label"]:
197202
graph.nodes[host][col_name] = val
198203

199-
for record in tqdm(interaction_records, desc="Adding the edges"):
204+
for record in tqdm(
205+
interaction_records, desc="Adding the edges", disable=disable_tqdm
206+
):
200207
source = record[interactions_csv_file + "/Source"].decode()
201208
target = record[interactions_csv_file + "/Target"].decode()
202209
weight = record[interactions_csv_file + "/Weight"]

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setup(
88
name="fedivertex",
9-
version="0.9.6",
9+
version="0.9.7",
1010
author="Marc DAMIE",
1111
author_email="marc.damie@inria.fr",
1212
description="Interface to download and interact with Fedivertex, the Fediverse Graph Dataset",

0 commit comments

Comments
 (0)