projects
/
python-bulletml.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Action: Don't need the owner in the constructor. Factory function to create a child.
[python-bulletml.git]
/
bulletml
/
bulletyaml.py
diff --git
a/bulletml/bulletyaml.py
b/bulletml/bulletyaml.py
index
ea45436
..
2503c9d
100644
(file)
--- a/
bulletml/bulletyaml.py
+++ b/
bulletml/bulletyaml.py
@@
-13,7
+13,7
@@
Example BulletYAML document:
!BulletML
type: vertical
actions:
!BulletML
type: vertical
actions:
-
top:
!ActionDef
+
-
!ActionDef
actions:
- !FireDef
bullet: !BulletDef {}
actions:
- !FireDef
bullet: !BulletDef {}
@@
-33,13
+33,16
@@
def register(Loader=None, Dumper=None):
parser.BulletML]:
def add(cls, loader, dumper):
parser.BulletML]:
def add(cls, loader, dumper):
+ """Register a class in a new variable scope."""
tag = "!" + cls.__name__
if loader:
def construct(loader, node):
tag = "!" + cls.__name__
if loader:
def construct(loader, node):
+ """Construct an object."""
return loader.construct_yaml_object(node, cls)
loader.add_constructor(tag, construct)
if dumper:
def represent(dumper, obj):
return loader.construct_yaml_object(node, cls)
loader.add_constructor(tag, construct)
if dumper:
def represent(dumper, obj):
+ """Represent an object."""
return dumper.represent_yaml_object(tag, obj, cls)
dumper.add_representer(cls, represent)
return dumper.represent_yaml_object(tag, obj, cls)
dumper.add_representer(cls, represent)