def __str__(self):
        """
        Output a string that would generate this RRULE if passed to rrulestr.
        This is mostly compatible with RFC2445, except for the
        dateutil-specific extension BYEASTER.
        """

        output = []
        h, m, s = [None] * 3
        if self._dtstart:
            output.append(self._dtstart.strftime('DTSTART:%Y%m%dT%H%M%S'))
            h, m, s = self._dtstart.timetuple()[3:6]

        parts = ['FREQ=' + FREQNAMES[self._freq]]
        if self._interval != 1:
            parts.append('INTERVAL=' + str(self._interval))

        if self._wkst:
            parts.append('WKST=' + repr(weekday(self._wkst))[0:2])

        if self._count is not None:
            parts.append('COUNT=' + str(self._count))

        if self._until:
            parts.append(self._until.strftime('UNTIL=%Y%m%dT%H%M%S'))

        if self._original_rule.get('byweekday') is not None:
            # The str() method on weekday objects doesn't generate
            # RFC2445-compliant strings, so we should modify that.
            original_rule = dict(self._original_rule)
            wday_strings = []
            for wday in original_rule['byweekday']:
                if wday.n:
                    wday_strings.append('{n:+d}{wday}'.format(
                        n=wday.n,
                        wday=repr(wday)[0:2]))
                else:
                    wday_strings.append(repr(wday))

            original_rule['byweekday'] = wday_strings
        else:
            original_rule = self._original_rule

        partfmt = '{name}={vals}'
        for name, key in [('BYSETPOS', 'bysetpos'),
                          ('BYMONTH', 'bymonth'),
                          ('BYMONTHDAY', 'bymonthday'),
                          ('BYYEARDAY', 'byyearday'),
                          ('BYWEEKNO', 'byweekno'),
                          ('BYDAY', 'byweekday'),
                          ('BYHOUR', 'byhour'),
                          ('BYMINUTE', 'byminute'),
                          ('BYSECOND', 'bysecond'),
                          ('BYEASTER', 'byeaster')]:
            value = original_rule.get(key)
            if value:
                parts.append(partfmt.format(name=name, vals=(','.join(str(v)
                                                                      for v in value))))

        output.append(';'.join(parts))
        return '\n'.join(output)
def __str__ ( self ) : output = [ ] h , m , s = [ None ] * 3 if self . _dtstart : output . append ( self . _dtstart . strftime ( 'DTSTART:%Y%m%dT%H%M%S' ) ) h , m , s = self . _dtstart . timetuple ( ) [ 3 : 6 ] parts = [ 'FREQ=' + FREQNAMES [ self . _freq ] ] if self . _interval != 1 : parts . append ( 'INTERVAL=' + str ( self . _interval ) ) if self . _wkst : parts . append ( 'WKST=' + repr ( weekday ( self . _wkst ) ) [ 0 : 2 ] ) if self . _count is not None : parts . append ( 'COUNT=' + str ( self . _count ) ) if self . _until : parts . append ( self . _until . strftime ( 'UNTIL=%Y%m%dT%H%M%S' ) ) if self . _original_rule . get ( 'byweekday' ) is not None : original_rule = dict ( self . _original_rule ) wday_strings = [ ] for wday in original_rule [ 'byweekday' ] : if wday . n : wday_strings . append ( '{n:+d}{wday}' . format ( n = wday . n , wday = repr ( wday ) [ 0 : 2 ] ) ) else : wday_strings . append ( repr ( wday ) ) original_rule [ 'byweekday' ] = wday_strings else : original_rule = self . _original_rule partfmt = '{name}={vals}' for name , key in [ ( 'BYSETPOS' , 'bysetpos' ) , ( 'BYMONTH' , 'bymonth' ) , ( 'BYMONTHDAY' , 'bymonthday' ) , ( 'BYYEARDAY' , 'byyearday' ) , ( 'BYWEEKNO' , 'byweekno' ) , ( 'BYDAY' , 'byweekday' ) , ( 'BYHOUR' , 'byhour' ) , ( 'BYMINUTE' , 'byminute' ) , ( 'BYSECOND' , 'bysecond' ) , ( 'BYEASTER' , 'byeaster' ) ] : value = original_rule . get ( key ) if value : parts . append ( partfmt . format ( name = name , vals = ( ',' . join ( str ( v ) for v in value ) ) ) ) output . append ( ';' . join ( parts ) ) return '\n' . join ( output )
Output a string that would generate this RRULE if passed to rrulestr.
        This is mostly compatible with RFC2445, except for the
        dateutil-specific extension BYEASTER.