Mercurial > personal > weatherlog
comparison weatherlog/reader.py @ 3:d961c8a93d6b
reader: Use floor-division for list index.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Fri, 27 Sep 2019 21:38:23 -0400 |
parents | 9310e2ff7e17 |
children | 885bff085edf |
comparison
equal
deleted
inserted
replaced
2:9310e2ff7e17 | 3:d961c8a93d6b |
---|---|
106 buckets.setdefault(v, []) | 106 buckets.setdefault(v, []) |
107 for bucket, bucket_vals in buckets.items(): | 107 for bucket, bucket_vals in buckets.items(): |
108 if abs(v - bucket) <= epsilon: | 108 if abs(v - bucket) <= epsilon: |
109 bucket_vals.append(v) | 109 bucket_vals.append(v) |
110 if len(bucket_vals) == count: | 110 if len(bucket_vals) == count: |
111 return sorted(bucket_vals)[count / 2] | 111 return sorted(bucket_vals)[count // 2] |
112 raise ValueError('No stable value.') | 112 raise ValueError('No stable value.') |
113 | 113 |
114 | 114 |
115 def _is_reasonable_temp(temp: float) -> bool: | 115 def _is_reasonable_temp(temp: float) -> bool: |
116 """True if the temperature is a reasonable level for the boathouse.""" | 116 """True if the temperature is a reasonable level for the boathouse.""" |