Example #1
0
File: dump.py Project: Lorquas/func
 def dumpData(self, data):
     anchor = self.anchors.shouldAnchor(data)
     # Disabling anchors because they are lame for strings that the user might want to view/edit -- mdehaan
     # 
     #if anchor: 
     #    self.output(" &%d" % anchor )
     #else:
     #    anchor = self.anchors.isAlias(data)
     #    if anchor:
     #        self.output(" *%d" % anchor )
     #        return
     if (data is None):
         self.output(' ~')
     elif hasMethod(data, 'to_yaml'):
         self.dumpTransformedObject(data)            
     elif hasMethod(data, 'to_yaml_implicit'):
         self.output(" " + data.to_yaml_implicit())
     elif type(data) is InstanceType:
         self.dumpRawObject(data)
     elif isDictionary(data):
         self.dumpDict(data)
     elif type(data) in [ListType, TupleType]:
         self.dumpList(data)
     else:
         self.dumpScalar(data)
Example #2
0
File: dump.py Project: scibian/func
 def dumpData(self, data):
     anchor = self.anchors.shouldAnchor(data)
     # Disabling anchors because they are lame for strings that the user might want to view/edit -- mdehaan
     #
     #if anchor:
     #    self.output(" &%d" % anchor )
     #else:
     #    anchor = self.anchors.isAlias(data)
     #    if anchor:
     #        self.output(" *%d" % anchor )
     #        return
     if (data is None):
         self.output(' ~')
     elif hasMethod(data, 'to_yaml'):
         self.dumpTransformedObject(data)
     elif hasMethod(data, 'to_yaml_implicit'):
         self.output(" " + data.to_yaml_implicit())
     elif type(data) is InstanceType:
         self.dumpRawObject(data)
     elif isDictionary(data):
         self.dumpDict(data)
     elif type(data) in [ListType, TupleType]:
         self.dumpList(data)
     else:
         self.dumpScalar(data)
Example #3
0
 def dumpData(self, data):
     anchor = self.anchors.shouldAnchor(data)
     if anchor: 
         self.output(" &%d" % anchor )
     else:
         anchor = self.anchors.isAlias(data)
         if anchor:
             self.output(" *%d" % anchor )
             return
     if (data is None):
         self.output(' ~')
     elif hasMethod(data, 'to_yaml'):
         self.dumpTransformedObject(data)            
     elif hasMethod(data, 'to_yaml_implicit'):
         self.output(" " + data.to_yaml_implicit())
     elif type(data) is InstanceType:
         self.dumpRawObject(data)
     elif isDictionary(data):
         self.dumpDict(data)
     elif type(data) in [ListType, TupleType]:
         self.dumpList(data)
     else:
         self.dumpScalar(data)