diff --git a/Tools/PyUtils/python/AthFile/__init__.py b/Tools/PyUtils/python/AthFile/__init__.py index c98abc15251e239cb12766f3cd1640ef906806ae..0be996f426b2635068c40e683de1880eba24e16b 100644 --- a/Tools/PyUtils/python/AthFile/__init__.py +++ b/Tools/PyUtils/python/AthFile/__init__.py @@ -50,7 +50,6 @@ class ModuleFacade(types.ModuleType): self.__dict__[ '__file__' ] = module.__file__ self.__dict__['_impl'] = _impl - self.__dict__['_guess_file_type'] = _guess_file_type self.__dict__['server'] = _impl.g_server @@ -145,43 +144,6 @@ class ModuleFacade(types.ModuleType): pass # class ModuleFacade -### - -def _guess_file_type(fname, msg): - """guess the type of an input file (bs,rdo,esd,aod,...) - """ - input_type = None - import PyUtils.AthFile as af - try: - file_type,file_name = af.ftype(fname) - except Exception: - raise # for now - if file_type == 'bs': - input_type = 'bs' - elif file_type == 'pool': - import PyUtils.PoolFile as pf - stream_names = pf.extract_stream_names(fname) - stream_names = [s.lower() for s in stream_names] - if len(stream_names) > 1: - msg.warning('got many stream names: %r', stream_names) - msg.warning('only considering the 1st one...') - elif len(stream_names) <= 0: - msg.warning('got an empty list of stream names') - raise SystemExit(1) - stream_name = stream_names[0] - input_type = { - 'stream1': 'rdo', - 'streamesd' : 'esd', - 'streamaod' : 'aod', - # FIXME: TODO: TAG, DPD - }.get(stream_name, 'aod') - - else: - msg.error('unknown file type (%s) for file [%s]', - file_type, file_name) - return input_type - - ### exec at import ------------------------------------------------------------ import sys sys.modules[ __name__ ] = ModuleFacade( sys.modules[ __name__ ] ) diff --git a/Tools/PyUtils/python/PoolFile.py b/Tools/PyUtils/python/PoolFile.py index 3c72c82c77f15cf558a148a4db39b6be5a1e1ed1..4cfba2fef57f06e879dca288733e9601982e58bc 100644 --- a/Tools/PyUtils/python/PoolFile.py +++ b/Tools/PyUtils/python/PoolFile.py @@ -10,7 +10,6 @@ __author__ = "Sebastien Binet <binet@cern.ch>" ### --- data ------------------------------------------------------------------ __all__ = [ 'PoolFileCatalog', - 'extract_stream_names', 'PoolOpts', 'extract_items', 'PoolRecord', @@ -244,22 +243,6 @@ class PoolFileCatalog(object): pass -def extract_stream_names(fname): - """find the stream names ('StreamESD', 'StreamAOD',...) contained in a - given POOL file - @params: - `fname` the filename of the POOL file to inspect (can be LFN or PFN) - - example: - >>> import PyUtils.PoolFile as pf - >>> streams = pf.extract_stream_names ('ESD.pool.root') - >>> print streams - ['StreamESD'] - """ - import PyUtils.AthFile as af - f = af.fopen(fname) - return f.fileinfos['stream_names'] - class PoolOpts(object): # default names of APR file storage elements # copied here from RootUtils/APRDefaults.h for performance (as the first dictionary access takes 7 sec) @@ -547,8 +530,7 @@ class PoolFile(object): # get the "final" file name (handles all kind of protocols) try: - import PyUtils.AthFile as af - protocol, fileName = af.server.fname(fileName) + protocol, fileName = _fname(fileName) except Exception as err: print("## warning: problem opening PoolFileCatalog:\n%s"%err) import traceback