Skip to content

Commit

Permalink
fix?
Browse files Browse the repository at this point in the history
  • Loading branch information
VanyaBelyaev committed Sep 8, 2024
1 parent 28af131 commit 07c5c02
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion ostap/io/compress_shelve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 + '*' ) ] )
Expand Down
12 changes: 8 additions & 4 deletions ostap/io/dbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 07c5c02

Please sign in to comment.