# - - - B i r d N o t e T r e e . g e n M o n t h s
def genMonths(self, startDate=None, endDate=None,
startSeason=None, endSeason=None):
'''Generate BirdNoteSet instances from the tree
'''
Attribute self._monthList contains the
sorted list of " strings for
the files that appear to be notes files. There is, of
course, no guarantee that we can read them, or that they
are valid.
YYYY-MM"
For the method that determines whether a given month
falls within the selected ranges, see Section 20.4, “BirdNoteTree._timeFilter(): Check
date and seasonal ranges”.
For the method that attempts to read the month file,
see Section 20.5, “BirdNoteTree._readMonth()”.
#-- 1 --
# [ if all month files corresponding to elements of
# self._monthList are readable and valid ->
# generate a sequence of BirdNoteSet instances
# representing those files in the same order
# else ->
# generate zero or more BirdNoteSet instances
# raise IOError ]
for monthKey in self._monthList:
#-- 1 body --
# [ if the month for monthKey cannot contain any
# records in the date interval (startDate, endDate)
# or the season interval (startSeason, endSeason) ->
# I
# else if the month file corresponding to monthKey is
# readable and valid ->
# yield a BirdNoteSet instances representing
# that file
# else ->
# raise IOError ]
if self._timeFilter(monthKey, startDate, endDate,
startSeason, endSeason):
yield self._readMonth(monthKey)