本文整理匯總了Python中edge.Edge.trait方法的典型用法代碼示例。如果您正苦於以下問題:Python Edge.trait方法的具體用法?Python Edge.trait怎麽用?Python Edge.trait使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類edge.Edge
的用法示例。
在下文中一共展示了Edge.trait方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _proc_edge_stmt
# 需要導入模塊: from edge import Edge [as 別名]
# 或者: from edge.Edge import trait [as 別名]
def _proc_edge_stmt(self, toks):
""" Returns a tuple of the form (ADD_EDGE, src, dest, options).
"""
opts = toks[3]
dummy_edge = Edge("dummy1", "dummy2")
# Coerce attribute types.
for key, value in opts.iteritems():
trait = dummy_edge.trait(key)
if trait is not None:
# FIXME: Implement Graphviz spline types.
if trait.is_trait_type( List ):
p = [] # List of float doublets.
for t in value.split( " " ):
l = t.split( "," )
if len(l) == 3: # pos="e,39,61 39,97 39,89 39,80 39,71"
l.pop(0)
f = [ float(a) for a in l ]
p.append( tuple(f) )
opts[key] = p
elif trait.is_trait_type( Float ):
opts[key] = float( value )
elif trait.is_trait_type( Tuple ):
opts[key] = tuple( [float(c) for c in value.split(",")] )
return super(GodotDataParser, self)._proc_edge_stmt(toks)