python类dump()的实例源码

pstats.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def dump_stats(self, filename):
        """Write the profile data to a file we know how to load back."""
        f = file(filename, 'wb')
        try:
            marshal.dump(self.stats, f)
        finally:
            f.close()

    # list the tuple indices and directions for sorting,
    # along with some printable description
pycodegen.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def dump(self, f):
        f.write(self.getPycHeader())
        marshal.dump(self.code, f)
cProfile.py 文件源码 项目:hostapd-mana 作者: adde88 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def dump_stats(self, file):
        import marshal
        f = open(file, 'wb')
        self.create_stats()
        marshal.dump(self.stats, f)
        f.close()
PatternMgr.py 文件源码 项目:loving-ai 作者: opencog 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def dump(self):
        """Print all learned patterns, for debugging purposes."""
        pprint.pprint(self._root)
PatternMgr.py 文件源码 项目:loving-ai 作者: opencog 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def save(self, filename):
        """Dump the current patterns to the file specified by filename.  To
        restore later, use restore().

        """
        try:
            outFile = open(filename, "wb")
            marshal.dump(self._templateCount, outFile)
            marshal.dump(self._botName, outFile)
            marshal.dump(self._root, outFile)
            outFile.close()
        except Exception, e:
            logger.error("Error saving PatternMgr to file %s:" % filename)
            raise Exception, e
bccache.py 文件源码 项目:Sci-Finder 作者: snverse 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def marshal_dump(code, f):
        if isinstance(f, file):
            marshal.dump(code, f)
        else:
            f.write(marshal.dumps(code))
bccache.py 文件源码 项目:Sci-Finder 作者: snverse 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def write_bytecode(self, f):
        """Dump the bytecode into the file or file like object passed."""
        if self.code is None:
            raise TypeError('can\'t write empty bucket')
        f.write(bc_magic)
        pickle.dump(self.checksum, f, 2)
        marshal_dump(self.code, f)
bccache.py 文件源码 项目:Sci-Finder 作者: snverse 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def marshal_dump(code, f):
        if isinstance(f, file):
            marshal.dump(code, f)
        else:
            f.write(marshal.dumps(code))
bccache.py 文件源码 项目:Sci-Finder 作者: snverse 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def write_bytecode(self, f):
        """Dump the bytecode into the file or file like object passed."""
        if self.code is None:
            raise TypeError('can\'t write empty bucket')
        f.write(bc_magic)
        pickle.dump(self.checksum, f, 2)
        marshal_dump(self.code, f)
xmltodict.py 文件源码 项目:plexivity 作者: mutschler 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def handle_item(path, item):
        marshal.dump((path, item), sys.stdout)
        return True
bccache.py 文件源码 项目:Texty 作者: sarthfrey 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def marshal_dump(code, f):
        if isinstance(f, file):
            marshal.dump(code, f)
        else:
            f.write(marshal.dumps(code))
bccache.py 文件源码 项目:Texty 作者: sarthfrey 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def write_bytecode(self, f):
        """Dump the bytecode into the file or file like object passed."""
        if self.code is None:
            raise TypeError('can\'t write empty bucket')
        f.write(bc_magic)
        pickle.dump(self.checksum, f, 2)
        marshal_dump(self.code, f)
xmltodict.py 文件源码 项目:warriorframework 作者: warriorframework 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def handle_item(path, item):
        marshal.dump((path, item), stdout)
        return True
syntax.py 文件源码 项目:jtc 作者: jwilk-archive 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def compile_pyc(self, output_file):
        '''[py] Compile the program into a Python bytecode file.'''
        import imp
        import marshal
        output_file.write(imp.get_magic())
        output_file.write('\x00\x00\x00\x00')
        pyc = self.to_pyc()
        pyo = pyc.to_code()
        marshal.dump(pyo, output_file)
bccache.py 文件源码 项目:RPoint 作者: george17-meet 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def marshal_dump(code, f):
        if isinstance(f, file):
            marshal.dump(code, f)
        else:
            f.write(marshal.dumps(code))
bccache.py 文件源码 项目:RPoint 作者: george17-meet 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def write_bytecode(self, f):
        """Dump the bytecode into the file or file like object passed."""
        if self.code is None:
            raise TypeError('can\'t write empty bucket')
        f.write(bc_magic)
        pickle.dump(self.checksum, f, 2)
        marshal_dump(self.code, f)
bccache.py 文件源码 项目:isni-reconcile 作者: cmh2166 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def marshal_dump(code, f):
        if isinstance(f, file):
            marshal.dump(code, f)
        else:
            f.write(marshal.dumps(code))
bccache.py 文件源码 项目:isni-reconcile 作者: cmh2166 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def write_bytecode(self, f):
        """Dump the bytecode into the file or file like object passed."""
        if self.code is None:
            raise TypeError('can\'t write empty bucket')
        f.write(bc_magic)
        pickle.dump(self.checksum, f, 2)
        marshal_dump(self.code, f)
bccache.py 文件源码 项目:flasky 作者: RoseOu 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def marshal_dump(code, f):
        if isinstance(f, file):
            marshal.dump(code, f)
        else:
            f.write(marshal.dumps(code))
bccache.py 文件源码 项目:flasky 作者: RoseOu 项目源码 文件源码 阅读 37 收藏 0 点赞 0 评论 0
def write_bytecode(self, f):
        """Dump the bytecode into the file or file like object passed."""
        if self.code is None:
            raise TypeError('can\'t write empty bucket')
        f.write(bc_magic)
        pickle.dump(self.checksum, f, 2)
        marshal_dump(self.code, f)


问题


面经


文章

微信
公众号

扫码关注公众号