gdbm_compat (version 2.0.0)
index

The following code is Public Domain.
 
Written by Tim Savannah, 2016.
 
The following methods allow you to use a gdbm database of a different version. It may not work in all cases, but is better than a flat-out error.

 
Package Contents
       

 
Functions
       
convert_to_1_10(filename)
convert_to_1_10 - Convert a gdbm database to format 1.10
 
Returns a filename of the converted database.
convert_to_1_8(filename)
convert_to_1_8 - Convert a gdbm database to format 1.8
 
Returns a filename of the converted database
get_gdbm_module()
get_gdbm_module - Returns the "gdbm" module, supporting both python2 and python3 core modules.
 
@return - The module
 
@raises - ImportError if cannot find under "gdbm" or "dbm.gnu"
get_magic_number(filename)
get_magic_number - Gets the magic number associated with the gdbm database filename provided
 
@return <bytes> - Bytes of magic number
is_1_10(filename)
is_1_10 - Checks if database is in 1.10 format
is_1_8(filename)
is_1_8 - Checks if database is in 1.8 format.
open_compat(filename, mode='r')
open - Allows opening a gdbm database, supporting either 1_8 or 1_10, as much as the current platform can.
 
 
    @param filename <str> - Path to gdbm file to open
    @param mode <str> - Must be "r"
 
    A temporary copy is created, and will be removed automatically when your program exists
 
@return - gdbm.gdbm object of the database
replace_magic_number(filename, newMagic)
replace_magic_number - Generate a new gdbm copy of the given gdbm, which contains the provided magic number.
 
<return> - Filename of new file, old contents with provided magic number.

 
Data
        __all__ = ('open_compat', 'convert_to_1_10', 'convert_to_1_8', 'replace_magic_number', 'get_magic_number', 'is_1_8', 'is_1_10', 'get_gdbm_module')
__version__ = '2.0.0'
__version_tuple__ = (2, 0, 0)