selection.py 文件源码

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

项目:rdiff-backup 作者: sol1 项目源码 文件源码
def filelist_read(self, filelist_fp, include, filelist_name):
        """Read filelist from fp, return (tuplelist, something_excluded)"""
        prefix_warnings = [0]
        def incr_warnings(exc):
            """Warn if prefix is incorrect"""
            prefix_warnings[0] += 1
            if prefix_warnings[0] < 6:
                log.Log("Warning: file specification '%s' in filelist %s\n"
                        "doesn't start with correct prefix %s.  Ignoring." %
                        (exc, filelist_name, self.prefix), 2)
                if prefix_warnings[0] == 5:
                    log.Log("Future prefix errors will not be logged.", 2)

        something_excluded, tuple_list = None, []
        separator = Globals.null_separator and "\0" or "\n"
        for line in filelist_fp.read().split(separator):
            if not line: continue # skip blanks
            try: tuple = self.filelist_parse_line(line, include)
            except FilePrefixError, exc:
                incr_warnings(exc)
                continue
            tuple_list.append(tuple)
            if not tuple[1]: something_excluded = 1
        if filelist_fp.close():
            log.Log("Error closing filelist %s" % filelist_name, 2)
        return (tuple_list, something_excluded)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号