当前位置: 首页>>代码示例>>Python>>正文


Python Object.readLibrary方法代码示例

本文整理汇总了Python中Object.Object.readLibrary方法的典型用法代码示例。如果您正苦于以下问题:Python Object.readLibrary方法的具体用法?Python Object.readLibrary怎么用?Python Object.readLibrary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Object.Object的用法示例。


在下文中一共展示了Object.readLibrary方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: parse

# 需要导入模块: from Object import Object [as 别名]
# 或者: from Object.Object import readLibrary [as 别名]
def parse(fl):
    Object.folder = ""
    Object.model = False
    Relation.model = False
    model = None
    # open and then read the file
    err_str = ""
    war_str = ""
    list_obj = []
    list_rel = []
    with open(fl) as f:
        # with object_pairs_hook method, we can check "Error 07" at the same level
        target = json.loads(f.read())
    if "library" in target.keys():
        lib = ""
        folders = fl.split("/")
        for i in range(0, len(folders) - 1):
            lib += folders[i] + "/"
        lib += target["library"]
        # To handle all the errors and warnings in "library" json file
        valstr = Object.readLibrary(lib)
        err_str += valstr[0]
        war_str += valstr[1]
        list_obj = valstr[2]
        list_rel = valstr[3]
    # To handle all the errors and warnings in "root" json file
    rootobj = []
    rootrel = []
    valstr2 = val_root(fl, target, True, list_obj, list_rel, rootobj, rootrel)
    err_str += valstr2[0]
    war_str += valstr2[1]
    if err_str:
        print err_str
    else:
        Object.model = True
        Relation.model = True
        model = Object(fl.split(".")[0], target)
        Object.flatten(rootobj, rootrel)
    if war_str:
        print war_str
    # TO return the constructed model
    return model
开发者ID:GiorgosPa,项目名称:Rauzy-language,代码行数:44,代码来源:Rauzy.py


注:本文中的Object.Object.readLibrary方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。