Next / Previous / Contents / Shipman's homepage

29.6. CollBind.writeFlat(): Write a collisions file record

# - - -   C o l l B i n d . w r i t e F l a t

    def writeFlat ( self, outFile ):
        '''Write flat file records to the collisions file.

For the exact format of the collisions file, see the specification. Each disambiguation of this collision is written as one record with two fields: the collision code and the disambiguation, each right-padded to length. Just for consistency, we write the disambiguations in ascending order.

        #-- 1 --
        for otherCode in sorted(self.collSet):
            #-- 1 body --
            # [ collFile  +:=  a line containing self.abbr and
            #       otherCode, each left-justified in a field of
            #       size abbrMod.ABBR_L ]
            outFile.write ( "%-*s%-*s\n" %
                (abbrMod.ABBR_L, self.abbr, abbrMod.ABBR_L, otherCode) )