MCPcopy Index your code
hub / github.com/python/cpython / open

Function open

Lib/dbm/dumb.py:319–345  ·  view source on GitHub ↗

Open the database file, filename, and return corresponding object. The flag argument, used to control how the database is opened in the other DBM implementations, supports only the semantics of 'c' and 'n' values. Other values will default to the semantics of 'c' value: the databas

(file, flag='c', mode=0o666)

Source from the content-addressed store, hash-verified

317
318
319def open(file, flag='c', mode=0o666):
320 """Open the database file, filename, and return corresponding object.
321
322 The flag argument, used to control how the database is opened in the
323 other DBM implementations, supports only the semantics of 'c' and 'n'
324 values. Other values will default to the semantics of 'c' value:
325 the database will always opened for update and will be created if it
326 does not exist.
327
328 The optional mode argument is the UNIX mode of the file, used only when
329 the database has to be created. It defaults to octal code 0o666 (and
330 will be modified by the prevailing umask).
331
332 """
333
334 # Modify mode depending on the umask
335 try:
336 um = _os.umask(0)
337 _os.umask(um)
338 except AttributeError:
339 pass
340 else:
341 # Turn off any bits that are set in the umask
342 mode = mode & (~um)
343 if flag not in ('r', 'w', 'c', 'n'):
344 raise ValueError("Flag must be one of 'r', 'w', 'c', or 'n'")
345 return _Database(file, mode, flag=flag)

Callers 15

askopenfileFunction · 0.50
askopenfilesFunction · 0.50
asksaveasfileFunction · 0.50
testFunction · 0.50
readprofileMethod · 0.50
_startMethod · 0.50
_parse_makefileFunction · 0.50
_generate_posix_varsFunction · 0.50
loadMethod · 0.50
send_headMethod · 0.50
_mainFunction · 0.50
vfsopenFunction · 0.50

Calls 1

_DatabaseClass · 0.70

Used in the wild real call sites across dependent graphs

searching dependent graphs…