diff options
author | Dylan Baker <dylan.c.baker@intel.com> | 2022-03-17 10:30:37 -0700 |
---|---|---|
committer | Dylan Baker <dylan.c.baker@intel.com> | 2022-03-23 09:10:04 -0700 |
commit | 29960e0b4ad5ca399356472aea936b98b397ac2a (patch) | |
tree | 7e41e3bf00de99e58d5ac3e23e90f29a6c8413bf /bin | |
parent | 8bd46a976bcfd9100336fe1ab32db05cd480e2f6 (diff) |
pick/core: Add proper type annotation for update_commits callback
Diffstat (limited to 'bin')
-rw-r--r-- | bin/pick/core.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/bin/pick/core.py b/bin/pick/core.py index d805a7be987..e10f7416580 100644 --- a/bin/pick/core.py +++ b/bin/pick/core.py @@ -337,7 +337,9 @@ async def resolve_fixes(commits: typing.List['Commit'], previous: typing.List['C async def gather_commits(version: str, previous: typing.List['Commit'], - new: typing.List[typing.Tuple[str, str]], cb) -> typing.List['Commit']: + new: typing.List[typing.Tuple[str, str]], + cb: typing.Optional[typing.Callable[[], None]] = None + ) -> typing.List['Commit']: # We create an array of the final size up front, then we pass that array # to the "inner" co-routine, which is turned into a list of tasks and # collected by asyncio.gather. We do this to allow the tasks to be @@ -348,9 +350,10 @@ async def gather_commits(version: str, previous: typing.List['Commit'], async def inner(commit: 'Commit', version: str, commits: typing.List[typing.Optional['Commit']], - index: int, cb) -> None: + index: int, cb: typing.Optional[typing.Callable[[], None]]) -> None: commits[index] = await resolve_nomination(commit, version) - cb() + if cb: + cb() for i, (sha, desc) in enumerate(new): tasks.append(asyncio.ensure_future( |