This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import cycle | |
from colorama import Fore, Back, Style, init as colorama_init | |
colorama_init() | |
def clear(): | |
from os import system, name | |
if name == 'nt': | |
system('cls') | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from threading import Lock, Thread | |
class PriorityLock: | |
def __init__(self): | |
self._main_lock = Lock() | |
self.priorities = [] | |
def acquire(self, priority): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import time | |
class ExponentialMovingAverage: | |
def __init__(self, timeout, tau) -> None: | |
self.timeout = timeout | |
self.historic = {} | |
assert 0 < tau < 1 | |
self.tau = tau |