MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / open

Function open

tools/python-3.11.9-amd64/Lib/dbm/dumb.py:291–317  ·  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 da

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

Source from the content-addressed store, hash-verified

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

Callers 15

askopenfileFunction · 0.50
askopenfilesFunction · 0.50
asksaveasfileFunction · 0.50
testFunction · 0.50
readprofileMethod · 0.50
test_create_from_dataMethod · 0.50
test_configure_dataMethod · 0.50
test_configure_dataMethod · 0.50
_startMethod · 0.50
loadMethod · 0.50
send_headMethod · 0.50

Calls 1

_DatabaseClass · 0.85

Tested by 15

test_create_from_dataMethod · 0.40
test_configure_dataMethod · 0.40
test_configure_dataMethod · 0.40
read_fileMethod · 0.40
checkMethod · 0.40
parse_fileMethod · 0.40
testMethod · 0.40
test_openMethod · 0.40
test_mock_openMethod · 0.40