#NEWLINE# @ classmethod #NEWLINE# def _fetch_task_executor( cls , options ) : #NEWLINE# #INDENT# kwargs = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# executor_cls = cls . _default_executor_cls #NEWLINE# desired_executor = options . get ( 'executor' ) #NEWLINE# if isinstance ( desired_executor , six . string_types ) : #NEWLINE# #INDENT# matched_executor_cls = None #NEWLINE# for m in cls . _executor_str_matchers : #NEWLINE# #INDENT# if m . matches ( desired_executor ) : #NEWLINE# #INDENT# matched_executor_cls = m . executor_cls #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# if ( matched_executor_cls is None ) : #NEWLINE# #INDENT# expected = set ( ) #NEWLINE# for m in cls . _executor_str_matchers : #NEWLINE# #INDENT# expected . update ( m . strings ) #NEWLINE# #UNINDENT# raise ValueError ( ( "Unknown executor string '%s' expected one of %s (or mixed case equivalent)" % ( desired_executor , list ( expected ) ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# executor_cls = matched_executor_cls #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( desired_executor is not None ) : #NEWLINE# #INDENT# matched_executor_cls = None #NEWLINE# for m in cls . _executor_cls_matchers : #NEWLINE# #INDENT# if m . matches ( desired_executor ) : #NEWLINE# #INDENT# matched_executor_cls = m . executor_cls #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# if ( matched_executor_cls is None ) : #NEWLINE# #INDENT# expected = set ( ) #NEWLINE# for m in cls . _executor_cls_matchers : #NEWLINE# #INDENT# expected . update ( m . types ) #NEWLINE# #UNINDENT# raise TypeError ( ( "Unknown executor '%s' (%s) expected an instance of %s" % ( desired_executor , type ( desired_executor ) , list ( expected ) ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# executor_cls = matched_executor_cls #NEWLINE# kwargs [ 'executor' ] = desired_executor #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# try : #NEWLINE# #INDENT# for ( k , value_converter ) in executor_cls . constructor_options : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# kwargs [ k ] = value_converter ( options [ k ] ) #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# return executor_cls ( ** kwargs )