Remove python dependency on numpy

This commit is contained in:
Travis Burtrum 2019-01-28 00:41:30 -05:00
parent ff9618d1d7
commit e3ce2b5568
1 changed files with 17 additions and 1 deletions

View File

@ -19,13 +19,29 @@
@author Phil
"""
from numpy import std
import re
import SocketServer
import socket
import ssl
import time
# statistics functions modified from https://stackoverflow.com/questions/15389768/standard-deviation-of-a-list/27758326#27758326
def mean(data):
"""Return the sample arithmetic mean of data."""
n = len(data)
if n < 1:
raise ValueError('mean requires at least one data point')
return sum(data)/float(n) # in Python 3 use sum(data)/n
def std(data):
"""Calculates the population standard deviation."""
n = len(data)
c = mean(data)
ss = sum((x-c)**2 for x in data)
pvar = ss/float(n)
return pvar**0.5
class MoguiServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
"""HTTP server to detect curl | bash"""