from bulletml.expr import NumberDef, INumberDef
-__all_ = ["ParseError", "BulletML"]
+__all__ = ["ParseError", "BulletML"]
class ParseError(Error):
"""Raised when an error occurs parsing the XML structure."""
direction = None
speed = None
- def __init__(self, actions=[], direction=None, speed=None, tags=()):
+ def __init__(self, actions=(), direction=None, speed=None, tags=()):
self.direction = direction
self.speed = speed
self.actions = list(actions)
actions = []
speed = None
direction = None
+ tags = set()
for subelem in element.getchildren():
tag = realtag(subelem)
if tag == "direction":
elif tag == "actionRef":
actions.append(ActionRef.FromXML(doc, subelem))
elif tag == "tag":
- self.tags.add(subelem.text)
- dfn = cls(actions, direction, speed)
+ tags.add(subelem.text)
+ dfn = cls(actions, direction, speed, tags)
doc._bullets[element.get("label")] = dfn
return dfn
direction = None
speed = None
offset = None
+ tags = set()
for subelem in element.getchildren():
tag = realtag(subelem)
elif tag == "offset":
offset = Offset.FromXML(doc, subelem)
elif tag == "tag":
- self.tags.add(subelem.text)
+ tags.add(subelem.text)
try:
- fire = cls(bullet, direction, speed, offset)
+ fire = cls(bullet, direction, speed, offset, tags)
except UnboundLocalError as exc:
raise ParseError(str(exc))
else: