示例#1
0
文件: dump.py 项目: 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)
示例#2
0
文件: dump.py 项目: 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)
示例#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)