#NEWLINE# def _current_end_date( self , reference_date = None , ignore_trial = None , granulate = None ) : #NEWLINE# #INDENT# ignore_trial_default = False #NEWLINE# granulate_default = False #NEWLINE# ignore_trial = ( ignore_trial_default or ignore_trial ) #NEWLINE# granulate = ( granulate_default or granulate ) #NEWLINE# if ( reference_date is None ) : #NEWLINE# #INDENT# reference_date = timezone . now ( ) . date ( ) #NEWLINE# #UNINDENT# end_date = None #NEWLINE# _current_start_date = self . _current_start_date ( reference_date , ignore_trial , granulate ) #NEWLINE# if ( not _current_start_date ) : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# bymonth = bymonthday = byweekday = None #NEWLINE# count = 1 #NEWLINE# interval_count = 1 #NEWLINE# if ( ( self . plan . interval == self . plan . INTERVALS . MONTH ) and ( _current_start_date . day != 1 ) ) : #NEWLINE# #INDENT# bymonthday = 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( self . plan . interval == self . plan . INTERVALS . WEEK ) and ( _current_start_date . weekday ( ) != 0 ) ) : #NEWLINE# #INDENT# byweekday = 0 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( self . plan . interval == self . plan . INTERVALS . YEAR ) and ( _current_start_date . month != 1 ) and ( _current_start_date . day != 1 ) ) : #NEWLINE# #INDENT# bymonth = 1 #NEWLINE# bymonthday = 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# count = 2 #NEWLINE# if ( not granulate ) : #NEWLINE# #INDENT# interval_count = self . plan . interval_count #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# fake_end_date = ( list ( rrule . rrule ( self . _INTERVALS_CODES [ self . plan . interval ] , interval = interval_count , count = count , bymonth = bymonth , bymonthday = bymonthday , byweekday = byweekday , dtstart = _current_start_date ) ) [ ( - 1 ) ] . date ( ) - datetime . timedelta ( days = 1 ) ) #NEWLINE# if ( self . trial_end and ( not ignore_trial ) ) : #NEWLINE# #INDENT# if ( fake_end_date and ( fake_end_date > self . trial_end >= reference_date ) ) : #NEWLINE# #INDENT# fake_end_date = self . trial_end #NEWLINE# #UNINDENT# #UNINDENT# if fake_end_date : #NEWLINE# #INDENT# if self . ended_at : #NEWLINE# #INDENT# if ( self . ended_at < fake_end_date ) : #NEWLINE# #INDENT# end_date = self . ended_at #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# end_date = fake_end_date #NEWLINE# #UNINDENT# return end_date #NEWLINE# #UNINDENT# return ( self . ended_at or None )