# HG changeset patch # User Mads Kiilerich # Date 2020-02-04 02:58:53 # Node ID 7d5dfe117d0f36d241423128c4bbb6e5333034db # Parent 8114623895ccc54ba428472900077395d1f0200b summary: use calendar.monthrange instead of internal calendar.mday Fix pytype warning: No attribute 'mdays' on module 'calendar' [module-attr] This also takes care of handling leap-years correctly. Not that it matters, but very nice ... diff --git a/kallithea/controllers/summary.py b/kallithea/controllers/summary.py --- a/kallithea/controllers/summary.py +++ b/kallithea/controllers/summary.py @@ -172,7 +172,7 @@ class SummaryController(BaseRepoControll c.no_data_msg = _('Statistics are disabled for this repository') td = date.today() + timedelta(days=1) - td_1m = td - timedelta(days=calendar.mdays[td.month]) + td_1m = td - timedelta(days=calendar.monthrange(td.year, td.month)[1]) td_1y = td - timedelta(days=365) ts_min_m = mktime(td_1m.timetuple())