YANGtoYIN.py 文件源码

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

项目:frog4-datastore 作者: netgroup-polito 项目源码 文件源码
def _transform_yang_to_dict(yang_model_string):
    class Opts(object):
        def __init__(self, yin_canonical=False, yin_pretty_strings=True):
            self.yin_canonical = yin_canonical
            self.yin_pretty_strings = yin_pretty_strings

    ctx = Context(FileRepository())
    yang_mod = ctx.add_module('yang', yang_model_string, format='yang')

    yin = YINPlugin()
    modules = []
    modules.append(yang_mod)
    ctx.opts = Opts()
    yin_string = StringIO()
    yin.emit(ctx=ctx, modules=modules, fd=yin_string)
    xml = yin_string.getvalue()
    return xmltodict.parse(xml)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号