def model_reaction_limits(model):
for reaction in sorted(model.reactions, key=lambda r: r.id):<EOL><INDENT>equation = reaction.properties.get('<STR_LIT>')<EOL>if equation is None:<EOL><INDENT>continue<EOL><DEDENT>lower_default, upper_default = None, None<EOL>if model.default_flux_limit is not None:<EOL><INDENT>if equation.direction.reverse:<EOL><INDENT>lower_default = -model.default_flux_limit<EOL><DEDENT>else:<EOL><INDENT>lower_default = <NUM_LIT:0.0><EOL><DEDENT>if equation.direction.forward:<EOL><INDENT>upper_default = model.default_flux_limit<EOL><DEDENT>else:<EOL><INDENT>upper_default = <NUM_LIT:0.0><EOL><DEDENT><DEDENT>lower_flux, upper_flux = None, None<EOL>if reaction.id in model.limits:<EOL><INDENT>_, lower, upper = model.limits[reaction.id]<EOL>lower_flux = _get_output_limit(lower, lower_default)<EOL>upper_flux = _get_output_limit(upper, upper_default)<EOL><DEDENT>if lower_flux is not None or upper_flux is not None:<EOL><INDENT>d = OrderedDict([('<STR_LIT>', reaction.id)])<EOL>d.update(_generate_limit_items(lower_flux, upper_flux))<EOL>yield d<EOL><DEDENT><DEDENT>
Yield model reaction limits as YAML dicts.