From: Jay Freeman (saurik) Date: Wed, 2 Feb 2011 10:41:45 +0000 (+0000) Subject: Remove cyql.one(), using structuring assignment instead. X-Git-Url: https://git.saurik.com/cyql.git/commitdiff_plain/408ed285eb76440e2f859c2c81c9735eaa295540 Remove cyql.one(), using structuring assignment instead. --- 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):