#NEWLINE# def get_calendar( self , weekmask , holidays , calendar ) : #NEWLINE# #INDENT# 'Generate busdaycalendar' #NEWLINE# if isinstance ( calendar , np . busdaycalendar ) : #NEWLINE# #INDENT# if ( not holidays ) : #NEWLINE# #INDENT# holidays = tuple ( calendar . holidays ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not isinstance ( holidays , tuple ) ) : #NEWLINE# #INDENT# holidays = tuple ( holidays ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# return ( calendar , holidays ) #NEWLINE# #UNINDENT# if ( holidays is None ) : #NEWLINE# #INDENT# holidays = [ ] #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# holidays = ( holidays + calendar . holidays ( ) . tolist ( ) ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# holidays = [ self . _to_dt64 ( dt , dtype = 'datetime64[D]' ) for dt in holidays ] #NEWLINE# holidays = tuple ( sorted ( holidays ) ) #NEWLINE# kwargs = { #NEWLINE# #INDENT# 'weekmask' : weekmask , #NEWLINE# #UNINDENT# } #NEWLINE# if holidays : #NEWLINE# #INDENT# kwargs [ 'holidays' ] = holidays #NEWLINE# #UNINDENT# busdaycalendar = np . busdaycalendar ( ** kwargs ) #NEWLINE# return ( busdaycalendar , weekmask )