Fix up some types in the ecosystem code (#8898)

## Summary

Fixes up the type annotations to make type analyzers a little happier 😄 

## Test Plan

N/A
This commit is contained in:
Steve C 2023-11-30 17:02:20 -05:00 committed by GitHub
parent ee5d95f751
commit 3ee1ec70cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 14 deletions

View file

@ -53,7 +53,7 @@ async def main(
async with semaphore:
return await coroutine
comparisons: list[Exception | Comparison] = await asyncio.gather(
comparisons: list[BaseException | Comparison] = await asyncio.gather(
*[
limited_parallelism(
clone_and_compare(
@ -72,9 +72,10 @@ async def main(
comparisons_by_target = dict(zip(targets, comparisons, strict=True))
# Split comparisons into errored / completed
errored, completed = [], []
errored: list[tuple[Project, BaseException]] = []
completed: list[tuple[Project, Comparison]] = []
for target, comparison in comparisons_by_target.items():
if isinstance(comparison, Exception):
if isinstance(comparison, BaseException):
errored.append((target, comparison))
else:
completed.append((target, comparison))
@ -138,7 +139,7 @@ async def clone_and_compare(
class JSONEncoder(json.JSONEncoder):
def default(self, o):
def default(self, o: object):
if isinstance(o, Serializable):
return o.jsonable()
if dataclasses.is_dataclass(o):