mirror of
https://github.com/nicolargo/glances.git
synced 2025-01-03 07:03:40 +03:00
Unconditionally use statistics module since we support Python 3.4+ now
This commit is contained in:
parent
7e70b36f91
commit
d137d3bd26
@ -31,16 +31,10 @@ from glances.logger import logger
|
||||
|
||||
PY3 = sys.version_info[0] == 3
|
||||
|
||||
try:
|
||||
from statistics import mean
|
||||
except ImportError:
|
||||
# Statistics is only available for Python 3.4 or higher
|
||||
def mean(numbers):
|
||||
return float(sum(numbers)) / max(len(numbers), 1)
|
||||
|
||||
if PY3:
|
||||
import queue
|
||||
from configparser import ConfigParser, NoOptionError, NoSectionError
|
||||
from statistics import mean
|
||||
from xmlrpc.client import Fault, ProtocolError, ServerProxy, Transport, Server
|
||||
from xmlrpc.server import SimpleXMLRPCRequestHandler, SimpleXMLRPCServer
|
||||
from urllib.request import urlopen
|
||||
@ -130,6 +124,9 @@ else:
|
||||
viewvalues = operator.methodcaller('viewvalues')
|
||||
viewitems = operator.methodcaller('viewitems')
|
||||
|
||||
def mean(numbers):
|
||||
return float(sum(numbers)) / max(len(numbers), 1)
|
||||
|
||||
def to_ascii(s):
|
||||
"""Convert the unicode 's' to a ASCII string
|
||||
Usefull to remove accent (diacritics)"""
|
||||
|
Loading…
Reference in New Issue
Block a user