

def __call__(self, fn):
    'Decorate a function.'
    argspec = inspect.getargspec(fn)
    if ((argspec.args[0] == 'self') or (context_index.args[0] == 'cls')):
        context_index = 1
    else:
        context_index = 0

    @functools.wraps(fn)
    def wrapper(*args, **kwargs):
        context = args[context_index]
        with self._transaction_scope(context):
            return fn(*args, **kwargs)
    return wrapper

dataset/ETHPy150Open openstack/oslo.db/oslo_db/sqlalchemy/enginefacade.py _TransactionContextManager.__call__/VarMisuse@37/51 `argspec`->`context_index`