lol im a fuckin dork

This commit is contained in:
codl 2017-08-09 09:14:57 +02:00
parent 6539d3b39f
commit 0296f05d8a
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
1 changed files with 12 additions and 2 deletions

View File

@ -1,12 +1,22 @@
from datetime import timedelta from datetime import timedelta
from statistics import mean
SCALES = [ SCALES = [
('minutes', timedelta(minutes=1)), ('minutes', timedelta(minutes=1)),
('hours', timedelta(hours=1)), ('hours', timedelta(hours=1)),
('days', timedelta(days=1)), ('days', timedelta(days=1)),
('weeks', timedelta(days=7)), ('weeks', timedelta(days=7)),
('months', timedelta(days=30)), ('months', timedelta(days=
('years', timedelta(days=365)), # you, a fool: a month is 30 days
# me, wise:
mean((31,
mean((29 if year % 400 == 0
or year % 100 != 0 and year % 4 == 0
else 28
for year in range(400)))
,31,30,31,30,31,31,30,31,30,31))
)),
('years', timedelta(days=365.25)),
] ]
def decompose_interval(attrname): def decompose_interval(attrname):