Accel: Better call return data.
[python-bulletml.git] / bulletml / parser.py
index 10459cc..8bea044 100644 (file)
@@ -52,7 +52,7 @@ class Direction(object):
         self.value = NumberDef(element.text)
 
     def __call__(self, params, rank):
-        return self.value(params, rank)
+        return (self.value(params, rank), self.type)
 
     def __repr__(self):
         return "%s(%r, type=%r)" % (
@@ -88,11 +88,10 @@ class Speed(object):
         self.value = NumberDef(element.text)
 
     def __call__(self, params, rank):
-        return self.value(params, rank)
+        return (self.value(params, rank), self.type)
 
     def __repr__(self):
-        return "%s(%r, type=%r)" % (
-            type(self).__name__, self.value, self.type)
+        return "%s(%r, type=%r)" % (type(self).__name__, self.value, self.type)
 
 class ChangeSpeed(object):
     """Speed change over time."""
@@ -213,13 +212,11 @@ class BulletDef(object):
     def __call__(self, params, rank):
         actions = []
         for action in self.actions:
-            try:
-                actions.append((action.params(params), action.action))
-            except AttributeError:
-                actions.append((params, action))
-        return (self.direction and self.direction(params, rank),
-                self.speed and self.speed(params, rank),
-                actions)
+            actions.append(action(params, rank))
+        return (
+            self.direction and self.direction(params, rank),
+            self.speed and self.speed(params, rank),
+            actions)
 
     def __repr__(self):
         return "%s(direction=%r, speed=%r, actions=%r)" % (