competitions.py 文件源码

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

项目:goreviewpartner 作者: pnprog 项目源码 文件源码
def resolve_pathname(self, pathname):
        """Resolve a pathname relative to the competition's base directory.

        Accepts None, returning it.

        Applies os.expanduser to the pathname.

        Doesn't absolutise or normalise the resulting pathname.

        Raises ValueError if it can't handle the pathname.

        """
        if pathname is None:
            return None
        if pathname == "":
            raise ValueError("empty pathname")
        try:
            pathname = os.path.expanduser(pathname)
        except Exception:
            raise ValueError("bad pathname")
        try:
            return os.path.join(self.base_directory, pathname)
        except Exception:
            raise ValueError(
                "relative path supplied but base directory isn't set")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号