fix: added assertion error message

This commit is contained in:
2026-05-26 11:54:17 +08:00
parent d047f8513a
commit f06c3dba0f
2 changed files with 4 additions and 4 deletions

View File

@@ -24,7 +24,7 @@ class ActionFlow:
def do(self, action: type[Action]):
name = action.__name__
index = self.indices.get(name)
assert index is not None
assert index is not None, "Action '%s' is not registered" % name
if self.on[index]: raise Unavailable(name)
if self.on[index] is None: raise NotAllowed(name)
@@ -40,7 +40,7 @@ class ActionFlow:
def index(self, action: type[Action]) -> int:
name = action.__name__
index = self.indices.get(name)
assert index is not None
assert index is not None, "Action '%s' is not registered" % name
return index
def allow(self, action: type[Action], value=True):

View File

@@ -14,9 +14,9 @@ class Timer:
self.checkpoint = seconds
def pause(self):
assert self.checkpoint is not None
assert self.checkpoint is not None, "Uninitialized"
self.accumulator = self.delta()
def delta(self):
assert self.checkpoint is not None
assert self.checkpoint is not None, "Uninitialized"
return floor(time()) - self.checkpoint + self.accumulator