Commit cf79c7b2 authored by Vincent Pelletier's avatar Vincent Pelletier

Disable rescaling when maximum period is exceeded.

parent 29955e09
...@@ -1220,6 +1220,7 @@ def main(): ...@@ -1220,6 +1220,7 @@ def main():
next_period_data = ((x, y[4] * AUTO_PERIOD_COEF) for (x, y) in next_period_data = ((x, y[4] * AUTO_PERIOD_COEF) for (x, y) in
sorted(period_parser.iteritems(), key=lambda x: x[1][4])).next sorted(period_parser.iteritems(), key=lambda x: x[1][4])).next
period, to_next_period = next_period_data() period, to_next_period = next_period_data()
original_period = period
earliest_date = latest_date = None earliest_date = latest_date = None
def getNextPeriod(): def getNextPeriod():
# datetime is slow (compared to string operations), but not many choices # datetime is slow (compared to string operations), but not many choices
...@@ -1351,13 +1352,14 @@ def main(): ...@@ -1351,13 +1352,14 @@ def main():
if hit_date < earliest_date or earliest_date is None: if hit_date < earliest_date or earliest_date is None:
earliest_date = hit_date earliest_date = hit_date
next_period = getNextPeriod() next_period = getNextPeriod()
if latest_date > next_period: try:
try: while latest_date > next_period:
while latest_date > next_period: period, to_next_period = next_period_data()
period, to_next_period = next_period_data() next_period = getNextPeriod()
next_period = getNextPeriod() except StopIteration:
except StopIteration: to_next_period = None
pass if original_period != period:
original_period = period
if show_progress: if show_progress:
print >> sys.stderr, 'Increasing period to', period, '...', print >> sys.stderr, 'Increasing period to', period, '...',
old_date_format = date_format old_date_format = date_format
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment