#NEWLINE# def easter( year , method = EASTER_WESTERN ) : #NEWLINE# #INDENT# '\n    This method was ported from the work done by GM Arts,\n    on top of the algorithm by Claus Tondering, which was\n    based in part on the algorithm of Ouding (1940), as\n    quoted in "Explanatory Supplement to the Astronomical\n    Almanac", P.  Kenneth Seidelmann, editor.\n\n    This algorithm implements three different easter\n    calculation methods:\n    \n    1 - Original calculation in Julian calendar, valid in\n        dates after 326 AD\n    2 - Original method, with date converted to Gregorian\n        calendar, valid in years 1583 to 4099\n    3 - Revised method, in Gregorian calendar, valid in\n        years 1583 to 4099 as well\n\n    These methods are represented by the constants:\n\n    EASTER_JULIAN   = 1\n    EASTER_ORTHODOX = 2\n    EASTER_WESTERN  = 3\n\n    The default method is method 3.\n    \n    More about the algorithm may be found at:\n\n    http://users.chariot.net.au/~gmarts/eastalg.htm\n\n    and\n\n    http://www.tondering.dk/claus/calendar.html\n\n    ' #NEWLINE# if ( not ( 1 <= method <= 3 ) ) : #NEWLINE# #INDENT# raise ValueError ( 'invalid method' ) #NEWLINE# #UNINDENT# y = year #NEWLINE# g = ( y % 19 ) #NEWLINE# e = 0 #NEWLINE# if ( method < 3 ) : #NEWLINE# #INDENT# i = ( ( ( 19 * g ) + 15 ) % 30 ) #NEWLINE# j = ( ( ( y + ( y // 4 ) ) + i ) % 7 ) #NEWLINE# if ( method == 2 ) : #NEWLINE# #INDENT# e = 10 #NEWLINE# if ( y > 1600 ) : #NEWLINE# #INDENT# e = ( ( ( e + ( y // 100 ) ) - 16 ) - ( ( ( y // 100 ) - 16 ) // 4 ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# c = ( y // 100 ) #NEWLINE# h = ( ( ( ( ( c - ( c // 4 ) ) - ( ( ( 8 * c ) + 13 ) // 25 ) ) + ( 19 * g ) ) + 15 ) % 30 ) #NEWLINE# i = ( h - ( ( h // 28 ) * ( 1 - ( ( ( h // 28 ) * ( 29 // ( h + 1 ) ) ) * ( ( 21 - g ) // 11 ) ) ) ) ) #NEWLINE# j = ( ( ( ( ( ( y + ( y // 4 ) ) + i ) + 2 ) - c ) + ( c // 4 ) ) % 7 ) #NEWLINE# #UNINDENT# p = ( ( i - j ) + e ) #NEWLINE# d = ( 1 + ( ( ( p + 27 ) + ( ( p + 6 ) // 40 ) ) % 31 ) ) #NEWLINE# m = ( 3 + ( ( p + 26 ) // 30 ) ) #NEWLINE# return datetime . date ( int ( y ) , int ( m ) , int ( d ) )