compat.py 文件源码

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

项目:asyncpg 作者: MagicStack 项目源码 文件源码
def fspath(path):
        fsp = getattr(path, '__fspath__', None)
        if fsp is not None and callable(fsp):
            path = fsp()
            if not isinstance(path, (str, bytes)):
                raise TypeError(
                    'expected {}() to return str or bytes, not {}'.format(
                        fsp.__qualname__, type(path).__name__
                    ))
            return path
        elif isinstance(path, (str, bytes)):
            return path
        else:
            raise TypeError(
                'expected str, bytes or path-like object, not {}'.format(
                    type(path).__name__
                )
            )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号