Better variable name, self -> doc.
authorJoe Wreschnig <joe.wreschnig@gmail.com>
Sat, 20 Mar 2010 07:00:11 +0000 (00:00 -0700)
committerJoe Wreschnig <joe.wreschnig@gmail.com>
Sat, 20 Mar 2010 07:00:11 +0000 (00:00 -0700)
bulletml/parser.py

index 9b2fbf8577a94d6796b0b7f209dd291e4e34b4fc..e9b0488c5aa75f570a5867a42b48d036e38ec8b8 100644 (file)
@@ -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):