MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / _get_count

Method _get_count

keepercommander/discovery_common/process.py:1318–1359  ·  view source on GitHub ↗

Get the number of vertices that have not been converted to record. This will recurse down the graph. To be counted, the current vertex being evaluated, must ... * not have record UID. * not be ignored either by flag or rule. * not be auto added.

(self, current_vertex: DAGVertex)

Source from the content-addressed store, hash-verified

1316 return None
1317
1318 def _get_count(self, current_vertex: DAGVertex) -> int:
1319
1320 """
1321 Get the number of vertices that have not been converted to record.
1322
1323 This will recurse down the graph.
1324 To be counted, the current vertex being evaluated, must ...
1325
1326 * not have record UID.
1327 * not be ignored either by flag or rule.
1328 * not be auto added.
1329
1330 To recurse down, the current vertex being evaluated, must ...
1331
1332 * have a record UID
1333 * not be ignored either by flag or rule.
1334
1335 """
1336
1337 count = 0
1338
1339 for vertex in current_vertex.has_vertices():
1340 if not vertex.active:
1341 continue
1342 content = DiscoveryObject.get_discovery_object(vertex)
1343
1344 # Add this record to the count, if no record UID, not ignoring, and we are not auto adding or
1345 # ignoring from rules.
1346 if (content.record_uid is None
1347 and content.ignore_object is False
1348 and content.action_rules_result != "add"
1349 and content.action_rules_result != "ignore"):
1350 count += 1
1351
1352 # Go deeper if there is a record UID, and we are not ignoring, and the rule result is not to ignore.
1353 if (
1354 content.record_uid is not None
1355 and content.ignore_object is False
1356 and content.action_rules_result != "ignore"):
1357 count += self._get_count(vertex)
1358
1359 return count
1360
1361 @property
1362 def no_items_left(self):

Callers 2

no_items_leftMethod · 0.95
runMethod · 0.95

Calls 2

has_verticesMethod · 0.80
get_discovery_objectMethod · 0.80

Tested by

no test coverage detected