[Zope3-checkins] SVN: Zope3/trunk/utilities/importchecker.py Removed trailing whitespace, added an extra newline between top level

Gintautas Miliauskas gintas at pov.lt
Fri Nov 5 06:06:27 EST 2004


Log message for revision 28342:
  Removed trailing whitespace, added an extra newline between top level
  definitions.  (Other than that, the code looks really tidy.)
  

Changed:
  U   Zope3/trunk/utilities/importchecker.py

-=-
Modified: Zope3/trunk/utilities/importchecker.py
===================================================================
--- Zope3/trunk/utilities/importchecker.py	2004-11-04 23:15:33 UTC (rev 28341)
+++ Zope3/trunk/utilities/importchecker.py	2004-11-05 11:06:26 UTC (rev 28342)
@@ -19,10 +19,12 @@
 
 $Id$
 """
+
 import compiler
 import os, os.path
 import sys
 
+
 def _findDottedNamesHelper(node, result):
     more_node = node
     name = node.__class__.__name__
@@ -43,10 +45,11 @@
         result.append(node.name)
         return
     elif name == 'AssAttr':
-        return 
+        return
     for child in more_node.getChildNodes():
         _findDottedNamesHelper(child, result)
 
+
 def findDottedNames(node):
     """Find dotted names in an AST tree node
     """
@@ -54,6 +57,7 @@
     _findDottedNamesHelper(node, result)
     return result
 
+
 class ImportFinder:
     """An instance of this class will be used to walk over a compiler AST
     tree (a module). During that operation, the appropriate methods of
@@ -97,6 +101,7 @@
     def getMap(self):
         return self._map
 
+
 def findImports(mod):
     """Find import statements in module and put the result in a mapping.
     """
@@ -104,6 +109,7 @@
     compiler.walk(mod, visitor)
     return visitor.getMap()
 
+
 class Module:
     """This represents a python module.
     """
@@ -114,7 +120,7 @@
         self._map = findImports(mod)
         dottednames = {}
         self._dottednames = findDottedNames(mod)
-           
+
     def getPath(self):
         """Return the path to this module's file.
         """
@@ -150,12 +156,13 @@
                 if usedname not in self._dottednames:
                     result.append((originalname, value['lineno']))
         return result
-    
+
+
 class ModuleFinder:
 
     def __init__(self):
         self._files = []
-        
+
     def visit(self, arg, dirname, names):
         """This method will be called when we walk the filesystem
         tree. It looks for python modules and stored their filenames.
@@ -168,6 +175,7 @@
     def getModuleFilenames(self):
         return self._files
 
+
 def findModules(path):
     """Find python modules in the given path and return their absolute
     filenames in a sequence.
@@ -176,6 +184,7 @@
     os.path.walk(path, finder.visit, ())
     return finder.getModuleFilenames()
 
+
 class ImportDatabase:
     """This database keeps tracks of imports.
 
@@ -187,7 +196,7 @@
         self._root_path = root_path
         self._modules = {}
         self._names = {}
-        
+
     def resolveDottedModuleName(self, dotted_name, module):
         """Return path to file representing module, or None if no such
         thing. Can do this relative from module.
@@ -243,7 +252,7 @@
             if not modulepaths.has_key(self_path):
                 modulepaths[self_path] = 1
             names[t] = modulepaths
-        
+
     def getUnusedImports(self):
         """Get unused imports of all known modules.
         """
@@ -274,6 +283,7 @@
             result.append(self._modules[path])
         return result
 
+
 def main():
     try:
         path = sys.argv[1]



More information about the Zope3-Checkins mailing list