stop_conditions.py 文件源码

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

项目:coretools 作者: iotile 项目源码 文件源码
def FromString(cls, desc):
        """Parse this stop condition from a string representation.

        The string needs to match:
        run_time number [seconds|minutes|hours|days|months|years]

        Args:
            desc (str): The description

        Returns:
            TimeBasedStopCondition
        """

        parse_exp = Literal(u'run_time').suppress() + time_interval(u'interval')

        try:
            data = parse_exp.parseString(desc)
            return TimeBasedStopCondition(data[u'interval'][0])
        except ParseException:
            raise ArgumentError(u"Could not parse time based stop condition")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号