Commits

Sylvain Thénault  committed a922ade

white spaces cleanup

  • Participants
  • Parent commits dc1a6cb

Comments (0)

Files changed (3)

File checkers/design_analysis.py

-# Copyright (c) 2003-2006 LOGILAB S.A. (Paris, FRANCE).
+# Copyright (c) 2003-2012 LOGILAB S.A. (Paris, FRANCE).
 # http://www.logilab.fr/ -- mailto:contact@logilab.fr
 #
 # This program is free software; you can redistribute it and/or modify it under
     'R0904': ('Too many public methods (%s/%s)',
               'Used when class has too many public methods, try to reduce \
               this to get a more simple (and so easier to use) class.'),
-    
+
     'R0911': ('Too many return statements (%s/%s)',
               'Used when a function or method has too many return statement, \
               making it hard to follow.'),
     'R0915': ('Too many statements (%s/%s)',
               'Used when a function or method has too many statements. You \
               should then split it in smaller functions / methods.'),
-    
+
     'R0921': ('Abstract class not referenced',
               'Used when an abstract class is not used as ancestor anywhere.'),
     'R0922': ('Abstract class is only referenced %s times',
 
 
 class MisdesignChecker(BaseChecker):
-    """checks for sign of poor/misdesign:                                      
-    * number of methods, attributes, local variables...                        
-    * size, complexity of functions, methods                                   
+    """checks for sign of poor/misdesign:
+    * number of methods, attributes, local variables...
+    * size, complexity of functions, methods
     """
-    
+
     __implements__ = (IASTNGChecker,)
 
     # configuration section name
         self._abstracts = None
         self._ifaces = None
         self._stmts = 0
-        
+
     def open(self):
         """initialize visit variables"""
         self.stats = self.linter.add_stats()
         for iface in self._ifaces:
             if not iface in self._used_ifaces:
                 self.add_message('R0923', node=iface)
-                
+
     def visit_class(self, node):
         """check size of inheritance hierarchy and number of instance attributes
         """
             for iface in node.interfaces():
                 self._used_ifaces[iface] = 1
         except InferenceError:
-            # XXX log ? 
+            # XXX log ?
             pass
         for parent in node.ancestors():
             try:
                 self._used_abstracts[parent] += 1
             except KeyError:
                 self._used_abstracts[parent] = 1
-            
+
     def leave_class(self, node):
         """check number of public methods"""
         nb_public_methods = 0
                              args=(nb_public_methods,
                                    self.config.min_public_methods))
 
-        
+
     def visit_function(self, node):
         """check function name, docstring, arguments, redefinition,
         variable names, max locals
         if not self._returns:
             return # return outside function, reported by the base checker
         self._returns[-1] += 1
-        
+
     def visit_default(self, node):
         """default visit method -> increments the statements counter if
         necessary
             branchs += 1
         self._inc_branch(branchs)
         self._stmts += branchs
-        
+
     def visit_tryfinally(self, _):
         """increments the branchs counter"""
         self._inc_branch(2)
         self._stmts += 2
-        
+
     def visit_if(self, node):
         """increments the branchs counter"""
         branchs = 1
             branchs += 1
         self._inc_branch(branchs)
         self._stmts += branchs
-        
+
     def visit_while(self, node):
         """increments the branchs counter"""
         branchs = 1
         if node.orelse:
             branchs += 1
         self._inc_branch(branchs)
-        
+
     visit_for = visit_while
 
     def _inc_branch(self, branchsnum=1):
+# Copyright (c) 2003-2012 LOGILAB S.A. (Paris, FRANCE).
 # This program is free software; you can redistribute it and/or modify it under
 # the terms of the GNU General Public License as published by the Free Software
 # Foundation; either version 2 of the License, or (at your option) any later
 # You should have received a copy of the GNU General Public License along with
 # this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-""" Copyright (c) 2003-2006 LOGILAB S.A. (Paris, FRANCE).
- http://www.logilab.fr/ -- mailto:contact@logilab.fr
+"""utilities for PyLint configuration :
 
-  utilities for PyLint configuration :
-   _ pylintrc
-   _ pylint.d (PYLINT_HOME)
+* pylintrc
+* pylint.d (PYLINTHOME)
 """
 
 import pickle
     PYLINT_HOME = ".pylint.d"
 else:
     PYLINT_HOME = join(USER_HOME, '.pylint.d')
-        
+
 if not exists(PYLINT_HOME):
     try:
         os.mkdir(PYLINT_HOME)
     """
     base_name = base_name.replace(os.sep, '_')
     return join(PYLINT_HOME, "%s%s%s"%(base_name, recurs, '.stats'))
-    
+
 def load_results(base):
     """try to unpickle and return data from file if it exists and is not
     corrupted
-    
+
     return an empty dictionary if it doesn't exists
     """
-    data_file = get_pdata_path(base, 1)        
+    data_file = get_pdata_path(base, 1)
     try:
         return pickle.load(open(data_file))
     except:
 PYLINTRC = find_pylintrc()
 
 ENV_HELP = '''
-The following environment variables are used :                                 
-    * PYLINTHOME                                                               
-    path to the directory where data of persistent run will be stored. If not
-found, it defaults to ~/.pylint.d/ or .pylint.d (in the current working
-directory).
-    * PYLINTRC                                                                 
-    path to the configuration file. If not found, it will use the first        
-existent file in ~/.pylintrc, /etc/pylintrc.
+The following environment variables are used:                                   
+    * PYLINTHOME                                                                
+    path to the directory where data of persistent run will be stored. If not 
+found, it defaults to ~/.pylint.d/ or .pylint.d (in the current working 
+directory).                                                                     
+    * PYLINTRC                                                                  
+    path to the configuration file. If not found, it will use the first         
+existing file among (~/.pylintrc, /etc/pylintrc).
 ''' % globals()
 
 # evaluation messages #########################################################

File pyreverse/diagrams.py

 def set_counter(value):
     """Figure counter (re)set"""
     Figure._UID_COUNT = value
-    
+
 class Figure:
     """base class for counter handling"""
     _UID_COUNT = 0
     def __init__(self):
         Figure._UID_COUNT += 1
         self.fig_id = Figure._UID_COUNT
-        
+
 class Relationship(Figure):
     """a relation ship from an object in the diagram to another
     """
         self.to_object = to_object
         self.type = relation_type
         self.name = name
-        
-    
+
+
 class DiagramEntity(Figure):
     """a diagram object, i.e. a label associated to an astng node
     """
         self._nodes = {}
         self.depends = []
 
-    def add_relationship(self, from_object, to_object, 
+    def add_relationship(self, from_object, to_object,
                          relation_type, name=None):
         """create a relation ship
         """
         """return true if the given node is included in the diagram
         """
         return node in self._nodes
-        
+
     def object_from_node(self, node):
         """return the diagram object mapped to node
         """
         return self._nodes[node]
-            
+
     def classes(self):
         """return all class nodes in the diagram"""
         return [o for o in self.objects if isinstance(o.node, astng.Class)]
             if klass.node.name == name:
                 return klass
         raise KeyError(name)
-    
+
     def extract_relationships(self):
         """extract relation ships between nodes in the diagram
         """
     """package diagram handling
     """
     TYPE = 'package'
-    
+
     def modules(self):
         """return all module nodes in the diagram"""
         return [o for o in self.objects if isinstance(o.node, astng.Module)]
             if mod_name == "%s.%s" % (package.rsplit('.', 1)[0], name):
                 return mod
         raise KeyError(name)
-        
+
     def add_from_depend(self, node, from_module):
         """add dependencies created by from-imports
         """