This method breaks up the input line into fields and passes
them to Section 13.6, “BaseSpeciesSet.addSpecies(): Add a new
species line” to be
added to self.
# - - - M a p s 2 0 0 4 S p e c i e s S e t . r e a d L i n e - - -
def readLine(self, scan):
'''Process one line of the authority file.
'''
See Section 6, “scanFieldList(): A utility routine
for flat-file scanning”.
#-- 1 --
# [ if line in scan starts with the fields represented
# by self.FIELD_LIST ->
# scan := scan advanced past those fields
# fieldSet := a tuple of the fields in that order
# else ->
# Log() +:= error message(s)
# raise IOError ]
fieldSet = scanFieldList(scan, self.FIELD_LIST)
It is critical that the next line lists the destination
variables in the same order as in self.FIELD_LIST.
#-- 2 --
(ssn, eno, spNo, spec4, bblSpec, eng, fillers, genus,
species, spec6) = fieldSet
Now that we have all the fields necessary, we create a new
Species object and pass it to self.addSpecies. The .rstrip()
method removes trailing whitespace from the English name.
#-- 3 --
species = Species(spNo, spec4, spec6, eng.rstrip())
See Section 13.6, “BaseSpeciesSet.addSpecies(): Add a new
species line”.
#-- 4 --
# [ if (species.spec4 duplicates a key in self.spec4Map,
# case-insensitive) or
# (species.eng duplicates a key in self.engMap) ->
# Log() +:= error message(s)
# raise IOError
# else ->
# self.spec4Map := an entry mapping species.spec4.upper()
# |-> species
# self.spec6Map := an entry mapping species.spec6.upper()
# |-> species
# self.engMap := an entry mapping species.eng |-> species ]
self.addSpecies(species)