Public Member Functions | |
def | __init__ |
def | dump |
def | search |
Public Attributes | |
dependencies | |
hit | |
module | |
name | |
searched | |
stack |
Definition at line 50 of file TreeCrawler.py.
def TreeCrawler::Package::__init__ | ( | self, | ||
name, | ||||
top = False | ||||
) |
def TreeCrawler::Package::dump | ( | self, | ||
level | ||||
) |
Definition at line 60 of file TreeCrawler.py.
00060 : 00061 indent = " " * level 00062 print indent, "+", Color.info, self.name, Color.none 00063 # sort dependencies alphabetically 00064 self.dependencies.sort(key = lambda x: x.name) 00065 for package in self.dependencies: 00066 package.dump(level+1) def search(self,pattern,result):
def TreeCrawler::Package::search | ( | self, | ||
pattern, | ||||
result | ||||
) |
recursive search for pattern in source files
Definition at line 67 of file TreeCrawler.py.
00067 : 00068 """ recursive search for pattern in source files""" 00069 # first start searching in the package itself / do this only once 00070 if self.module: 00071 for number, line in enumerate(inspect.getsource(self.module).splitlines()): 00072 if pattern in line: 00073 filename = packageNameFromFilename(inspect.getsourcefile(self.module)) 00074 if not self.searched: 00075 # save the hit, so we can add later stacks to it 00076 self.hit = SearchHit() 00077 self.hit.number = number 00078 self.hit.filename = filename 00079 self.hit.line = line 00080 self.hit.stacks = list() 00081 result.append(self.hit) 00082 self.hit.stacks.append(copy.copy(_stack)) 00083 # then go on with dependencies 00084 _stack.append(self.name) 00085 for package in self.dependencies: 00086 package.search(pattern,result) 00087 _stack.pop() 00088 self.searched = True 00089 00090 class mymf(modulefinder.ModuleFinder):
Definition at line 53 of file TreeCrawler.py.
Definition at line 76 of file TreeCrawler.py.
Definition at line 57 of file TreeCrawler.py.
Definition at line 52 of file TreeCrawler.py.
Definition at line 54 of file TreeCrawler.py.
Definition at line 55 of file TreeCrawler.py.