history_item.py 文件源码

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

项目:draobpilc 作者: awamper 项目源码 文件源码
def _get_info(self):
        result = ''

        if (
            self.kind != HistoryItemKind.FILE and
            self.kind != HistoryItemKind.IMAGE and
            not self.content_type
        ):
            if self.kind != HistoryItemKind.LINK:
                result = '%i chars, %i lines' % (len(self.raw), self.n_lines)

            return result


        if self.n_lines > 1:
            result += _('%s items') % self.n_lines
        else:
            try:
                size = os.path.getsize(self.raw.strip())
            except FileNotFoundError:
                result += _('No such file or directory')
            else:
                result += humanize.naturalsize(size, gnu=True)

                if self._content_type:
                    result += ', Type: %s' % self._content_type

        return result
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号