entities.py 文件源码

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

项目:piqueserver 作者: piqueserver 项目源码 文件源码
def get_progress(self, set=False):
        """
        Return progress (between 0 and 1 - 0 is full blue control,
        1 is full green control) and optionally set the current
        progress.
        """
        # TODO: wtf is this thing, and why are we setting values in
        # a getter. Should this be refactored into two functions
        # called `update_progress` and `get_progress` instead?
        rate = self.rate_value
        if rate == 0.0 or self.start is None:
            return self.progress
        dt = reactor.seconds() - self.start
        progress = max(0, min(1, self.progress + rate * dt))
        if set:
            self.progress = progress
        return progress
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号