Skip to content

Commit fd5c8de

Browse files
committed
address review
1 parent cb0ede9 commit fd5c8de

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

gridfs/asynchronous/grid_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ async def get_version(
231231
try:
232232
doc = await anext(cursor)
233233
return AsyncGridOut(self._collection, file_document=doc, session=session)
234-
except (StopIteration, StopAsyncIteration):
234+
except StopAsyncIteration:
235235
raise NoFile("no version %d for filename %r" % (version, filename)) from None
236236

237237
async def get_last_version(

test/asynchronous/test_gridfs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,20 @@ def run(self):
7575
assert data == b"hello"
7676
else:
7777

78-
class JustWrite(asyncio.Task):
78+
class JustWrite:
7979
def __init__(self, fs, n):
8080
async def run():
8181
for _ in range(self.n):
8282
file = self.fs.new_file(filename="test")
8383
await file.write(b"hello")
8484
await file.close()
8585

86-
asyncio.Task.__init__(self, run())
86+
self.task = asyncio.create_task(run())
8787
self.fs = fs
8888
self.n = n
8989
self.daemon = True
9090

91-
class JustRead(asyncio.Task):
91+
class JustRead:
9292
def __init__(self, fs, n, results):
9393
async def run():
9494
for _ in range(self.n):
@@ -97,7 +97,7 @@ async def run():
9797
self.results.append(data)
9898
assert data == b"hello"
9999

100-
asyncio.Task.__init__(self, run())
100+
self.task = asyncio.create_task(run())
101101
self.fs = fs
102102
self.n = n
103103
self.results = results

test/test_gridfs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,20 @@ def run(self):
7575
assert data == b"hello"
7676
else:
7777

78-
class JustWrite(asyncio.Task):
78+
class JustWrite:
7979
def __init__(self, fs, n):
8080
def run():
8181
for _ in range(self.n):
8282
file = self.fs.new_file(filename="test")
8383
file.write(b"hello")
8484
file.close()
8585

86-
asyncio.Task.__init__(self, run())
86+
self.task = asyncio.create_task(run())
8787
self.fs = fs
8888
self.n = n
8989
self.daemon = True
9090

91-
class JustRead(asyncio.Task):
91+
class JustRead:
9292
def __init__(self, fs, n, results):
9393
def run():
9494
for _ in range(self.n):
@@ -97,7 +97,7 @@ def run():
9797
self.results.append(data)
9898
assert data == b"hello"
9999

100-
asyncio.Task.__init__(self, run())
100+
self.task = asyncio.create_task(run())
101101
self.fs = fs
102102
self.n = n
103103
self.results = results

0 commit comments

Comments
 (0)