diff -r 1b59c4ba121e -r 8cd4d08fa9f6 Utilities/ClassBrowsers/pyclbr.py --- a/Utilities/ClassBrowsers/pyclbr.py Fri Mar 11 08:55:14 2011 +0100 +++ b/Utilities/ClassBrowsers/pyclbr.py Fri Mar 11 16:51:57 2011 +0100 @@ -103,6 +103,7 @@ _modules = {} # cache of modules we've seen + class VisibilityMixin(ClbrBaseClasses.ClbrVisibilityMixinBase): """ Mixin class implementing the notion of visibility. @@ -118,6 +119,7 @@ else: self.setPublic() + class Class(ClbrBaseClasses.Class, VisibilityMixin): """ Class to represent a Python class. @@ -135,11 +137,12 @@ ClbrBaseClasses.Class.__init__(self, module, name, super, file, lineno) VisibilityMixin.__init__(self) + class Function(ClbrBaseClasses.Function, VisibilityMixin): """ Class to represent a Python function. """ - def __init__(self, module, name, file, lineno, signature = '', separator = ','): + def __init__(self, module, name, file, lineno, signature='', separator=','): """ Constructor @@ -150,10 +153,11 @@ @param signature parameterlist of the method @param separator string separating the parameters """ - ClbrBaseClasses.Function.__init__(self, module, name, file, lineno, + ClbrBaseClasses.Function.__init__(self, module, name, file, lineno, signature, separator) VisibilityMixin.__init__(self) + class Attribute(ClbrBaseClasses.Attribute, VisibilityMixin): """ Class to represent a class attribute. @@ -170,6 +174,7 @@ ClbrBaseClasses.Attribute.__init__(self, module, name, file, lineno) VisibilityMixin.__init__(self) + class Publics(object): """ Class to represent the list of public identifiers. @@ -187,10 +192,11 @@ self.name = '__all__' self.file = file self.lineno = lineno - self.identifiers = [e.replace('"','').replace("'","").strip() \ + self.identifiers = [e.replace('"', '').replace("'", "").strip() \ for e in idents.split(',')] -def readmodule_ex(module, path=[], inpackage = False, isPyFile = False): + +def readmodule_ex(module, path=[], inpackage=False, isPyFile=False): ''' Read a module file and return a dictionary of classes. @@ -244,8 +250,8 @@ return dict _modules[module] = dict - classstack = [] # stack of (class, indent) pairs - conditionalsstack = [] # stack of indents of conditional defines + classstack = [] # stack of (class, indent) pairs + conditionalsstack = [] # stack of indents of conditional defines deltastack = [] deltaindent = 0 deltaindentcalculated = 0 @@ -278,7 +284,7 @@ if thisindent > conditionalsstack[-1]: if not deltaindentcalculated: deltastack.append(thisindent - conditionalsstack[-1]) - deltaindent = reduce(lambda x,y: x+y, deltastack) + deltaindent = reduce(lambda x, y: x + y, deltastack) deltaindentcalculated = 1 thisindent -= deltaindent else: @@ -310,7 +316,7 @@ else: dict_counts[meth_name] = 0 dict[meth_name] = f - classstack.append((f, thisindent)) # Marker for nested fns + classstack.append((f, thisindent)) # Marker for nested fns elif m.start("String") >= 0: pass @@ -445,6 +451,7 @@ return dict + def _indent(ws): """ Module function to return the indentation depth.