Holidays: added cmp() for Python3

This commit is contained in:
Doug Blank 2015-10-05 20:20:11 -04:00
parent 03773fe9a2
commit a6de1c81bc
2 changed files with 7 additions and 1 deletions

View File

@ -404,7 +404,7 @@
<date name="Ash Wednesday" value="> easter(y)" type="religious" offset="-46" />
<date name="Mardi Gras" value="> easter(y)" type="religious" offset="-47" />
<date name="Daylight Saving begins" value="> dst(y)[0]" type="informational" />
<date name="Income Taxes due" value="*/4/15" type="national" if="date.weekday().__cmp__(4)-1" />
<date name="Income Taxes due" value="*/4/15" type="national" if="cmp(date.weekday(),4)-1"/>
<date name="Income Taxes due" value="*/4/16" type="national" if="date.weekday() == 0" />
<date name="Income Taxes due" value="*/4/17" type="national" if="date.weekday() == 0" />
<date name="Daylight Saving ends" value="> dst(y)[1]" type="informational" />

View File

@ -138,6 +138,12 @@ def dow(y, m, d):
""" Return the ISO day of week for the given year, month and day. """
return datetime.date(y, m, d).isoweekday()
def cmp(a, b):
"""
Replacement for older Python's cmp.
"""
return (a > b) - (a < b)
#------------------------------------------------------------------------
#
# HolidayTable