This method derives the one-letter file type code:
- for a regular file,
d for a directory, or
l for a link. Because it is a private
method of the class, its name starts with two
__) so it is not
visible to code that imports this class.
# - - - P a t h I n f o . _ _ f i l e T y p e - - - def __fileType ( self ): """Return the file type code. [ if self is a regular file -> return "-" if self is a directory -> return "d" if self is a soft link -> return "l" ] """
Just as a defensive programming measure, we return
"?" if for some reason the path
is neither a file, a directory, or a soft link. This can
happen for Unix device files, but those are beyond the
intended audience of the
if self.isLink(): return "l" elif self.isDir(): return "d" elif self.isFile(): return "-" else: return "?"