MCPcopy Index your code
hub / github.com/RustPython/RustPython / open

Function open

Lib/dbm/dumb.py:293–319  ·  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

291
292
293def open(file, flag='c', mode=0o666):
294 """Open the database file, filename, and return corresponding object.
295
296 The flag argument, used to control how the database is opened in the
297 other DBM implementations, supports only the semantics of 'c' and 'n'
298 values. Other values will default to the semantics of 'c' value:
299 the database will always opened for update and will be created if it
300 does not exist.
301
302 The optional mode argument is the UNIX mode of the file, used only when
303 the database has to be created. It defaults to octal code 0o666 (and
304 will be modified by the prevailing umask).
305
306 """
307
308 # Modify mode depending on the umask
309 try:
310 um = _os.umask(0)
311 _os.umask(um)
312 except AttributeError:
313 pass
314 else:
315 # Turn off any bits that are set in the umask
316 mode = mode & (~um)
317 if flag not in ('r', 'w', 'c', 'n'):
318 raise ValueError("Flag must be one of 'r', 'w', 'c', or 'n'")
319 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
server.pyFile · 0.50
magic_openFunction · 0.50

Calls 1

_DatabaseClass · 0.70