repository.py 文件源码

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

项目:knowledge-repo 作者: airbnb 项目源码 文件源码
def _kp_path(self, path, rel='/'):
        if path is None:
            return None
        path = os.path.relpath(os.path.abspath(os.path.join(rel, path)), rel)
        if os.name == 'nt':
            path = path.replace(os.path.sep, os.path.altsep)
        assert all([not segment.endswith('.kp') for segment in path.split(
            '/')[:-1]]), "The post path may not contain a directory named '*.kp'."
        if path == '.' or path.startswith('..'):
            raise ValueError("Provided path '{}' is outside of the knowledge repository.".format(path))
        if not path.endswith('.kp'):
            path += '.kp'
        return path
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号