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

8.11. regx.cgi: addSecondaries(): Generate secondary index entries for one circle

regx.cgi
# - - -   a d d S e c o n d a r i e s

def addSecondaries(db, entryList, priIndex, firstYear, lastYear):
    '''Generate secondary entries for name variants.

      [ (db is a pycbc.CBCData instance) and
        (entryList is a list) and
        (priIndex is a PriIndex instance) and
        (firstYear and lastYear are the first and last included year
        numbers formatted in year-number format) ->
          entryList  +:=  SecEntry instances for each unique
              as_name value from priIndex.effortList, but not
              including circle.cir_name ]
    '''

First we find the set containing all the unique names that occur in priIndex.effortList. Then we remove the standard name from the set. This gives us a set of all the variant names.

regx.cgi
    #-- 1
    # [ variantSet  :=  a set containing the unique values of the
    #       as_name fields from elements of priIndex.effortList,
    #       minus circle.cir_name ]
    variantSet = set ( [ effort.as_name
                         for effort in priIndex.effortList ] )
    variantSet.discard(priIndex.circle.cir_name)

Each variant name becomes an instance of Section 23, “class SecIndex: Secondary regional index entry”.

regx.cgi
    #-- 2
    # [ entryList  :=  SecEntry instances for the efforts in
    #       priIndex, partitioned by unique lat-lon values ]
    for variant in variantSet:
        entryList.append(lib.SecIndex(db, priIndex, variant,
                                      firstYear, lastYear))