Strip trailing whitespace from all files.
[depgraph.git] / depgraph2dot.py
index 01d36c77d98e9939e07f5f632f08641d71d01373..5edd590f35b0f72af95478ed9b7ac7fbab43e543 100755 (executable)
@@ -92,7 +92,7 @@ class hooks (object) :
                                      mod_name, type, path) == False:
                 return False # don't draw nodes we wouldn't visit
         return True
-    def follow_edge_test(self, module_name, type, path, 
+    def follow_edge_test(self, module_name, type, path,
                          dname, dtype, dpath):
         LOG.debug('testing edge from %s %s %s to %s %s %s'
                   % (module_name, type, path, dname, dtype, dpath))
@@ -112,7 +112,7 @@ class hooks (object) :
         elif self._link_outside_visited_nodes == False \
                 and self._invisible_path(dpath) == True :
             LOG.debug('invisible module path %s' % dpath)
-            return False # don't draw edges to invisible path modules            
+            return False # don't draw edges to invisible path modules
         #elif dtype == imp.PKG_DIRECTORY:
         #    # don't draw edges to packages.
         #    LOG.debug('package')
@@ -183,14 +183,14 @@ class dotformat (object) :
 
     def _fix_name(self, mod_name):
         # Convert a module name to a syntactically correct node name
-        return mod_name.replace('.','_')    
+        return mod_name.replace('.','_')
     def _label(self,s):
         # Convert a module name to a formatted node label.
         return '\\.\\n'.join(s.split('.'))
     def _weight(self, mod_name, target_name):
         # Return the weight of the dependency from a to b. Higher weights
         # usually have shorter straighter edges. Return 1 if it has normal weight.
-        # A value of 4 is usually good for ensuring that a related pair of modules 
+        # A value of 4 is usually good for ensuring that a related pair of modules
         # are drawn next to each other.
         #
         if target_name.split('.')[-1].startswith('_'):
@@ -231,7 +231,7 @@ class dotformat (object) :
         vf = float(ord(n[3]))/0xff
         r,g,b = colorsys.hsv_to_rgb(hf, 0.3+0.6*sf, 0.8+0.2*vf)
         return '#%02x%02x%02x' % (r*256,g*256,b*256)
-    
+
     # abstract out most of the dot language for head and edge declarations
     def _dot_node(self, name, attrs) :
         string = '  %s' % self._fix_name(name)
@@ -333,7 +333,7 @@ class pydepgraphdot (object) :
 
         if root_module != None :
             self.add_module_target(root_module)
-            
+
         depgraph,type,paths = self.fill_missing_deps(depgraph, types, paths)
 
         f = self.get_output_file()
@@ -365,7 +365,7 @@ class pydepgraphdot (object) :
                 if self._hooks.follow_edge_test(mod, type, path,
                                                 d, types[d], paths[d]) :
                     LOG.debug('follow to %s' % d)
-                    #print "%s, %s, %s, %s, %s, %s, %s" % (mod, deps, type, path, d, types[d], paths[d]) 
+                    #print "%s, %s, %s, %s, %s, %s, %s" % (mod, deps, type, path, d, types[d], paths[d])
                     f.write(self._dotformat.edge(mod, deps, type, path,
                                                  d, types[d], paths[d]))
                     self.add_module_target(d)
@@ -387,7 +387,7 @@ class pydepgraphdot (object) :
                 if not depgraph.has_key(dep):
                     # if dep not listed in depgraph somehow...
                     # add it in, with no further dependencies
-                    depgraph[dep] = {}        
+                    depgraph[dep] = {}
                     # add dummies to types and paths too, if neccessary
                    if not dep in types :
                         types[dep] = None
@@ -415,7 +415,7 @@ class pydepgraphdot (object) :
         else :
             return None # no more modules! we're done.
 
-            
+
 if __name__=='__main__':
     from optparse import OptionParser
 
@@ -433,7 +433,7 @@ if __name__=='__main__':
     _STREAM_HANDLER.setLevel(log_level)
 
     # Fancyness with shared hooks instance so we can do slick thinks like
-    # printing all modules just inside an invisible zone, since we'll need 
+    # printing all modules just inside an invisible zone, since we'll need
     # the dotformatter to know which nodes are visible.
     hk = hooks(link_outside_visited_nodes=False)
     dt = dotformat_Cext(colored=options.color, hooks_instance=hk)