aiofiles icon indicating copy to clipboard operation
aiofiles copied to clipboard

Add to_a(sync)gen wrapper able to turn a sync generator function into its async variant and introduce an async version of `os.walk`.

Open stankudrow opened this issue 1 year ago • 8 comments

Closes #160 . Also may close #167 .

Features:

  • add the to_agen decorator responsible for wrapping sync iterators and turning them into asynchronous ones - analogously to the to_coro decorator that makes a coroutine from a given function
  • add an async version of the os.walk iterator with tests
  • a couple of extra unrelated minor changes

stankudrow avatar Nov 11 '24 10:11 stankudrow

https://github.com/Tinche/aiofiles/issues/160#issuecomment-2470024881 - the os.listdir already wrapped, the os.walk added.

stankudrow avatar Nov 12 '24 09:11 stankudrow

@Tinche , hello. Rebased and ready for review, all checks have been passed.

Update: I found the issue #167 on an "invented-here" solution, what are your suggestions?

stankudrow avatar Nov 12 '24 09:11 stankudrow

Apologies. I have a small baby nowadays.

So the original sync os.walk is a generator, right? This has some very useful properties which we should keep. Can we make the async version an async generator? Each step can do a step of the sync one.

Tinche avatar Dec 04 '24 04:12 Tinche

Apologies. I have a small baby nowadays.

So the original sync os.walk is a generator, right? This has some very useful properties which we should keep. Can we make the async version an async generator? Each step can do a step of the sync one.

Hello and no need for apologies, au contraire, congratulations.

stankudrow avatar Dec 08 '24 06:12 stankudrow

Waits for the #199 to be merged.

stankudrow avatar Feb 01 '25 17:02 stankudrow

Waits for the https://github.com/Tinche/aiofiles/pull/199 to be merged.

That PR has been merged now, can we please merge this one as well? 🙂

Martin005 avatar Apr 07 '25 15:04 Martin005

Waits for the #199 to be merged.

That PR has been merged now, can we please merge this one as well? 🙂

Good to go after the #213 .

stankudrow avatar Apr 25 '25 20:04 stankudrow

Memo: the "README" file must be updated.

stankudrow avatar Jun 21 '25 17:06 stankudrow