def update_inputs(av_states, socket_send, *input_variable_names):
# From each input variable name, extract the function name, ids of AvStates to be passed as arguments,
# and the corresponding function from psaltlib.Inputs. Call the function with the id-key'd AvStates as
# arguments. Aggregate results in order in a list.
input_state = []
for term in input_variable_names:
term_elements = re.split('_', term)
function_name = term_elements[0]
av_id_args = term_elements[1:]
args = []
for av_id in av_id_args:
args.append(av_states[int(av_id)])
args.append(socket_send)
func = [o for o in getmembers(psaltlib.Inputs) if isfunction(o[1]) and
o[0] == function_name]
input_state.append(func[0][1](*args))
return input_state
评论列表
文章目录