# - - - B i r d N o t e T r e e . _ r e a d M o n t h
def _readMonth(self, monthKey):
'''Convert one month's data file into a BirdNoteSet.
[ monthKey is a month as "YYYY-MM" ->
if the month file corresponding to monthKey is
readable and valid ->
return a BirdNoteSet instance representing
that file
else -> raise IOError ]
'''
First we create an empty BirdNoteSet and
assemble the path name to the month file. Then we use the
BirdNoteSet.readFile() method to read it. For
documentation on the BirdNoteSet class, see
the
specification.
#-- 1 --
# [ birdNoteSet := a new, empty BirdNoteSet instance using
# self.txny for its taxonomy
# inFileName := path name for the month file corresponding
# to monthKey ]
birdNoteSet = BirdNoteSet(self.txny)
inFileName = os.path.join(self.rootDir,
("%s/%s.xml" % (monthKey[:4], monthKey)))
#-- 2 --
# [ if inFileName names a readable file valid against
# birdnotes.rnc ->
# birdNoteSet := birdNoteSet with that file added
# else -> raise IOError ]
birdNoteSet.readFile(inFileName)
#-- 3 --
return birdNoteSet