Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhelpful error message when mechanism does not have return signature #288

Closed
jds3d opened this issue Jul 28, 2021 · 0 comments
Closed

Unhelpful error message when mechanism does not have return signature #288

jds3d opened this issue Jul 28, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@jds3d
Copy link

jds3d commented Jul 28, 2021

In the case where a mechanism like:

def account_for_tax(params, step, sL, s, inputs):
key = 'GRT'
delegation_tokens_quantity = inputs['delegation_tokens_quantity']
delegation_tax_rate = params['delegation_tax_rate']

tax = delegation_tax_rate * delegation_tokens_quantity
value = s['GRT'] - tax
**return key, value**

does not have the bold part (return key, value), you get the following error message:

c:\Users\Josh\anaconda3\envs\py396\lib\site-packages\cadCAD\engine\simulation.py in state_update_pipeline(self, sweep_dict, simulation_list, configs, env_processes, time_step, run, additional_objs)
172 sub_step += 1
173 for [s_conf, p_conf] in configs:
--> 174 states_list: List[Dict[str, Any]] = self.partial_state_update(
175 sweep_dict, sub_step, states_list, simulation_list, s_conf, p_conf, env_processes, time_step, run,
176 additional_objs
c:\Users\Josh\anaconda3\envs\py396\lib\site-packages\cadCAD\engine\simulation.py in partial_state_update(self, sweep_dict, sub_step, sL, sH, state_funcs, policy_funcs, env_processes, time_step, run, additional_objs)
138 return destination
139
--> 140 last_in_copy: Dict[str, Any] = transfer_missing_fields(last_in_obj, dict(generate_record(state_funcs)))
141 last_in_copy: Dict[str, Any] = self.apply_env_proc(sweep_dict, env_processes, last_in_copy)
142 last_in_copy['substep'], last_in_copy['timestep'], last_in_copy['run'] = sub_step, time_step, run
TypeError: cannot convert dictionary update sequence element #1 to a sequence

It would be more helpful to say which mechanism had the issue and what the issue was.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants