ох уж эти contextmanager-ы
parent
bc60c003e6
commit
6b43a7f208
|
@ -21,7 +21,7 @@ def shelf(filename, ttl=0):
|
||||||
with LOCKS.get(filename, threading.RLock()):
|
with LOCKS.get(filename, threading.RLock()):
|
||||||
with closing(shelve.open(filename, writeback=True)) as d:
|
with closing(shelve.open(filename, writeback=True)) as d:
|
||||||
import time
|
import time
|
||||||
if not d:
|
if not dict(d):
|
||||||
d.update({
|
d.update({
|
||||||
"created_at": time.time(),
|
"created_at": time.time(),
|
||||||
"data": {},
|
"data": {},
|
||||||
|
|
Loading…
Reference in New Issue