Skip to content

Commit f2f92c3

Browse files
committed
style: run ruff autoformat over pgasync.py
1 parent 889f176 commit f2f92c3

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

osm_rawdata/pgasync.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,13 @@ async def createTable(
293293

294294
return True
295295

296-
async def getRecordCount(self,
297-
table: str,
298-
column: str = 'id',
299-
):
296+
async def getRecordCount(
297+
self,
298+
table: str,
299+
column: str = "id",
300+
):
300301
# FIXME: we should cleanup this mess between US and British spelling
301-
if table == 'organizations':
302+
if table == "organizations":
302303
newtable = "organisations"
303304
else:
304305
newtable = table
@@ -310,15 +311,16 @@ async def getRecordCount(self,
310311
# print(sql)
311312
result = await self.execute(sql)
312313
else:
313-
count = result[0].get('count')
314+
count = result[0].get("count")
314315

315316
log.debug(f"There are {count} records in {table}")
316317
return count
317318

318-
async def getPage(self,
319-
chunk: int,
320-
table: str,
321-
):
319+
async def getPage(
320+
self,
321+
chunk: int,
322+
table: str,
323+
):
322324
"""Return a page of data.
323325
324326
Args:
@@ -330,18 +332,18 @@ async def getPage(self,
330332
"""
331333
result = list()
332334
async with self.pg.transaction():
333-
cur = await self.pg.cursor(f'SELECT * FROM {table}')
335+
cur = await self.pg.cursor(f"SELECT * FROM {table}")
334336
result = await cur.fetch(chunk)
335337
await cur.forward(chunk)
336338
# FIXME: the hard way
337339
# sql = f"DECLARE c CURSOR WITH HOLD FOR SELECT row_to_json({table}) AS row FROM {table} WHERE id BETWEEN {start} AND {end} ORDER BY id; COMMIT"
338340
# sql = f"START TRANSACTION;DECLARE c CURSOR WITH HOLD FOR SELECT row_to_json({table}) AS row FROM {table} WHERE id BETWEEN {start} AND {end} ORDER BY id; COMMIT"
339-
#result = await self.pg.execute(sql)
340-
#sql = f"FETCH {end} FROM c;"
341-
# sql = f"FETCH {end} FROM c; CLOSE c"
342-
# result = await self.pg.execute(sql)
343-
#result = await self.pg.fetch(sql)
344-
# sql = f"MOVE ABSOLUTE {start} in c;
341+
# result = await self.pg.execute(sql)
342+
# sql = f"FETCH {end} FROM c;"
343+
# sql = f"FETCH {end} FROM c; CLOSE c"
344+
# result = await self.pg.execute(sql)
345+
# result = await self.pg.fetch(sql)
346+
# sql = f"MOVE ABSOLUTE {start} in c;
345347

346348
return result
347349

0 commit comments

Comments
 (0)