CMS 3D CMS Logo

TreeCrawler::Package Class Reference

List of all members.

Public Member Functions

def __init__
def dump
def search

Public Attributes

 dependencies
 hit
 module
 name
 searched
 stack


Detailed Description

Definition at line 50 of file TreeCrawler.py.


Member Function Documentation

def TreeCrawler::Package::__init__ (   self,
  name,
  top = False 
)

Definition at line 51 of file TreeCrawler.py.

00051                                      :
00052         self.name = name
00053         self.dependencies = []
00054         self.searched = False
00055         self.stack = []
00056         if top:
00057             self.module = None
00058         else:    
00059             self.module = __import__(name,[],[],"*")
    def dump(self,level):

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):


Member Data Documentation

TreeCrawler::Package::dependencies

Definition at line 53 of file TreeCrawler.py.

TreeCrawler::Package::hit

Definition at line 76 of file TreeCrawler.py.

TreeCrawler::Package::module

Definition at line 57 of file TreeCrawler.py.

TreeCrawler::Package::name

Definition at line 52 of file TreeCrawler.py.

TreeCrawler::Package::searched

Definition at line 54 of file TreeCrawler.py.

TreeCrawler::Package::stack

Definition at line 55 of file TreeCrawler.py.


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:53:04 2009 for CMSSW by  doxygen 1.5.4