Best Python code snippet using yandex-tank
window_stat.py
Source:window_stat.py
1import numpy as np2class WindowStat:3 def __init__(self, name, n):4 self.name = name5 self.items = [None] * n6 self.idx = 07 self.count = 08 def push(self, obj):9 self.items[self.idx] = obj10 self.idx += 111 self.count += 112 self.idx %= len(self.items)13 def stats(self):14 if not self.count:15 _quantiles = []16 else:17 _quantiles = np.nanpercentile(self.items[:self.count],18 [0, 10, 50, 90, 100]).tolist()19 return {20 self.name + "_count": int(self.count),21 self.name + "_mean": float(np.nanmean(self.items[:self.count])),22 self.name + "_std": float(np.nanstd(self.items[:self.count])),23 self.name + "_quantiles": _quantiles,...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!