'Set some `file_*\' attributes from stat mode.'

def _classify_from_stat(self, lidb):

    from stat import S_ISREG, S_ISDIR, S_ISLNK, S_ISFIFO, S_ISSOCK, S_ISBLK, S_ISCHR, S_IMODE, S_IFMT
    stat = self._accessor.stat
    st_mode = stat.st_mode
    self.file_type = S_IFMT(st_mode)
    self.file_mode = S_IMODE(st_mode)
    self.file_stat = stat
    if S_ISREG(st_mode):
        self.file_type_name = 'regular    file'
    elif S_ISDIR(st_mode):
        self.file_type_name = 'directory'
    elif S_ISLNK(st_mode):
        self.file_type_name = 'symbolic    link'
    elif S_ISFIFO(st_mode):
        self.file_type_name = 'fifo'
    elif S_ISSOCK(st_mode):
        self.file_type_name = 'socket'
    elif S_ISBLK(st_mode):
        self.file_type_name = 'block    special'
    elif S_ISCHR(st_mode):
        self.file_type_name = 'character    special'
