Method: calendar.monthrange
Calls: 221, Exceptions: 3, Paths: 2Back
Path 1: 218 calls (0.99)
2004 (103) 2017 (27) 0 (25) 9999 (15) 1 (14) 2001 (2) 1995 (2) 1987 (2) 1988 (2) 1999 (2)
12 (40) 1 (29) 2 (29) 4 (22) 5 (14) 3 (12) 6 (12) 7 (12) 8 (12) 9 (12)
(0, 31) (30) (2, 31) (29) (3, 31) (21) (6, 31) (16) (5, 31) (16) (4, 31) (14) (3, 30) (13) (2, 30) (12) (6, 29) (11) (0, 30) (10)
1def monthrange(year, month):
2 """Return weekday (0-6 ~ Mon-Sun) and number of days (28-31) for
3 year, month."""
4 if not 1 <= month <= 12:
5 raise IllegalMonthError(month)
6 day1 = weekday(year, month, 1)
7 ndays = mdays[month] + (month == February and isleap(year))
8 return day1, ndays
Path 2: 3 calls (0.01)
2004 (3)
65 (1) 13 (1) 0 (1)
IllegalMonthError (3)
1def monthrange(year, month):
2 """Return weekday (0-6 ~ Mon-Sun) and number of days (28-31) for
3 year, month."""
4 if not 1 <= month <= 12:
5 raise IllegalMonthError(month)
6 day1 = weekday(year, month, 1)
7 ndays = mdays[month] + (month == February and isleap(year))
8 return day1, ndays