@@ -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" ]
0 commit comments