move self.objects declaration from RC._fromFile() to RC.__init__()

This commit is contained in:
randomuser 2021-11-23 11:20:59 -06:00
parent 9c7fdbd6e3
commit 6dcb343243
1 changed files with 2 additions and 1 deletions

View File

@ -30,6 +30,8 @@ class Record:
class RecordCollection():
def __init__(self, file):
self.objects = {}
with filewrapper(file, "r") as fd:
self._fromFile(fd)
self._parent()
@ -37,7 +39,6 @@ class RecordCollection():
def _fromFile(self, fd):
lines = [i.rstrip() for i in fd.readlines()]
self.objects = {}
current = Record()
for i in lines: