for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
"""Statistic package
.. Authors:
Philippe Dessauw
[email protected]
.. Sponsor:
Alden Dima
Information Systems Group
Software and Systems Division
Information Technology Laboratory
National Institute of Standards and Technology
http://www.nist.gov/itl/ssd/is
"""
from __future__ import division
import logging
class Statistics(object):
"""Statistics of one text file
def __init__(self, stat_names):
if type(stat_names) != list:
raise TypeError
self.stats = {}
for name in stat_names:
self.stats[name] = None
logging.debug("Statistics initialized")
def set_stat(self, name, value):
"""Add a new stat to the model
if name not in self.stats:
raise KeyError("Key '"+name+"' does not exists")
self.stats[name] = value
def get_stat(self, name):
"""Return a statistic value
Returns:
float: Value of the stat
return self.stats[name]
def __str__(self):
return str(self.stats)