本文整理汇总了Python中edge.Edge._get_edges_with_src方法的典型用法代码示例。如果您正苦于以下问题:Python Edge._get_edges_with_src方法的具体用法?Python Edge._get_edges_with_src怎么用?Python Edge._get_edges_with_src使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edge.Edge
的用法示例。
在下文中一共展示了Edge._get_edges_with_src方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_link_details
# 需要导入模块: from edge import Edge [as 别名]
# 或者: from edge.Edge import _get_edges_with_src [as 别名]
def _get_link_details(entity, link_name):
""""Lookup the (edge_class, left_edge_id, right_edge_id, node_class)
for the given entity and link_name.
param entity: The current entity Node subclass
:param str link_name: The association proxy name
edge_class: The Edge subclass the association is proxied through
left_edge_id: The edge.{src,dst}_id
right_edge_id: The edge.{dst,src}_id (opposit of left_edge_id)
node_class: The target node the association_proxy points to
"""
# Look for the link_name in OUTBOUND edges from the current
# entity
for edge in Edge._get_edges_with_src(entity.__name__):
if edge.__src_dst_assoc__ == link_name:
return (edge, edge.src_id, edge.dst_id,
Node.get_subclass_named(edge.__dst_class__))
# Look for the link_name in INBOUND edges from the current
# entity
for edge in Edge._get_edges_with_dst(entity.__name__):
if edge.__dst_src_assoc__ == link_name:
return (edge, edge.dst_id, edge.src_id,
Node.get_subclass_named(edge.__src_class__))
raise AttributeError(
"type object '{}' has no attribute '{}'"
.format(entity.__name__, link_name))