+if False: # YAML dump debugging code
+ """To help isolate data types etc. that give YAML problems.
+
+ This is usually caused by external C modules (e.g. numpy) that
+ define new types (e.g. numpy.dtype) which YAML cannot inspect.
+ """
+ import yaml.representer
+ import sys
+ def ignore_aliases(data):
+ print data, type(data)
+ sys.stdout.flush()
+ if data in [None, ()]:
+ return True
+ if isinstance(data, (str, unicode, bool, int, float)):
+ return True
+ yaml.representer.SafeRepresenter.ignore_aliases = staticmethod(
+ ignore_aliases)
+