X-Git-Url: https://git.yukkurigames.com/?p=python-bulletml.git;a=blobdiff_plain;f=bulletml%2Fbulletyaml.py;h=40949bb0ae393d21c4c7b27673be35e6c82de45f;hp=ea45436d2e47482a199d110168a80c57d90ee3d4;hb=70d25195d561d8b5d3126c6bbac0ecad2a502f06;hpb=29b24c8fc17a3bdcccd1ac853eee5b90c6fd0856 diff --git a/bulletml/bulletyaml.py b/bulletml/bulletyaml.py index ea45436..40949bb 100644 --- a/bulletml/bulletyaml.py +++ b/bulletml/bulletyaml.py @@ -33,13 +33,16 @@ def register(Loader=None, Dumper=None): parser.BulletML]: def add(cls, loader, dumper): + """Register a class in a new variable scope.""" 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): + """Represent an object.""" return dumper.represent_yaml_object(tag, obj, cls) dumper.add_representer(cls, represent)