ver_33.py 文件源码

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

项目:dbf 作者: wenzhihong2003 项目源码 文件源码
def __new__(cls, hour=None, minute=0, second=0, microsecond=0):
        """
        hour may be a datetime.time or a str(Time)
        """
        if hour is None or hour is Null:
            return cls._null_time
        nt = object.__new__(cls)
        if isinstance(hour, basestring):
            hour = Time.strptime(hour)
        if isinstance(hour, Time):
            nt._time = hour._time
        elif isinstance(hour, (datetime.time)):
            microsecond = hour.microsecond // 1000 * 1000
            hour, minute, second = hour.hour, hour.minute, hour.second
            nt._time = datetime.time(hour, minute, second, microsecond)
        elif hour is not None:
            microsecond = microsecond // 1000 * 1000
            nt._time = datetime.time(hour, minute, second, microsecond)
        return nt
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号