add doc string

This commit is contained in:
l_samenv
2024-07-12 10:31:34 +02:00
parent d13b49a35f
commit 16b132ecf1

View File

@ -7,6 +7,15 @@ import json
import numpy as np import numpy as np
class PrettyFloat(float): class PrettyFloat(float):
"""saves bandwidth when converting to JSON
a lot of numbers originally have a fixed (low) number of decimal digits
as the binary representation is not exact, it might happen, that a
lot of superfluous digits are transmitted:
str(1/10*3) == '0.30000000000000004'
str(PrettyFloat(1/10*3)) == '0.3'
"""
def __repr__(self): def __repr__(self):
return '%.15g' % self return '%.15g' % self
@ -24,6 +33,7 @@ class Scanner(object):
self.test_day = test_day self.test_day = test_day
def scan(self, variable, timerange, result): def scan(self, variable, timerange, result):
"""return value is true when there are aditionnal points after the time range"""
start, to, now = get_abs_time(timerange + [0]) start, to, now = get_abs_time(timerange + [0])
old = None old = None
t = 0 t = 0