| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,12 +5,11 @@ | |||
| 5 | 5 | import dbm | |
| 6 | 6 | d = dbm.open(file, 'w', 0o666) | |
| 7 | 7 | ||
| 8 | - The returned object is a dbm.bsd, dbm.gnu, dbm.ndbm or dbm.dumb | ||
| 9 | - object, dependent on the type of database being opened (determined by | ||
| 10 | - the whichdb function) in the case of an existing dbm. If the dbm does | ||
| 11 | - not exist and the create or new flag ('c' or 'n') was specified, the | ||
| 12 | - dbm type will be determined by the availability of the modules (tested | ||
| 13 | - in the above order). | ||
| 8 | + The returned object is a dbm.gnu, dbm.ndbm or dbm.dumb object, dependent on the | ||
| 9 | + type of database being opened (determined by the whichdb function) in the case | ||
| 10 | + of an existing dbm. If the dbm does not exist and the create or new flag ('c' | ||
| 11 | + or 'n') was specified, the dbm type will be determined by the availability of | ||
| 12 | + the modules (tested in the above order). | ||
| 14 | 13 | ||
| 15 | 14 | It has the following interface (key and data are strings): | |
| 16 | 15 | ||
@@ -47,7 +46,7 @@ | |||
| 47 | 46 | class error(Exception): | |
| 48 | 47 | pass | |
| 49 | 48 | ||
| 50 | - _names = ['dbm.bsd', 'dbm.gnu', 'dbm.ndbm', 'dbm.dumb'] | ||
| 49 | + _names = ['dbm.gnu', 'dbm.ndbm', 'dbm.dumb'] | ||
| 51 | 50 | _defaultmod = None | |
| 52 | 51 | _modules = {} | |
| 53 | 52 | ||
@@ -168,21 +167,13 @@ def whichdb(filename): | |||
| 168 | 167 | if magic == 0x13579ace: | |
| 169 | 168 | return "dbm.gnu" | |
| 170 | 169 | ||
| 171 | - ## Check for old Berkeley db hash file format v2 | ||
| 172 | - #if magic in (0x00061561, 0x61150600): | ||
| 173 | - # return "bsddb185" # not supported anymore | ||
| 174 | - | ||
| 175 | 170 | # Later versions of Berkeley db hash file have a 12-byte pad in | |
| 176 | 171 | # front of the file type | |
| 177 | 172 | try: | |
| 178 | 173 | (magic,) = struct.unpack("=l", s16[-4:]) | |
| 179 | 174 | except struct.error: | |
| 180 | 175 | return "" | |
| 181 | 176 | ||
| 182 | - ## Check for BSD hash | ||
| 183 | - #if magic in (0x00061561, 0x61150600): | ||
| 184 | - # return "dbm.bsd" | ||
| 185 | - | ||
| 186 | 177 | # Unknown | |
| 187 | 178 | return "" | |
| 188 | 179 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments