| 9 | SIZE_UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'] |
| 10 | |
| 11 | class 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 | |
| 29 | def get_readable_file_size(size_in_bytes) -> str: |
nothing calls this directly
no outgoing calls
no test coverage detected