models.py 文件源码

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

项目:env-diff 作者: jacebrowning 项目源码 文件源码
def from_code(cls, *lines, index=0):
        line = lines[index].strip()

        match = (cls.RE_ENV_SET.match(line) or
                 cls.RE_QUOTED_CAPITALS.search(line))
        if not match:
            log.debug("Skipped line %s without variable: %r", index + 1, line)
            return None

        name = match.group('name')
        context = line
        with suppress(IndexError):
            if context.endswith('{'):
                context += lines[index + 1].strip()
                context += lines[index + 2].strip()

        variable = cls(name, context=context)
        log.info("Loaded variable: %s", variable)

        return variable
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号