debversion.py 文件源码

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

项目:gopythongo 作者: gopythongo 项目源码 文件源码
def _compare(self, other: 'DebianVersion', method: Callable[[int], bool]) -> bool:
        if not isinstance(other, DebianVersion):
            return NotImplemented

        # special case: zero Epoch is the same as no Epoch
        if self.epoch is not None and other.epoch is not None and \
           int(self.epoch) != int(other.epoch) and int(self.epoch) != 0 and int(other.epoch) != 0:
            return method(int(self.epoch) - int(other.epoch))

        res = debian_versionpart_compare(split_version_parts(self.version, self.version_char_re),
                                         split_version_parts(other.version, self.version_char_re))
        if res == 0:
            return method(debian_versionpart_compare(split_version_parts(self.revision),
                                                     split_version_parts(other.revision)))
        else:
            return method(res)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号