Exemplo n.º 1
0
    def __init__(self, obj, unknown_ok):
        super(VerifyUnitsInTree, self).__init__(action_predicates=[SingleVisitPredicate()])
        self.unknown_ok = unknown_ok

        if unknown_ok:
            return


        try:
            self.visit(obj)
        except UnitMismatchError, e:
            print e
            #raise

            def get_str(node):
                if isinstance(node, ast.ASTExpressionObject):
                    return '%s\n%s'%(repr(node), node.get_dimension())
                else:
                    return '%s'%(repr(node))



            all_nodes = list(obj.all_ast_nodes())
            colors = dict([(node,'white') for node in all_nodes])
            labels = dict([(node, get_str(node)) for node in all_nodes])

            if e.objA:
                colors[e.objA] = 'red'
            if e.objB:
                colors[e.objB] = 'red'

            



            from neurounits.visitors.common.plot_networkx import ActionerPlotNetworkX
            ActionerPlotNetworkX(o=obj, labels=labels, colors=colors)
            pylab.show()
            
            
            
            assert False
Exemplo n.º 2
0
 def __init__(self, ):
     ASTActionerDefaultIgnoreMissing.__init__(
         self, action_predicates=[SingleVisitPredicate()])
 def __init__(self):
     self.nodes = defaultdict(set)
     ASTActionerDefault.__init__(self,
                                 action_predicates=[SingleVisitPredicate()])
Exemplo n.º 4
0
 def __init__(self, obj=None):
     self.nodes = defaultdict(set)
     ASTActionerDefault.__init__(self,
                                 action_predicates=[SingleVisitPredicate()])
     if obj is not None:
         self.visit(obj)