MCPcopy Create free account
hub / github.com/TechifyBots/File-Stream-Bot / setInterval

Class setInterval

utils_bot.py:11–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9SIZE_UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']
10
11class setInterval:
12 def __init__(self, interval, action):
13 self.interval = interval
14 self.action = action
15 self.stopEvent = threading.Event()
16 thread = threading.Thread(target=self.__setInterval)
17 thread.start()
18
19 def __setInterval(self):
20 nextTime = time.time() + self.interval
21 while not self.stopEvent.wait(nextTime - time.time()):
22 nextTime += self.interval
23 self.action()
24
25 def cancel(self):
26 self.stopEvent.set()
27
28
29def get_readable_file_size(size_in_bytes) -> str:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected