• Home
  • Raw
  • Download

Lines Matching +full:open +full:- +full:source

1 :mod:`dbm` --- Interfaces to Unix "databases"
7 **Source code:** :source:`Lib/dbm/__init__.py`
9 --------------
11 :mod:`dbm` is a generic interface to variants of the DBM database ---
13 slow-but-simple implementation in module :mod:`dbm.dumb` will be used. There
22 item --- the latter is used when :exc:`dbm.error` is raised.
28 available --- :mod:`dbm.gnu`, :mod:`dbm.ndbm` or :mod:`dbm.dumb` --- should
29 be used to open a given file.
37 Accepts :term:`path-like object` for filename.
39 .. function:: open(file, flag='r', mode=0o666)
41 Open the database file *file* and return a corresponding object.
49 +---------+-------------------------------------------+
52 | ``'r'`` | Open existing database for reading only |
54 +---------+-------------------------------------------+
55 | ``'w'`` | Open existing database for reading and |
57 +---------+-------------------------------------------+
58 | ``'c'`` | Open database for reading and writing, |
60 +---------+-------------------------------------------+
61 | ``'n'`` | Always create a new, empty database, open |
63 +---------+-------------------------------------------+
70 The object returned by :func:`.open` supports the same basic functionality as
79 Deleting a key from a read-only database raises database module specific error
83 Accepts :term:`path-like object` for file.
94 returned by :func:`.open`.
101 # Open database, creating it if necessary.
102 with dbm.open('cache', 'c') as db:
114 # Often-used methods of the dict interface work too.
117 # Storing a non-string key or value will raise an exception (most
127 Persistence module which stores non-string data.
133 :mod:`dbm.gnu` --- GNU's reinterpretation of dbm
134 ------------------------------------------------
140 **Source code:** :source:`Lib/dbm/gnu.py`
142 --------------
157 Raised on :mod:`dbm.gnu`-specific errors, such as I/O errors. :exc:`KeyError` is
161 .. function:: open(filename[, flag[, mode]])
163 Open a ``gdbm`` database and return a :class:`gdbm` object. The *filename*
168 +---------+-------------------------------------------+
171 | ``'r'`` | Open existing database for reading only |
173 +---------+-------------------------------------------+
174 | ``'w'`` | Open existing database for reading and |
176 +---------+-------------------------------------------+
177 | ``'c'`` | Open database for reading and writing, |
179 +---------+-------------------------------------------+
180 | ``'n'`` | Always create a new, empty database, open |
182 +---------+-------------------------------------------+
187 +---------+--------------------------------------------+
190 | ``'f'`` | Open the database in fast mode. Writes |
192 +---------+--------------------------------------------+
196 +---------+--------------------------------------------+
198 +---------+--------------------------------------------+
207 In addition to the dictionary-like methods, ``gdbm`` objects have the
211 Accepts :term:`path-like object` for filename.
248 :mod:`dbm.ndbm` --- Interface based on ndbm
249 -------------------------------------------
255 **Source code:** :source:`Lib/dbm/ndbm.py`
257 --------------
270 Raised on :mod:`dbm.ndbm`-specific errors, such as I/O errors. :exc:`KeyError` is raised
279 .. function:: open(filename[, flag[, mode]])
281 Open a dbm database and return a ``ndbm`` object. The *filename* argument is the
286 +---------+-------------------------------------------+
289 | ``'r'`` | Open existing database for reading only |
291 +---------+-------------------------------------------+
292 | ``'w'`` | Open existing database for reading and |
294 +---------+-------------------------------------------+
295 | ``'c'`` | Open database for reading and writing, |
297 +---------+-------------------------------------------+
298 | ``'n'`` | Always create a new, empty database, open |
300 +---------+-------------------------------------------+
306 In addition to the dictionary-like methods, ``ndbm`` objects
310 Accepts :term:`path-like object` for filename.
317 :mod:`dbm.dumb` --- Portable DBM implementation
318 -----------------------------------------------
323 **Source code:** :source:`Lib/dbm/dumb.py`
334 --------------
336 The :mod:`dbm.dumb` module provides a persistent dictionary-like interface which
346 Raised on :mod:`dbm.dumb`-specific errors, such as I/O errors. :exc:`KeyError` is
350 .. function:: open(filename[, flag[, mode]])
352 Open a ``dumbdbm`` database and return a dumbdbm object. The *filename* argument is
359 +---------+-------------------------------------------+
362 | ``'r'`` | Open existing database for reading only |
364 +---------+-------------------------------------------+
365 | ``'w'`` | Open existing database for reading and |
367 +---------+-------------------------------------------+
368 | ``'c'`` | Open database for reading and writing, |
370 +---------+-------------------------------------------+
371 | ``'n'`` | Always create a new, empty database, open |
373 +---------+-------------------------------------------+
385 :func:`.open` always creates a new database when the flag has the value
389 A database opened with flags ``'r'`` is now read-only. Opening with
394 Accepts :term:`path-like object` for filename.
402 Synchronize the on-disk directory and data files. This method is called