src/eric7/Utilities/ClassBrowsers/pyclbr.py

branch
eric7
changeset 10433
328f3ec4b77a
parent 10216
c07a1ef5c5d3
child 10439
21c28b0f9e41
equal deleted inserted replaced
10432:2fe91fe443dd 10433:328f3ec4b77a
181 def __init__(self, module, name, superClasses, file, lineno): 181 def __init__(self, module, name, superClasses, file, lineno):
182 """ 182 """
183 Constructor 183 Constructor
184 184
185 @param module name of the module containing this class 185 @param module name of the module containing this class
186 @type str
186 @param name name of this class 187 @param name name of this class
188 @type str
187 @param superClasses list of class names this class is inherited from 189 @param superClasses list of class names this class is inherited from
190 @type list of str
188 @param file filename containing this class 191 @param file filename containing this class
192 @type str
189 @param lineno linenumber of the class definition 193 @param lineno linenumber of the class definition
194 @type int
190 """ 195 """
191 ClbrBaseClasses.Class.__init__(self, module, name, superClasses, file, lineno) 196 ClbrBaseClasses.Class.__init__(self, module, name, superClasses, file, lineno)
192 VisibilityMixin.__init__(self) 197 VisibilityMixin.__init__(self)
193 198
194 199
210 ): 215 ):
211 """ 216 """
212 Constructor 217 Constructor
213 218
214 @param module name of the module containing this function 219 @param module name of the module containing this function
220 @type str
215 @param name name of this function 221 @param name name of this function
222 @type str
216 @param file filename containing this class 223 @param file filename containing this class
224 @type str
217 @param lineno linenumber of the class definition 225 @param lineno linenumber of the class definition
226 @type int
218 @param signature parameterlist of the method 227 @param signature parameterlist of the method
228 @type str
219 @param separator string separating the parameters 229 @param separator string separating the parameters
230 @type str
220 @param modifierType type of the function 231 @param modifierType type of the function
232 @type int
221 @param annotation return annotation 233 @param annotation return annotation
234 @type str
222 """ 235 """
223 ClbrBaseClasses.Function.__init__( 236 ClbrBaseClasses.Function.__init__(
224 self, 237 self,
225 module, 238 module,
226 name, 239 name,
242 def __init__(self, module, name, file, lineno): 255 def __init__(self, module, name, file, lineno):
243 """ 256 """
244 Constructor 257 Constructor
245 258
246 @param module name of the module containing this class 259 @param module name of the module containing this class
260 @type str
247 @param name name of this class 261 @param name name of this class
262 @type str
248 @param file filename containing this attribute 263 @param file filename containing this attribute
264 @type str
249 @param lineno linenumber of the class definition 265 @param lineno linenumber of the class definition
266 @type int
250 """ 267 """
251 ClbrBaseClasses.Attribute.__init__(self, module, name, file, lineno) 268 ClbrBaseClasses.Attribute.__init__(self, module, name, file, lineno)
252 VisibilityMixin.__init__(self) 269 VisibilityMixin.__init__(self)
253 270
254 271
272 289
273 def __init__(self, module, file): 290 def __init__(self, module, file):
274 """ 291 """
275 Constructor 292 Constructor
276 293
277 @param module name of the module containing the import (string) 294 @param module name of the module containing the import
278 @param file file name containing the import (string) 295 @type str
296 @param file file name containing the import
297 @type str
279 """ 298 """
280 self.module = module 299 self.module = module
281 self.name = "import" 300 self.name = "import"
282 self.file = file 301 self.file = file
283 self.imports = {} 302 self.imports = {}
284 303
285 def addImport(self, moduleName, names, lineno): 304 def addImport(self, moduleName, names, lineno):
286 """ 305 """
287 Public method to add a list of imported names. 306 Public method to add a list of imported names.
288 307
289 @param moduleName name of the imported module (string) 308 @param moduleName name of the imported module
290 @param names list of names (list of strings) 309 @type str
310 @param names list of names
311 @type list of str
291 @param lineno line number of the import 312 @param lineno line number of the import
313 @type int
292 """ 314 """
293 if moduleName not in self.imports: 315 if moduleName not in self.imports:
294 module = ImportedModule(self.module, self.file, moduleName) 316 module = ImportedModule(self.module, self.file, moduleName)
295 self.imports[moduleName] = module 317 self.imports[moduleName] = module
296 else: 318 else:
299 321
300 def getImport(self, moduleName): 322 def getImport(self, moduleName):
301 """ 323 """
302 Public method to get an imported module item. 324 Public method to get an imported module item.
303 325
304 @param moduleName name of the imported module (string) 326 @param moduleName name of the imported module
305 @return imported module item (ImportedModule) or None 327 @type str
328 @return imported module item
329 @rtype ImportedModule
306 """ 330 """
307 if moduleName in self.imports: 331 if moduleName in self.imports:
308 return self.imports[moduleName] 332 return self.imports[moduleName]
309 else: 333 else:
310 return None 334 return None
313 """ 337 """
314 Public method to get all imported module names. 338 Public method to get all imported module names.
315 339
316 @return dictionary of imported module names with name as key and list 340 @return dictionary of imported module names with name as key and list
317 of line numbers of imports as value 341 of line numbers of imports as value
342 @rtype dict
318 """ 343 """
319 return self.imports 344 return self.imports
320 345
321 346
322 class ImportedModule: 347 class ImportedModule:
326 351
327 def __init__(self, module, file, importedModule): 352 def __init__(self, module, file, importedModule):
328 """ 353 """
329 Constructor 354 Constructor
330 355
331 @param module name of the module containing the import (string) 356 @param module name of the module containing the import
332 @param file file name containing the import (string) 357 @type str
333 @param importedModule name of the imported module (string) 358 @param file file name containing the import
359 @type str
360 @param importedModule name of the imported module
361 @type str
334 """ 362 """
335 self.module = module 363 self.module = module
336 self.name = "import" 364 self.name = "import"
337 self.file = file 365 self.file = file
338 self.importedModuleName = importedModule 366 self.importedModuleName = importedModule
344 def addImport(self, lineno, importedNames): 372 def addImport(self, lineno, importedNames):
345 """ 373 """
346 Public method to add a list of imported names. 374 Public method to add a list of imported names.
347 375
348 @param lineno line number of the import 376 @param lineno line number of the import
349 @param importedNames list of imported names (list of strings) 377 @type int
378 @param importedNames list of imported names
379 @type list of str
350 """ 380 """
351 if lineno not in self.linenos: 381 if lineno not in self.linenos:
352 self.linenos.append(lineno) 382 self.linenos.append(lineno)
353 383
354 for name in importedNames: 384 for name in importedNames:
780 810
781 def _indent(ws): 811 def _indent(ws):
782 """ 812 """
783 Module function to return the indentation depth. 813 Module function to return the indentation depth.
784 814
785 @param ws the whitespace to be checked (string) 815 @param ws the whitespace to be checked
786 @return length of the whitespace string (integer) 816 @type str
817 @return length of the whitespace string
818 @rtype int
787 """ 819 """
788 return len(ws.expandtabs(TABWIDTH)) 820 return len(ws.expandtabs(TABWIDTH))

eric ide

mercurial