]> git.saurik.com Git - cyql.git/commitdiff
Remove cyql.one(), using structuring assignment instead.
authorJay Freeman (saurik) <saurik@saurik.com>
Wed, 2 Feb 2011 10:41:45 +0000 (10:41 +0000)
committerJay Freeman (saurik) <saurik@saurik.com>
Wed, 2 Feb 2011 10:41:45 +0000 (10:41 +0000)
__init__.py

index 53e8de3afd683f8dacc100a44da65edd7b3e7b76..765a0825cb3780688e5cc45d9950dd33162b8dd4 100644 (file)
@@ -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):