Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
VanyaBelyaev committed Aug 21, 2024
1 parent 4de2e45 commit 542c7fa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions ostap/io/compress_shelve.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def __init__(
if not self.__silent :
logger.info ( 'Open DB: %s' % dbname )

## filename without extension and the extension itself
## filename without extension and the extension itself
fname , ext = os.path.splitext ( dbname )

self.__extension = ext
Expand Down Expand Up @@ -200,7 +200,7 @@ def __init__(
self.__actual_dbname = filename

afiles = tuple ( [ self.dbname + suffix for suffix in ( '' , ',db' , '.dir' , '.pag' , '.dat' ) ] )
ofiles = set ( [ i for i in glob.iglob ( self.dbname + '*' ) if i in afiles ] )
ofiles = set ( [ i for i in glob.iglob ( self.dbname + '*' ) if i in afiles ] )


self.__opened = False
Expand Down
12 changes: 6 additions & 6 deletions ostap/io/tests/test_io_dbases.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def the_name ():
item = 'LmdbDict' , CleanUp.tempdir ( prefix = 'ostap-LMDB-' ) , LmdbDict
dbases.append ( item )
except ImportError:
logger.warning ( 'LmdbDict is not accessible!' )
logger.warning ( 'LmdbDict is not accessible!' )

# ============================================================================
try :
Expand All @@ -50,7 +50,7 @@ def the_name ():
item = 'BerkeleyDB' , CleanUp.tempfile ( prefix = 'ostap-BerkeleyDB-' , suffix = '.db' ) , berkeleydb_open
dbases.append ( item )
except ImportError:
logger.warning ( 'BerkeleyDB is not accessible!' )
logger.warning ( 'BerkeleyDB is not accessible!' )

# ============================================================================
try :
Expand All @@ -59,15 +59,15 @@ def the_name ():
item = 'BSDDB3' , CleanUp.tempfile ( prefix = 'ostap-BSDDB3-' , suffix = '.db' ) , bsbdb3_open
dbases.append ( item )
except ImportError:
logger.warning ( 'bsddb3 is not accessible!' )
logger.warning ( 'bsddb3 is not accessible!' )

# ============================================================================
try :
from ostap.io.sqlitedict import SqliteDict
item = 'SqliteDict' , CleanUp.tempfile ( prefix = 'ostap-SqliteDB-' , suffix = '.sql') , SqliteDict
dbases.append ( item )
except ImportError:
logger.warning ( 'SQliteDict is not accessible!' )
logger.warning ( 'SQliteDict is not accessible!' )

# ============================================================================
if ( 3,0 ) <= sys.version_info :
Expand All @@ -78,15 +78,15 @@ def gnu_open ( filename , flag = 'r' ) : return _gnu_open ( filename , flag )
item = 'dbm.gnu' , CleanUp.tempfile ( prefix = 'ostap-GNUDB-' , suffix = '.db' ) , gnu_open
dbases.append ( item )
except ImportError:
logger.warning ( 'dbm.gnuis not accessible!' )
logger.warning ( 'dbm.gnu is not accessible!' )
# ======================================================================
try :
from dbm.ndbm import open as _ndbm_open
def ndbm_open ( filename , flag = 'r' ) : return _ndbm_open ( filename , flag )
item = 'dbm.ndbm' , CleanUp.tempfile ( prefix = 'ostap-NDB-' , suffix = '.db' ) , ndbm_open
dbases.append ( item )
except ImportError:
logger.warning ( 'dbm.ndbm is not accessible!' )
logger.warning ( 'dbm.ndbm is not accessible!' )
# ======================================================================
try :
from dbm.dumb import open as dumb_open
Expand Down
12 changes: 6 additions & 6 deletions ostap/io/tests/test_io_shelves.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,14 @@ def test_shelves1():
db_zst = zstshelve.open ( db_zst_name , 'r' )
db_root = rootshelve.open ( db_root_name , 'r' )

logger.info('SQLiteShelve #keys: %s' % len ( list ( db_sql .keys() ) ) )
logger.info('ZipShelve #keys: %s' % len ( db_zip .keys() ) )
logger.info('Bz2Shelve #keys: %s' % len ( db_bz2 .keys() ) )
logger.info('SQLiteShelve #keys: %s' % len ( db_sql ) )
logger.info('ZipShelve #keys: %s' % len ( db_zip ) )
logger.info('Bz2Shelve #keys: %s' % len ( db_bz2 ) )
if lzshelve :
logger.info('LzShelve #keys: %s' % len ( db_lz .keys() ) )
logger.info('LzShelve #keys: %s' % len ( db_lz ) )
if zstshelve :
logger.info('ZstShelve #keys: %s' % len ( db_zst .keys() ) )
logger.info('RootShelve #keys: %s' % len ( db_root.keys() ) )
logger.info('ZstShelve #keys: %s' % len ( db_zst ) )
logger.info('RootShelve #keys: %s' % len ( db_root ) )

with timing ( 'h2-read/SQL' ) : h2_sql = db_sql [ 'histo-2D']
with timing ( 'h2_read/ZIP' ) : h2_zip = db_zip [ 'histo-2D']
Expand Down

0 comments on commit 542c7fa

Please sign in to comment.