#NEWLINE# def __setstate__( self , d ) : #NEWLINE# #INDENT# if ( 'restore_design_info' in d ) : #NEWLINE# #INDENT# from patsy import dmatrices , PatsyError #NEWLINE# exc = [ ] #NEWLINE# try : #NEWLINE# #INDENT# data = design [ 'frame' ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# data = d [ 'orig_endog' ] . join ( d [ 'orig_exog' ] ) #NEWLINE# #UNINDENT# for depth in [ 2 , 3 , 1 , 0 , 4 ] : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ( _ , design ) = dmatrices ( d [ 'formula' ] , data , eval_env = depth , return_type = 'dataframe' ) #NEWLINE# break #NEWLINE# #UNINDENT# except ( NameError , PatsyError ) as e : #NEWLINE# #INDENT# print ( ( 'not in depth %d' % depth ) ) #NEWLINE# exc . append ( e ) #NEWLINE# pass #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# raise exc [ ( - 1 ) ] #NEWLINE# #UNINDENT# self . design_info = design . design_info #NEWLINE# del d [ 'restore_design_info' ] #NEWLINE# #UNINDENT# self . __dict__ . update ( d )