code.py 文件源码

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

项目:mongodb-monitoring 作者: jruaux 项目源码 文件源码
def __new__(cls, code, scope=None, **kwargs):
        if not isinstance(code, string_type):
            raise TypeError("code must be an "
                            "instance of %s" % (string_type.__name__))

        self = str.__new__(cls, code)

        try:
            self.__scope = code.scope
        except AttributeError:
            self.__scope = {}

        if scope is not None:
            if not isinstance(scope, collections.Mapping):
                raise TypeError("scope must be an instance of dict")
            self.__scope.update(scope)

        self.__scope.update(kwargs)

        return self
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号