Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:53

0001 import inspect
0002 
0003 
0004 class ConfigError(Exception):
0005     """the most basic Error for CMS config"""
0006     pass
0007 
0008 
0009 class ModuleCloneError(ConfigError):
0010     pass
0011 
0012 
0013 def format_outerframe(number):
0014     """formats the outer frame 'number' to output like:
0015        In file foo.py, line 8:
0016           process.aPath = cms.Path(module1*module2)
0017 
0018        'number' is the number of frames to go back relative to caller.  
0019     """
0020     frame = inspect.stack()[number+1] #+1 because this routine adds another call
0021     return "In file %s, line %s:\n    %s" %(frame[1], frame[2], frame[4][0])
0022 
0023     
0024 def format_typename(object):
0025     """format the typename and return only the last part""" 
0026     return str(type(object)).split("'")[1].split(".")[-1]