本文整理汇总了Python中iegen.parser.PresParser.parse_relation方法的典型用法代码示例。如果您正苦于以下问题:Python PresParser.parse_relation方法的具体用法?Python PresParser.parse_relation怎么用?Python PresParser.parse_relation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。
在下文中一共展示了PresParser.parse_relation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from iegen.parser import PresParser [as 别名]
# 或者: from iegen.parser.PresParser import parse_relation [as 别名]
def __init__(self, relation_string=None, symbolics=None, relations=None):
symbolics = [] if symbolics is None else symbolics
if None is not relation_string and None is relations:
# Ensure we are given Symbolic objects
raise_objs_not_like_types(
symbolics,
Symbolic,
"Set construction failure: symbolics must be a collect of objects that look like a Symbolic",
)
self.relations = [PresParser.parse_relation(relation_string, symbolics)]
elif None is not relations and None is relation_string:
if len(symbolics) > 0:
raise ValueError("Cannot specify symbolics when specifying a collection of relations.")
if len(relations) > 0:
self.relations = relations
else:
raise ValueError("Must specify at least one relation in the relations collection")
else:
raise ValueError("Relation.__init__ takes either a relation string or a collection of relations.")