Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __setitem__(self, key, par):
"""TODO: add magic method docstring."""
if key not in self:
if not valid_symbol_name(key):
raise KeyError("'%s' is not a valid Parameters name" % key)
if par is not None and not isinstance(par, Parameter):
raise ValueError("'%s' is not a Parameter" % par)
OrderedDict.__setitem__(self, key, par)
par.name = key
par._expr_eval = self._asteval
self._asteval.symtable[key] = par.value