Visitor cleanup: mark internal (cdef) methods with leading underscore in .py files
authorStefan Behnel <scoder@users.berlios.de>
Thu, 11 Nov 2010 21:13:47 +0000 (22:13 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Thu, 11 Nov 2010 21:13:47 +0000 (22:13 +0100)
Cython/Compiler/Visitor.pxd
Cython/Compiler/Visitor.py

index d72acc162be52672fd2293bd08c88a786adb35bb..00ddb177909444f1960b2758ba9b7ccc3e329eb7 100644 (file)
@@ -4,11 +4,11 @@ cdef class BasicVisitor:
     cdef dict dispatch_table
     cpdef visit(self, obj)
     cdef _visit(self, obj)
-    cdef find_handler(self, obj)
+    cdef _find_handler(self, obj)
 
 cdef class TreeVisitor(BasicVisitor):
     cdef public list access_path
-    cdef visitchild(self, child, parent, attrname, idx)
+    cdef _visitchild(self, child, parent, attrname, idx)
     @cython.locals(idx=int)
     cdef dict _visitchildren(self, parent, attrs)
     cpdef visitchildren(self, parent, attrs=*)
index 6b89cca94dee4bcd5ae198ee99f93d8e01f0cc1b..545f855b80824399a8727a786d5ba3e31ed48437 100644 (file)
@@ -26,11 +26,11 @@ class BasicVisitor(object):
         try:
             handler_method = self.dispatch_table[type(obj)]
         except KeyError:
-            handler_method = self.find_handler(obj)
+            handler_method = self._find_handler(obj)
             self.dispatch_table[type(obj)] = handler_method
         return handler_method(obj)
 
-    def find_handler(self, obj):
+    def _find_handler(self, obj):
         cls = type(obj)
         #print "Cache miss for class %s in visitor %s" % (
         #    cls.__name__, type(self).__name__)
@@ -176,7 +176,7 @@ class TreeVisitor(BasicVisitor):
             last_node.pos, self.__class__.__name__,
             u'\n'.join(trace), e, stacktrace)
 
-    def visitchild(self, child, parent, attrname, idx):
+    def _visitchild(self, child, parent, attrname, idx):
         self.access_path.append((parent, attrname, idx))
         try:
             result = self._visit(child)
@@ -209,9 +209,9 @@ class TreeVisitor(BasicVisitor):
             child = getattr(parent, attr)
             if child is not None:
                 if type(child) is list:
-                    childretval = [self.visitchild(x, parent, attr, idx) for idx, x in enumerate(child)]
+                    childretval = [self._visitchild(x, parent, attr, idx) for idx, x in enumerate(child)]
                 else:
-                    childretval = self.visitchild(child, parent, attr, None)
+                    childretval = self._visitchild(child, parent, attr, None)
                     assert not isinstance(childretval, list), 'Cannot insert list here: %s in %r' % (attr, parent)
                 result[attr] = childretval
         return result