#NEWLINE# def _bind_function( self , func , owner ) : #NEWLINE# #INDENT# 'convenience method for binding a function to an owner' #NEWLINE# if ( owner is None ) : #NEWLINE# #INDENT# return func #NEWLINE# #UNINDENT# if isinstance ( func , types . FunctionType ) : #NEWLINE# #INDENT# if ( func . __code__ . co_argcount == 0 ) : #NEWLINE# #INDENT# return staticmethod ( func ) . __get__ ( None , owner ) #NEWLINE# #UNINDENT# if ( func . __code__ . co_argcount == 1 ) : #NEWLINE# #INDENT# return classmethod ( func ) . __get__ ( None , owner ) #NEWLINE# #UNINDENT# raise Exception ( "Node functions aren't expected to have parameters" ) #NEWLINE# #UNINDENT# if isinstance ( func , ( classmethod , staticmethod , MDFCallable ) ) : #NEWLINE# #INDENT# return func . __get__ ( None , owner ) #NEWLINE# #UNINDENT# if isinstance ( func , ( types . MethodType , MDFIteratorFactory , types . BuiltinFunctionType , MethodWrapperType ) ) : #NEWLINE# #INDENT# return func #NEWLINE# #UNINDENT# if ( isinstance ( owner , types . TypeType ) and issubclass ( func , MDFIterator ) ) : #NEWLINE# #INDENT# return MDFIteratorFactory ( func , owner ) #NEWLINE# #UNINDENT# raise Exception ( ( 'MDFEvalNode._bind_function called with unexpected type %s' % type ( func ) ) )