From d34d9272feee3801e58c4525da46a4e85a0d72ab Mon Sep 17 00:00:00 2001 From: randomuser Date: Mon, 22 Nov 2021 18:19:40 -0600 Subject: [PATCH] add RecordCollection.findEntrypoints() --- record.py | 9 +++++++++ record_test.py | 3 +++ 2 files changed, 12 insertions(+) diff --git a/record.py b/record.py index f77e933..cd26bf4 100644 --- a/record.py +++ b/record.py @@ -67,3 +67,12 @@ class RecordCollection(): except KeyError: pass + + def findEntrypoints(self): + ret = [] + + for i in self.objects: + if not self.objects[i].parents: + ret.append(self.objects[i]) + + return ret diff --git a/record_test.py b/record_test.py index 739b906..9202490 100644 --- a/record_test.py +++ b/record_test.py @@ -2,4 +2,7 @@ import record records = record.RecordCollection('datafile') +entries = records.findEntrypoints() + print(records.objects) +print(entries)