示例#1
0
文件: files.py 项目: victorliun/nifty
class DastFile(ObjectFile):
    def __init__(self, filename, mode = 'r', cls = File, flush = 0, emptylines = 0, **dastArgs):
        super(DastFile, self).__init__(filename, cls, flush, emptylines, mode = mode)
        self.dast = DAST(**dastArgs)

    def _write(self, item):
        self.dast.dump(item, self.file, newline = True)
        
    def _read(self):
        return self.dast.decode(self.file.file)
示例#2
0
    def __init__(self,
                 filename,
                 mode='r',
                 cls=File,
                 flush=0,
                 emptylines=0,
                 **dastArgs):
        super(DastFile, self).__init__(filename,
                                       cls,
                                       flush,
                                       emptylines,
                                       mode=mode)

        from nifty.data.dast import DAST
        self.dast = DAST(**dastArgs)
示例#3
0
class DastFile(ObjectFile):
    def __init__(self,
                 filename,
                 mode='r',
                 cls=File,
                 flush=0,
                 emptylines=0,
                 **dastArgs):
        super(DastFile, self).__init__(filename,
                                       cls,
                                       flush,
                                       emptylines,
                                       mode=mode)

        from nifty.data.dast import DAST
        self.dast = DAST(**dastArgs)

    def _write(self, item):
        self.dast.dump(item, self.file, newline=True)

    def _read(self):
        return self.dast.decode(self.file.file)
示例#4
0
文件: files.py 项目: victorliun/nifty
 def __init__(self, filename, mode = 'r', cls = File, flush = 0, emptylines = 0, **dastArgs):
     super(DastFile, self).__init__(filename, cls, flush, emptylines, mode = mode)
     self.dast = DAST(**dastArgs)