コード例 #1
0
 def diff_asdefine(asdef: ParameterList,
                   ref_asdef: ParameterList) -> ParameterList:
     diff = ParameterList()
     defs: Dict[str, str] = {}
     for _, pobj in asdef.objects.items():
         defs[str(pobj.params["Name"].v)] = str(pobj.params["Filename"].v)
     for _, ref_pobj in ref_asdef.objects.items():
         try:
             if (defs[str(ref_pobj.params["Name"].v)] == str(
                     ref_pobj.params["Filename"].v)):
                 defs.pop(str(ref_pobj.params["Name"].v))
         except (ValueError, KeyError):
             continue
     for i, (k, v) in enumerate(defs.items()):
         key = f"ASDefine_{i}"
         diff.objects[key] = ParameterObject()
         diff.objects[key].params["Name"] = Parameter(FixedSafeString64(k))
         diff.objects[key].params["Filename"] = Parameter(
             FixedSafeString64(v))
     return diff