init.py 文件源码

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

项目:zeus 作者: getsentry 项目源码 文件源码
def init(path, github_client_id, github_client_secret):
    path = os.path.expanduser(path)
    if not os.path.exists(path):
        os.makedirs(path)

    config_path = os.path.join(path, 'zeus.config.py')
    if os.path.exists(config_path):
        click.confirm(
            'Configuration file already present at [{}]. Overwrite it?'.format(
                config_path),
            abort=True
        )

    with open(config_path, 'wb') as fp:
        fp.write(
            CONFIG.format(
                secret_key=repr(binascii.hexlify(os.urandom(24))),
                github_client_id=repr(github_client_id),
                github_client_secret=repr(github_client_secret),
                workspace_root=repr(path),
            ).encode('utf-8')
        )
    click.echo('Configuration written at {}'.format(config_path))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号