def __init__(self, period_in='', holiday=None, years=0, months=0, days=0, businessdays=0):
        """
        class managing date periods like days, weeks, years etc.

        :param period_in:
        :param holiday:
        :param years:
        :param months:
        :param days:
        :param businessdays:

        representation of a time BusinessPeriod, similar to dateutils.relativedelta, but with additional business day logic
        """

        super(BusinessPeriod, self).__init__()
        if isinstance(period_in, BusinessPeriod):
            years = period_in.years
            months = period_in.months
            days = period_in.days
            businessdays = period_in.businessdays
        elif isinstance(period_in, timedelta):
            days += timedelta.days
        elif isinstance(period_in, (list, tuple)):
            if len(period_in) == 2:
                y, m, d = BusinessDate.diff(period_in[0], period_in[1])
                years += y
                months += m
                days += d
        elif isinstance(period_in, (str, unicode)):
            period_in = str(period_in)
            if period_in.startswith('-'):
                p = BusinessPeriod(period_in[1:])
                years -= p.years
                months -= p.months
                days -= p.days
                businessdays -= p.businessdays
            elif period_in.upper() == 'ON':
                businessdays += 1
            elif period_in.upper() == 'TN':
                businessdays += 2
            elif period_in.upper() == 'DD':
                businessdays += 3
            elif period_in.upper().find('B') > 0:
                businessdays += int(period_in.upper().split('B', 2)[0])
            else:
                y, m, d = BusinessPeriod.parse(period_in)
                years += y
                months += m
                days += d
        if holiday is None:
            self.holiday = DEFAULT_HOLIDAYS
        else:
            self.holiday = holiday
        self.years = years
        self.months = months
        self.days = days
        self.businessdays = businessdays
def __init__ ( self , period_in = '' , holiday = None , years = 0 , months = 0 , days = 0 , businessdays = 0 ) : super ( BusinessPeriod , self ) . __init__ ( ) if isinstance ( period_in , BusinessPeriod ) : years = period_in . years months = period_in . months days = period_in . days businessdays = period_in . businessdays elif isinstance ( period_in , timedelta ) : days += timedelta . days elif isinstance ( period_in , ( list , tuple ) ) : if len ( period_in ) == 2 : y , m , d = BusinessDate . diff ( period_in [ 0 ] , period_in [ 1 ] ) years += y months += m days += d elif isinstance ( period_in , ( str , unicode ) ) : period_in = str ( period_in ) if period_in . startswith ( '-' ) : p = BusinessPeriod ( period_in [ 1 : ] ) years -= p . years months -= p . months days -= p . days businessdays -= p . businessdays elif period_in . upper ( ) == 'ON' : businessdays += 1 elif period_in . upper ( ) == 'TN' : businessdays += 2 elif period_in . upper ( ) == 'DD' : businessdays += 3 elif period_in . upper ( ) . find ( 'B' ) > 0 : businessdays += int ( period_in . upper ( ) . split ( 'B' , 2 ) [ 0 ] ) else : y , m , d = BusinessPeriod . parse ( period_in ) years += y months += m days += d if holiday is None : self . holiday = DEFAULT_HOLIDAYS else : self . holiday = holiday self . years = years self . months = months self . days = days self . businessdays = businessdays
class managing date periods like days, weeks, years etc.

        :param period_in:
        :param holiday:
        :param years:
        :param months:
        :param days:
        :param businessdays:

        representation of a time BusinessPeriod, similar to dateutils.relativedelta, but with additional business day logic