Skip to content

Commit

Permalink
Final QA (#564)
Browse files Browse the repository at this point in the history
  • Loading branch information
gahjelle authored Aug 7, 2024
1 parent da8e557 commit 5dd42f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions python-async-iterators/async_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@
class AsyncCSVIterator:
def __init__(self, path):
self.path = path
self.file_was_read = False
self.reader = None

def __aiter__(self):
return self

async def __anext__(self):
if not self.file_was_read:
if self.reader is None:
async with aiofiles.open(self.path, mode="r") as file:
lines = await file.readlines()
self.reader = csv.reader(lines)
self.file_was_read = True
try:
return next(self.reader)
except StopIteration:
Expand Down
2 changes: 1 addition & 1 deletion python-async-iterators/compress.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ async def main(directory, zip_name="output.zip"):
await archive.write(chunk)


directory = Path()
directory = Path.cwd()
asyncio.run(main(directory))

0 comments on commit 5dd42f8

Please sign in to comment.