@@ -40,13 +40,13 @@ class NoResultError(Exception):
40
40
41
41
async def maybe_create_tables (db ):
42
42
try :
43
- with ( await db .cursor () ) as cur :
43
+ with await db .cursor () as cur :
44
44
await cur .execute ("SELECT COUNT(*) FROM entries LIMIT 1" )
45
45
await cur .fetchone ()
46
46
except psycopg2 .ProgrammingError :
47
47
with open ("schema.sql" ) as f :
48
48
schema = f .read ()
49
- with ( await db .cursor () ) as cur :
49
+ with await db .cursor () as cur :
50
50
await cur .execute (schema )
51
51
52
52
@@ -89,7 +89,7 @@ async def execute(self, stmt, *args):
89
89
90
90
Must be called with ``await self.execute(...)``
91
91
"""
92
- with ( await self .application .db .cursor () ) as cur :
92
+ with await self .application .db .cursor () as cur :
93
93
await cur .execute (stmt , args )
94
94
95
95
async def query (self , stmt , * args ):
@@ -103,7 +103,7 @@ async def query(self, stmt, *args):
103
103
104
104
for row in await self.query(...)
105
105
"""
106
- with ( await self .application .db .cursor () ) as cur :
106
+ with await self .application .db .cursor () as cur :
107
107
await cur .execute (stmt , args )
108
108
return [self .row_to_obj (row , cur ) for row in await cur .fetchall ()]
109
109
0 commit comments