plint

French poetry validator
git clone https://a3nm.net/git/plint/
Log | Files | Refs | README

commit 2fa70c1682b46faa34cca297f9b6e5a8cbe936c5
parent 52465e08e71806bc1ea7f7bcc935eb5b11439d58
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Tue,  2 Aug 2011 13:17:43 -0400

correctly reset environment in back

Diffstat:
template.py | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/template.py b/template.py @@ -1,6 +1,7 @@ import error from metric import parse from hemistiches import check_hemistiches +import copy import rhyme from common import normalize @@ -153,8 +154,8 @@ class Template: def get(self): """Get next state, resetting if needed""" self.old_position = self.position - self.old_env = dict(self.env) - self.old_femenv = dict(self.femenv) + self.old_env = copy.deepcopy(self.env) + self.old_femenv = copy.deepcopy(self.femenv) if self.position >= len(self.template): self.reset_state() result = self.template[self.position] @@ -164,8 +165,8 @@ class Template: def back(self): """Revert to previous state""" self.position = self.old_position - self.env = dict(self.old_env) - self.femenv = dict(self.old_femenv) + self.env = copy.deepcopy(self.old_env) + self.femenv = copy.deepcopy(self.old_femenv) def check(self, line): """Check line (wrapper)"""