CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
TreeCrawler.mymf Class Reference
Inheritance diagram for TreeCrawler.mymf:

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.

92 
93  def __init__(self,*args,**kwargs):
94  self._depgraph = {}
95  self._types = {}
96  self._last_caller = None
97  #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)
98  self._localarea = os.path.expandvars('$CMSSW_BASE')
99  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.

References TreeCrawler.mymf._last_caller.

101  def import_hook(self, name, caller=None, fromlist=None, level=-1):
102  old_last_caller = self._last_caller
103  try:
104  self._last_caller = caller
105  return modulefinder.ModuleFinder.import_hook(self,name,caller,fromlist, level=level)
106  finally:
107  self._last_caller = old_last_caller
def TreeCrawler.mymf.import_module (   self,
  partnam,
  fqname,
  parent 
)

Definition at line 108 of file TreeCrawler.py.

References TreeCrawler.mymf._globalarea, TreeCrawler.mymf._localarea, and python.rootplot.root2matplotlib.replace().

109  def import_module(self,partnam,fqname,parent):
110 
111  if partnam in ("FWCore","os"):
112  r = None
113  else:
114  r = modulefinder.ModuleFinder.import_module(self,partnam,fqname,parent)
115  # since the modulefinder is not able to look into the global area when coming from the local area, we force a second try
116  if parent and not r and self._localarea != '' and self._globalarea != '':
117  parent.__file__ = parent.__file__.replace(self._localarea,self._globalarea)
118  parent.__path__[0] = parent.__path__[0].replace(self._localarea,self._globalarea)
119  r = modulefinder.ModuleFinder.import_module(self,partnam,fqname,parent)
120 
121  if r is not None:
122  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.

References TreeCrawler.mymf._types.

124  def load_module(self, fqname, fp, pathname, (suffix, mode, type)):
125  r = modulefinder.ModuleFinder.load_module(self, fqname, fp, pathname, (suffix, mode, type))
126  if r is not None:
127  self._types[r.__name__] = type
128  return r
129 

Member Data Documentation

TreeCrawler.mymf._depgraph
private

Definition at line 93 of file TreeCrawler.py.

TreeCrawler.mymf._globalarea
private

Definition at line 98 of file TreeCrawler.py.

Referenced by TreeCrawler.mymf.import_module().

TreeCrawler.mymf._last_caller
private

Definition at line 95 of file TreeCrawler.py.

Referenced by TreeCrawler.mymf.import_hook().

TreeCrawler.mymf._localarea
private

Definition at line 97 of file TreeCrawler.py.

Referenced by TreeCrawler.mymf.import_module().

TreeCrawler.mymf._types
private

Definition at line 94 of file TreeCrawler.py.

Referenced by VarParsing.VarParsing.__getattr__(), VarParsing.VarParsing._convert(), TreeCrawler.mymf.load_module(), VarParsing.VarParsing.register(), and VarParsing.VarParsing.setType().