CMS 3D CMS Logo

Public Member Functions | Private Attributes

TreeCrawler::mymf Class Reference

List of all members.

Public Member Functions

def __init__
def import_hook
def import_module
def load_module

Private Attributes

 _depgraph
 _globalarea
 _last_caller
 _localarea
 _types

Detailed Description

Definition at line 91 of file TreeCrawler.py.


Constructor & Destructor Documentation

def TreeCrawler::mymf::__init__ (   self,
  args,
  kwargs 
)

Definition at line 92 of file TreeCrawler.py.

00093                                      :
00094         self._depgraph = {}
00095         self._types = {}
00096         self._last_caller = None
00097         #TODO - replace by environment variables CMSSW_BASE and CMSSW_RELEASE_BASE (*and* do it only if the global one is not empty like for IB areas)  
00098         self._localarea = os.path.expandvars('$CMSSW_BASE')
00099         self._globalarea = os.path.expandvars('$CMSSW_RELEASE_BASE')
        modulefinder.ModuleFinder.__init__(self,*args,**kwargs)

Member Function Documentation

def TreeCrawler::mymf::import_hook (   self,
  name,
  caller = None,
  fromlist = None,
  level = -1 
)

Definition at line 100 of file TreeCrawler.py.

00101                                                                      :
00102         old_last_caller = self._last_caller
00103         try:
00104             self._last_caller = caller
00105             return modulefinder.ModuleFinder.import_hook(self,name,caller,fromlist, level=level)  
00106         finally:
00107             self._last_caller = old_last_caller

def TreeCrawler::mymf::import_module (   self,
  partnam,
  fqname,
  parent 
)

Definition at line 108 of file TreeCrawler.py.

00109                                                  :
00110                               
00111         if partnam in ("FWCore","os"):
00112             r = None
00113         else:
00114             r = modulefinder.ModuleFinder.import_module(self,partnam,fqname,parent)
00115             # since the modulefinder is not able to look into the global area when coming from the local area, we force a second try   
00116             if parent and not r and self._localarea != '' and self._globalarea != '':
00117                  parent.__file__ = parent.__file__.replace(self._localarea,self._globalarea)
00118                  parent.__path__[0] = parent.__path__[0].replace(self._localarea,self._globalarea)
00119             r = modulefinder.ModuleFinder.import_module(self,partnam,fqname,parent)
00120                                                          
00121         if r is not None:
00122             self._depgraph.setdefault(self._last_caller.__name__,{})[r.__name__] = 1
        return r
def TreeCrawler::mymf::load_module (   self,
  fqname,
  fp,
  pathname,
  suffix,
  mode,
  type 
)

Definition at line 123 of file TreeCrawler.py.

00124                                                                      :
00125         r = modulefinder.ModuleFinder.load_module(self, fqname, fp, pathname, (suffix, mode, type))
00126         if r is not None:
00127             self._types[r.__name__] = type
00128         return r
00129 


Member Data Documentation

Definition at line 92 of file TreeCrawler.py.

Definition at line 92 of file TreeCrawler.py.

Definition at line 92 of file TreeCrawler.py.

Definition at line 92 of file TreeCrawler.py.

Definition at line 92 of file TreeCrawler.py.