def will_expire_in_days(self, days: int) -> bool: if run_from_src(): # 使用源码运行不受限制 return False return datetime.now() + timedelta(days=days) > parse_time( self.expire_at)
def is_active(self): if run_from_src(): # 使用源码运行不受限制 return True now = datetime.now() return now <= parse_time(self.expire_at)
def will_expire_in_days(self, days: int, bypass_run_from_src=True) -> bool: from util import parse_time, run_from_src if run_from_src() and bypass_run_from_src: # 使用源码运行不受限制 return False return datetime.now() + timedelta(days=days) > parse_time(self.expire_at)