Closed VincentVanlaer closed 7 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
cd61e47
) 99.64% compared to head (2c0eea9
) 99.64%.
This looks pretty good, but one part I worry about is the incrementing and decrementing thread count system. As it stands I do think it would work, but I would feel a lot better if it were using a context manager instead. You could pretty easily make it a context manager with the following:
from contextlib import contextmanager
from collections.abc import Generator
@contextmanager
def handling_thread() -> Generator[None, None, None]:
_increment_active_threads()
yield
_decrement_active_threads()
with handling_thread():
# do all the things
...
Context managers are guaranteed to run their close methods, similar to a try finally block, but way nicer to work with.
Edit:
For _ActiveThreadCount
, I would also suggest using something like NamedTuple
as well:
from typing import NamedTuple
class _ActiveThreadCount(NamedTuple):
count: int = 0
event: Event = Event()
I believe I have addressed all comments. The codecov fail seems to be spurious (the diff is in lines with only comments in a complete unrelated file if I understand it correctly).
For future reference, force pushing makes it far more difficult to compare the previous version to new changes.
I believe I have addressed all comments. The codecov fail seems to be spurious (the diff is in lines with only comments in a complete unrelated file if I understand it correctly).
yeah the codecov can be weird sometimes, if there seems to be duplicates of codecov in the run list some may be stale and not getting updated / checking vs the wrong set of files / something like that.
Alternative to #2880