From 07c5c02db3391a7206e26e9f0ba8df51738cf9b8 Mon Sep 17 00:00:00 2001 From: Vanya Belyaev Date: Sun, 8 Sep 2024 14:17:50 +0200 Subject: [PATCH] fix? --- ostap/io/compress_shelve.py | 3 ++- ostap/io/dbase.py | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ostap/io/compress_shelve.py b/ostap/io/compress_shelve.py index 751800ef..21234935 100755 --- a/ostap/io/compress_shelve.py +++ b/ostap/io/compress_shelve.py @@ -246,7 +246,8 @@ def __init__( self.__opened = False dbase = dbopen ( self.dbname , flag = mode , dbtype = dbtype , **kwargs ) self.__opened = True - + if dbase and 'r' != mode and hasattr ( dbase , 'sync' ) : dbase.sync() + # ======================================================================= ## all files after dbopen pfiles = set ( [ the_path ( i ) for i in glob.iglob ( self.dbname + '*' ) ] ) diff --git a/ostap/io/dbase.py b/ostap/io/dbase.py index 7afbd4fb..0d1ada77 100644 --- a/ostap/io/dbase.py +++ b/ostap/io/dbase.py @@ -113,12 +113,16 @@ def bsddb3_open ( filelame , use_lmdb = False # ============================================================================= ## make a try for LMDB -if ( 3 , 7 ) <= sys.version_info : - try : +if ( 3 , 7 ) <= sys.version_info : + # ========================================================================= + try : + # ===================================================================== import lmdb from ostap.io.lmdbdict import LmdbDict, islmdb use_lmdb = True - except ImportError : + # ===================================================================== + except ImportError : + # ===================================================================== lmdb = None use_lmdb = False @@ -338,7 +342,7 @@ def dbfiles ( dbtype , basename ) : """ if dbtype in ( 'dbm.ndbm' , 'dbm' ) : return '%s.pag' % basename , '%s.dir' % basename , - elif dbtype in ( 'dbm.dump' , 'dumbdbm' ) : + elif dbtype in ( 'dbm.dumb' , 'dumbdbm' , ) : return '%s.dat' % basename , '%s.dir' % basename , elif dbtype in ( 'lmdb', ) : return ( os.path.join ( basename , '' ) , ## directory