def _exec_inc_variable(self, _, action):
if self.has_variable(action["var_name"]):
if self._variables[action["var_name"]]["lock"] is not None:
with self._variables[action["var_name"]]["lock"]:
self.set_variable(action["var_name"], self.get_variable(action["var_name"]) + 1)
else:
After Change
def _exec_inc_variable(self, _, action):
if self.has_variable(action["var_name"]):
self.variables.lock(action["var_name"])
self.set_variable(action["var_name"], self.get_variable(action["var_name"]) + 1)
self.variables.unlock(action["var_name"])
else:
raise KeyError("No such variable %s exists", action["var_name"])