diff --git a/nvchecker/__main__.py b/nvchecker/__main__.py index 547ef13a..1f51e262 100755 --- a/nvchecker/__main__.py +++ b/nvchecker/__main__.py @@ -13,7 +13,7 @@ import structlog from . import core -from .util import VersData, RawResult, KeyManager, EntryWaiter +from .util import VersData, RawResult, Result, KeyManager, EntryWaiter from .ctxvars import proxy as ctx_proxy logger = structlog.get_logger(logger_name=__name__) @@ -80,10 +80,10 @@ def main() -> None: if sys.version_info >= (3, 10): # Python 3.10 has deprecated asyncio.get_event_loop - newvers, has_failures = asyncio.run(run(result_coro, runner_coro)) + newvers, results, has_failures = asyncio.run(run(result_coro, runner_coro)) else: # Python < 3.10 will create an eventloop when asyncio.Queue is initialized - newvers, has_failures = asyncio.get_event_loop().run_until_complete(run(result_coro, runner_coro)) + newvers, results, has_failures = asyncio.get_event_loop().run_until_complete(run(result_coro, runner_coro)) if options.ver_files is not None: newverf = options.ver_files[1] @@ -95,7 +95,7 @@ def main() -> None: sys.exit(3) async def run( - result_coro: Coroutine[None, None, Tuple[VersData, bool]], + result_coro: Coroutine[None, None, Tuple[VersData, List[Result], bool]], runner_coro: Coroutine[None, None, None], ) -> Tuple[VersData, bool]: result_fu = asyncio.create_task(result_coro) diff --git a/nvchecker/core.py b/nvchecker/core.py index 21029ae6..aca0f277 100644 --- a/nvchecker/core.py +++ b/nvchecker/core.py @@ -396,8 +396,9 @@ async def process_result( result_q: Queue[RawResult], entry_waiter: EntryWaiter, log_noop: bool = False, -) -> Tuple[VersData, bool]: +) -> Tuple[VersData, List[Result], bool]: ret = {} + results = [] has_failures = False try: while True: @@ -414,8 +415,9 @@ async def process_result( check_version_update(oldvers, r1, log_noop) entry_waiter.set_result(r1.name, r1.version) ret[r1.name] = r1.version + results.append(r1) except asyncio.CancelledError: - return ret, has_failures + return ret, results, has_failures async def run_tasks( futures: Sequence[Awaitable[None]]