Skip to content
Snippets Groups Projects
Commit 458d17bd authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

PoolFile: completed cleanup of the dependency on AthFile

Removed unused functions:
* _guess_file_type() in AthFile
* extract_stream_names() in PoolFile.py
parent 2d3c5e2a
No related branches found
No related tags found
No related merge requests found
...@@ -50,7 +50,6 @@ class ModuleFacade(types.ModuleType): ...@@ -50,7 +50,6 @@ class ModuleFacade(types.ModuleType):
self.__dict__[ '__file__' ] = module.__file__ self.__dict__[ '__file__' ] = module.__file__
self.__dict__['_impl'] = _impl self.__dict__['_impl'] = _impl
self.__dict__['_guess_file_type'] = _guess_file_type
self.__dict__['server'] = _impl.g_server self.__dict__['server'] = _impl.g_server
...@@ -145,43 +144,6 @@ class ModuleFacade(types.ModuleType): ...@@ -145,43 +144,6 @@ class ModuleFacade(types.ModuleType):
pass # class ModuleFacade 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 ------------------------------------------------------------ ### exec at import ------------------------------------------------------------
import sys import sys
sys.modules[ __name__ ] = ModuleFacade( sys.modules[ __name__ ] ) sys.modules[ __name__ ] = ModuleFacade( sys.modules[ __name__ ] )
......
...@@ -10,7 +10,6 @@ __author__ = "Sebastien Binet <binet@cern.ch>" ...@@ -10,7 +10,6 @@ __author__ = "Sebastien Binet <binet@cern.ch>"
### --- data ------------------------------------------------------------------ ### --- data ------------------------------------------------------------------
__all__ = [ __all__ = [
'PoolFileCatalog', 'PoolFileCatalog',
'extract_stream_names',
'PoolOpts', 'PoolOpts',
'extract_items', 'extract_items',
'PoolRecord', 'PoolRecord',
...@@ -244,22 +243,6 @@ class PoolFileCatalog(object): ...@@ -244,22 +243,6 @@ class PoolFileCatalog(object):
pass 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): class PoolOpts(object):
# default names of APR file storage elements # default names of APR file storage elements
# copied here from RootUtils/APRDefaults.h for performance (as the first dictionary access takes 7 sec) # copied here from RootUtils/APRDefaults.h for performance (as the first dictionary access takes 7 sec)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment