From: Joe Wreschnig Date: Sat, 20 Mar 2010 07:00:11 +0000 (-0700) Subject: Better variable name, self -> doc. X-Git-Url: https://git.yukkurigames.com/?p=python-bulletml.git;a=commitdiff_plain;h=0153a3d87b036f4afaf78e3815a2ad981def4993 Better variable name, self -> doc. --- diff --git a/bulletml/parser.py b/bulletml/parser.py index 9b2fbf8..e9b0488 100644 --- a/bulletml/parser.py +++ b/bulletml/parser.py @@ -710,41 +710,41 @@ class BulletML(object): tree = ElementTree() root = tree.parse(source) - self = cls(type=root.get("type", "none")) + doc = cls(type=root.get("type", "none")) - self._bullets = {} - self._actions = {} - self._fires = {} - self._bullet_refs = [] - self._action_refs = [] - self._fire_refs = [] + doc._bullets = {} + doc._actions = {} + doc._fires = {} + doc._bullet_refs = [] + doc._action_refs = [] + doc._fire_refs = [] for element in root.getchildren(): tag = realtag(element) - if tag in self.CONSTRUCTORS: - self.CONSTRUCTORS[tag].FromXML(self, element) + if tag in doc.CONSTRUCTORS: + doc.CONSTRUCTORS[tag].FromXML(doc, element) try: - for ref in self._bullet_refs: - ref.bullet = self._bullets[ref.bullet] - for ref in self._fire_refs: - ref.fire = self._fires[ref.fire] - for ref in self._action_refs: - ref.action = self._actions[ref.action] + for ref in doc._bullet_refs: + ref.bullet = doc._bullets[ref.bullet] + for ref in doc._fire_refs: + ref.fire = doc._fires[ref.fire] + for ref in doc._action_refs: + ref.action = doc._actions[ref.action] except KeyError as exc: raise ParseError("unknown reference %s" % exc) - self.actions = [act for name, act in self._actions.items() + doc.actions = [act for name, act in doc._actions.items() if name and name.startswith("top")] - del(self._bullet_refs) - del(self._action_refs) - del(self._fire_refs) - del(self._bullets) - del(self._actions) - del(self._fires) + del(doc._bullet_refs) + del(doc._action_refs) + del(doc._fire_refs) + del(doc._bullets) + del(doc._actions) + del(doc._fires) - return self + return doc @classmethod def FromYAML(cls, source):