diff -r e9e7eca7efee -r bf71ee032bb4 src/eric7/Utilities/ClassBrowsers/ClbrBaseClasses.py --- a/src/eric7/Utilities/ClassBrowsers/ClbrBaseClasses.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/Utilities/ClassBrowsers/ClbrBaseClasses.py Wed Jul 13 14:55:47 2022 +0200 @@ -12,10 +12,11 @@ """ Class implementing the base of all class browser objects. """ + def __init__(self, module, name, file, lineno): """ Constructor - + @param module name of the module containing this object @type str @param name name of this object @@ -29,12 +30,12 @@ self.name = name self.file = file self.lineno = lineno - self.endlineno = -1 # marker for "not set" - + self.endlineno = -1 # marker for "not set" + def setEndLine(self, endLineNo): """ Public method to set the ending line number. - + @param endLineNo number of the last line @type int """ @@ -45,10 +46,11 @@ """ Class implementing the base of all complex class browser objects. """ + def __init__(self, module, name, file, lineno): """ Constructor - + @param module name of the module containing this object @type str @param name name of this object @@ -63,22 +65,22 @@ self.attributes = {} self.classes = {} self.globals = {} - + def _addmethod(self, name, function): """ Protected method to add information about a method. - + @param name name of method to be added @type str @param function Function object to be added @type Function """ self.methods[name] = function - + def _getmethod(self, name): """ Protected method to retrieve a method by name. - + @param name name of the method (string) @type str @return the named method @@ -88,11 +90,11 @@ return self.methods[name] except KeyError: return None - + def _addglobal(self, attr): """ Protected method to add information about global variables. - + @param attr Attribute object to be added @type Attribute """ @@ -100,11 +102,11 @@ self.globals[attr.name] = attr else: self.globals[attr.name].addAssignment(attr.lineno) - + def _getglobal(self, name): """ Protected method to retrieve a global variable by name. - + @param name name of the global variable @type str @return the named global variable @@ -114,11 +116,11 @@ return self.globals[name] except KeyError: return None - + def _addattribute(self, attr): """ Protected method to add information about attributes. - + @param attr Attribute object to be added @type Attribute """ @@ -126,11 +128,11 @@ self.attributes[attr.name] = attr else: self.attributes[attr.name].addAssignment(attr.lineno) - + def _getattribute(self, name): """ Protected method to retrieve an attribute by name. - + @param name name of the attribute @type str @return the named attribute @@ -140,11 +142,11 @@ return self.attributes[name] except KeyError: return None - + def _addclass(self, name, _class): """ Protected method method to add a nested class to this class. - + @param name name of the class @type str @param _class Class object to be added @@ -157,45 +159,46 @@ """ Class implementing the base class of all visibility mixins. """ + def isPrivate(self): """ Public method to check, if the visibility is Private. - + @return flag indicating Private visibility @rtype bool """ return self.visibility == 0 - + def isProtected(self): """ Public method to check, if the visibility is Protected. - + @return flag indicating Protected visibility @rtype bool """ return self.visibility == 1 - + def isPublic(self): """ Public method to check, if the visibility is Public. - + @return flag indicating Public visibility @rtype bool """ return self.visibility == 2 - + def setPrivate(self): """ Public method to set the visibility to Private. """ self.visibility = 0 - + def setProtected(self): """ Public method to set the visibility to Protected. """ self.visibility = 1 - + def setPublic(self): """ Public method to set the visibility to Public. @@ -207,10 +210,11 @@ """ Class to represent an attribute. """ + def __init__(self, module, name, file, lineno): """ Constructor - + @param module name of the module containing this attribute @type str @param name name of this attribute @@ -221,13 +225,13 @@ @type int """ _ClbrBase.__init__(self, module, name, file, lineno) - + self.linenos = [lineno] - + def addAssignment(self, lineno): """ Public method to add another assignment line number. - + @param lineno line number of the additional attribute assignment @type int """ @@ -239,10 +243,11 @@ """ Class to represent a class. """ + def __init__(self, module, name, superClasses, file, lineno): """ Constructor - + @param module name of the module containing this class @type str @param name name of this class @@ -264,10 +269,11 @@ """ Class to represent a module. """ + def __init__(self, module, name, file, lineno): """ Constructor - + @param module name of the module containing this module @type str @param name name of this module @@ -284,15 +290,25 @@ """ Class to represent a function or method. """ + General = 0 Static = 1 Class = 2 - - def __init__(self, module, name, file, lineno, signature='', separator=',', - modifierType=General, annotation=""): + + def __init__( + self, + module, + name, + file, + lineno, + signature="", + separator=",", + modifierType=General, + annotation="", + ): """ Constructor - + @param module name of the module containing this function @type str @param name name of this function @@ -320,10 +336,11 @@ """ Class to represent a source coding. """ + def __init__(self, module, file, lineno, coding): """ Constructor - + @param module name of the module containing this coding statement @type str @param file filename containing this coding statement @@ -342,10 +359,11 @@ """ Class to represent an enum definition. """ + def __init__(self, module, name, file, lineno): """ Constructor - + @param module name of the module containing this enum @type str @param name name of this enum