qn.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:qn 作者: mbfraga 项目源码 文件源码
def add_file(self, filepath, misc_prop=None):
        """Add a file to the file repo.

        Keyword arguments:
        filepath -- path to file
        misc_props -- string to add as a 'misc' property to file
        """
        if not path.isfile(filepath):
            print(filepath + " is not a file.")
            exit(1)

        fp_rel = filepath[self.__path_len:]

        try:
            filestat = stat(filepath)
        except:
            return

        file_props = {}
        file_props['size'] = filestat[ST_SIZE]
        file_props['adate'] = filestat[ST_ATIME]
        file_props['mdate'] = filestat[ST_MTIME]
        file_props['cdate'] = filestat[ST_CTIME]
        file_props['name'] = fp_rel
        file_props['fullpath'] = filepath
        file_props['misc'] = misc_prop

        self.__file_list.append(file_props)
        self.__filecount += 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号