whatstyle.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:whatstyle 作者: mikr 项目源码 文件源码
def reformat(self, sourcefile, destfile, configfile):
        # type: (str, str, str) -> None
        """Reformats sourcefile according to configfile and writes it to destfile.
        This method is only used for testing.
        """
        tmpdir = tempfile.mkdtemp(prefix='whatstyle_')
        cfg = os.path.join(tmpdir, self.configfilename)
        copyfile(configfile, cfg)
        tmpfilename = os.path.join(tmpdir, os.path.basename(sourcefile))
        copyfile(sourcefile, tmpfilename)
        cmdargs = [tmpfilename]
        exeresult = run_executable(self.exe, cmdargs)
        writebinary(destfile, exeresult.stdout)
        os.remove(tmpfilename)
        os.remove(cfg)
        os.rmdir(tmpdir)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号