Next / Previous / Contents / TCC Help System / NM Tech homepage

22.1. PriIndex.__init__()

cbchistlib.py
# - - -   P r i I n d e x . _ _ i n i t _ _

    def __init__(self, db, circle, firstYear=MIN_YEAR,
                 lastYear=MAX_YEAR, isOverlap=False):
        '''Constructor.
        '''
        #-- 1
        # [ self  :=  self as a BaseIndex for db and circle ]
        BaseIndex.__init__(self, db, circle.cir_name, circle.lat,
                           circle.lon)
        self.circle = circle
        self.firstYear = firstYear
        self.lastYear = lastYear
        self.isOverlap = isOverlap

The display of years worked comes from the Effort table, which we keep sorted by year: see Section 22.2, “PriIndex.effByYear(): Sorting function for effort records”.

cbchistlib.py
        #-- 2
        # [ self.effortList  :=  Effort instances associated with this
        #       circle from year numbers in [firstYear, lastYear]
        self.effortList = [ effort
                            for effort in self.circle.efforts
                            if (effort.year_no >= firstYear) and
                               (effort.year_no <= lastYear) ]

        #-- 4
        # [ self.effortList  :=  self.effortList ordered by
        #     (year_no, year_key) ]
        self.effortList.sort(self.effByYear)