The constructor starts by initializing self.__linkList as an empty list.
# - - - L i n k R e p o r t . _ _ i n i t _ _ - - -
def __init__ ( self, dir ):
"""Constructor for the LinkReport class."""
#-- 1 --
self.__linkList = []
The os.path.walk function calls our .__visitor() method once for each directory in
and under dir, passing it a list of the
names in that directory; see Section 9.6, “LinkReport.__visitor(): Visitor
function for os.path.walk()”. The end result is to
add one LinkInfo instance to self.__linkList for each soft link in the tree.
#-- 2 --
# [ dir is a string ->
# self.__linkList := self.__linkList with LinkInfo
# instances added representing every accessible
# soft link in the subtree rooted in dir ]
os.path.walk ( dir, self.__visitor, dir )
All that remains is to sort the links by path name.
#-- 3 --
# [ self.__linkList := self.__linkList, sorted ]
self.__linkList.sort()