Wrapping the entire thing in parentheses forces python to treat it as a single expression:
(graph.builder()
.push(root)
.push(n1)
.arc(arcType) #root-arc-n1 error is there
.push(n2)
)
I might be tempted to rework your builder method to allow:
graph.builder(lambda g: g
.push(root)
.push(n1)
.arc(arcType) #root-arc-n1 error is there
.push(n2)
)
Just to make the location of parentheses more sensible