ahk icon indicating copy to clipboard operation
ahk copied to clipboard

Use asyncio to block forever rather than time sleep

Open trajano opened this issue 1 year ago • 6 comments
trafficstars

https://stackoverflow.com/questions/78465203/internally-is-asyncio-run-forever-basically-a-while-true-loop/78465221#78465221

https://stackoverflow.com/a/78463084/242042

trajano avatar May 11 '24 20:05 trajano

Thanks for raising this. However, all code in the _sync directory is automatically generated. Changes to _sync/ must originate from _async/ changes.

(to avoid the code rewriting, you can also extract to the _utils module in the root of the package)

Sorry for you to run into this. I should probably get around to writing a contribution guide that explains all of this soon 😅

spyoungtech avatar May 11 '24 21:05 spyoungtech

Thanks for raising this. However, all code in the _sync directory is automatically generated. Changes to _sync/ must originate from _async/ changes.

Oof that's probably why when I use the requirements.txt to point to my git repo my changes are not being reflected and I was wondering WTF... because this is the second one I am doing patch work for my weekend project https://github.com/jath03/openrgb-python/pull/72 was the first and it seemed to work.

trajano avatar May 11 '24 21:05 trajano

Coverage Status

coverage: 77.477%. remained the same when pulling cdb20ba1208724698329cab8181eeeb8d799929a on trajano:patch-1 into de90e941e50a8d7e5ff60cba60d299043d3353fa on spyoungtech:main.

coveralls avatar May 11 '24 21:05 coveralls

BTW if _sync is generated why is the source present in the repo?

trajano avatar May 12 '24 03:05 trajano

It perhaps doesn't have to be committed, and I've gone back and forth on whether it should be or not, but ultimately it made it easier for linting tools, mypy, sphinx/readthedocs, etc. to all work correctly and allows someone to see the source online like, say, if they're investigating a stacktrace that points to a line in the _sync code.

spyoungtech avatar May 12 '24 05:05 spyoungtech

I yield. I am not familiar with Python enough to convert what I have to an async def when there's no await in the body.

trajano avatar May 13 '24 16:05 trajano