-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
A preset function you can use in wrap_kvs to ask the user to confirm if they're writing a value in a key that already has a different value under it.
from dol import wrap_kvs
d = {'a': 'apple', 'b': 'banana'}
d = wrap_kvs(d, preset=confirm_overwrite)
d['a'] = 'apple'
d['c'] = 'coconut'
assert d == {'a': 'apple', 'b': 'banana', 'c': 'coconut'}But
d['a'] = 'alligator'
would lead to a user input request:
The key a already exists and has value apple. If you want to overwrite it with alligator, confirm by typing alligator here:
which would only perform the write if the user types alligator and hits return
┆Issue is synchronized with this Asana task by Unito
Metadata
Metadata
Assignees
Labels
No labels