/home/fresvfqn/waterdamagerestorationandrepairsmithtown.com/Compressed/bsddb.tar
dbutils.pyo 0000644 00000003133 15053607521 0006747 0 ustar 00 �
{fc @ so d d l m Z d d l Z e j d d k Z e r@ d d Un d d l Z d d Z d Z d Z
d � Z d S(
i����( t sleepNi i s from . import dbg �?i� gn��! @c O s� t } | j d d � } d | k r. | d =n x� t r� y | | | � SWq1 t j k
r� t ru t j d | � n t | � | d 9} | t k r� t } n | d 8} | d k r� � q� q1 Xq1 Wd S( s? DeadlockWrap(function, *_args, **_kwargs) - automatically retries
function in case of a database deadlock.
This is a function intended to be used to wrap database calls such
that they perform retrys with exponentially backing off sleeps in
between when a DBLockDeadlockError exception is raised.
A 'max_retries' parameter may optionally be passed to prevent it
from retrying forever (in which case the exception will be reraised).
d = DB(...)
d.open(...)
DeadlockWrap(d.put, "foo", data="bar") # set key "foo" to "bar"
t max_retriesi����s% dbutils.DeadlockWrap: sleeping %1.3f
i i N( t _deadlock_MinSleepTimet gett Truet dbt DBLockDeadlockErrort _deadlock_VerboseFilet writet _sleept _deadlock_MaxSleepTime( t functiont _argst _kwargst sleeptimeR ( ( s% /usr/lib64/python2.7/bsddb/dbutils.pyt DeadlockWrap/ s$
( t timeR R t syst version_infot absolute_importR R R
t NoneR R ( ( ( s% /usr/lib64/python2.7/bsddb/dbutils.pyt <module> s
dbutils.py 0000644 00000005624 15053607521 0006577 0 ustar 00 #------------------------------------------------------------------------
#
# Copyright (C) 2000 Autonomous Zone Industries
#
# License: This is free software. You may use this software for any
# purpose including modification/redistribution, so long as
# this header remains intact and that you do not claim any
# rights of ownership or authorship of this software. This
# software has been tested, but no warranty is expressed or
# implied.
#
# Author: Gregory P. Smith <greg@krypto.org>
#
# Note: I don't know how useful this is in reality since when a
# DBLockDeadlockError happens the current transaction is supposed to be
# aborted. If it doesn't then when the operation is attempted again
# the deadlock is still happening...
# --Robin
#
#------------------------------------------------------------------------
#
# import the time.sleep function in a namespace safe way to allow
# "from bsddb.dbutils import *"
#
from time import sleep as _sleep
import sys
absolute_import = (sys.version_info[0] >= 3)
if absolute_import :
# Because this syntaxis is not valid before Python 2.5
exec("from . import db")
else :
import db
# always sleep at least N seconds between retrys
_deadlock_MinSleepTime = 1.0/128
# never sleep more than N seconds between retrys
_deadlock_MaxSleepTime = 3.14159
# Assign a file object to this for a "sleeping" message to be written to it
# each retry
_deadlock_VerboseFile = None
def DeadlockWrap(function, *_args, **_kwargs):
"""DeadlockWrap(function, *_args, **_kwargs) - automatically retries
function in case of a database deadlock.
This is a function intended to be used to wrap database calls such
that they perform retrys with exponentially backing off sleeps in
between when a DBLockDeadlockError exception is raised.
A 'max_retries' parameter may optionally be passed to prevent it
from retrying forever (in which case the exception will be reraised).
d = DB(...)
d.open(...)
DeadlockWrap(d.put, "foo", data="bar") # set key "foo" to "bar"
"""
sleeptime = _deadlock_MinSleepTime
max_retries = _kwargs.get('max_retries', -1)
if 'max_retries' in _kwargs:
del _kwargs['max_retries']
while True:
try:
return function(*_args, **_kwargs)
except db.DBLockDeadlockError:
if _deadlock_VerboseFile:
_deadlock_VerboseFile.write(
'dbutils.DeadlockWrap: sleeping %1.3f\n' % sleeptime)
_sleep(sleeptime)
# exponential backoff in the sleep time
sleeptime *= 2
if sleeptime > _deadlock_MaxSleepTime:
sleeptime = _deadlock_MaxSleepTime
max_retries -= 1
if max_retries == -1:
raise
#------------------------------------------------------------------------
dbshelve.pyo 0000644 00000031336 15053607521 0007103 0 ustar 00 �
{fc @ s� d Z d d l Z e j d d k Z e r6 d d Un d d l Z e j d d k rd d d l Z nz e j d k r� d d l Z n\ d d l Z e j � Z e j � z) e j
d d d
d e �d d l Z Wd e j � X[ e j
Z
d � Z e j d k rd d
l m Z n d d l Z e j Z e j d e j d d d � Z d e j f d � � YZ d e f d � � YZ d d d � � YZ d S( sN Manage shelves of pickled objects using bsddb database files for the
storage.
i����Ni i s from . import dbi i t ignoret messages1 the cPickle module has been removed in Python 3.0t categoryc C s t j | d | �S( Nt protocol( t cPicklet dumps( t objectR ( ( s&