#NEWLINE# def sunrise( self , when = None ) : #NEWLINE# #INDENT# '\n        return the time of sunrise as a datetime.time object\n        when is a datetime.datetime object. If none is given\n        a local time zone is assumed (including daylight saving\n        if present)\n        ' #NEWLINE# if ( when is None ) : #NEWLINE# #INDENT# when = datetime . now ( tz = LocalTimezone ( ) ) #NEWLINE# #UNINDENT# self . __preptime ( when ) #NEWLINE# self . __calc ( ) #NEWLINE# t = Sun . __timefromdecimalday ( self . sunrise_t ) #NEWLINE# return when . replace ( hour = self . hour , minute = t . minute , second = t . second )