An instance of this class represents the entire system, both the
taxonomic arrangement and all the codes (both valid and
collision codes). Here is the interface. There is not much to
this class; it is mainly a container for a TaxaTree instance (see Section 18, “class TaxaTree: The taxonomic tree”) containing
the taxonomic tree, and an AbTab instance (see
Section 24, “class AbTab: The symbol table for
codes”) containing the bird codes.
# - - - c l a s s T x n y
class Txny(object):
'''Represents a complete bird taxonomy and code system.
Exports:
Txny ( hier, stdFileName, altFileName ):
[ (hier is a Hier instance) and
(stdFileName is a string) and
(altFileName is a string) ->
if standard forms file stdFileName and
alternate forms file altFileName are readable and
valid against each other and (hier) ->
return a new Txny instance representing those files
else ->
Log() +:= error message(s)
raise IOError ]
.hier: [ as passed to constructor, read-only ]
.taxaTree:
[ a TaxaTree instance representing the tree of taxa ]
.abTab:
[ self's symbol table as an AbTab instance ]
.lookupAbbr ( abbr ):
[ abbr is a string ->
if abbr.strip().upper() matches a code in self ->
return an AbSym object describing abbr's definition
else -> raise KeyError ]
.lookupSci ( sci ):
[ sci is a string ->
if sci matches a scientific name in self ->
return the Taxon instance defining that name
else -> raise KeyError ]
'''