From 408ed285eb76440e2f859c2c81c9735eaa295540 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 2 Feb 2011 10:41:45 +0000 Subject: [PATCH] Remove cyql.one(), using structuring assignment instead. --- __init__.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/__init__.py b/__init__.py index 53e8de3..765a082 100644 --- a/__init__.py +++ b/__init__.py @@ -12,13 +12,6 @@ import psycopg2.pool psycopg2.extensions.register_type(psycopg2.extensions.UNICODE) -def one(values): - if values == None or len(values) == 0: - return None - else: - assert len(values) == 1 - return values[0] - class connect(object): def __init__(self, dsn): attempt = 0 @@ -113,7 +106,8 @@ class connect(object): return self.one_(statement) def has(self, statement): - return one(self.one_('select exists(%s)' % (statement,))) + exists, = self.one_('select exists(%s)' % (statement,)) + return exists def connected(dsn): def wrapped(method): -- 2.45.2