Skip to content

Commit

Permalink
refactor: typings (mypy)
Browse files Browse the repository at this point in the history
  • Loading branch information
hexiro committed Oct 29, 2023
1 parent 1dfa9ce commit edbcaea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions csinspect/csinspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async def run(self: CSInspect) -> None:
tasks = filter(None, (running_search_task, running_live_task))
await asyncio.gather(*tasks)

async def search_task(self: CSInspect) -> asyncio.Task | None:
async def search_task(self: CSInspect) -> asyncio.Task[None] | None:
if not ENABLE_TWITTER_SEARCH:
logger.debug("NOT STARTING: SEARCH TWEETS")
return None
Expand All @@ -103,16 +103,16 @@ async def incrementally_find_and_process_tweets() -> None:
task = asyncio.create_task(coro)
return task

async def live_task(self: CSInspect) -> asyncio.Task | None:
async def live_task(self: CSInspect) -> asyncio.Task[None] | None:
if not ENABLE_TWITTER_LIVE or self.twitter.live is None:
logger.debug("NOT STARTING: LIVE TWEETS")
return None

logger.debug("STARTING: LIVE TWEETS")
await self.twitter.live.add_rules(TWITTER_LIVE_RULES)
task = await self.twitter.live.filter(
task: asyncio.Task[None] = await self.twitter.live.filter(
expansions=TWEET_EXPANSIONS, tweet_fields=TWEET_TWEET_FIELDS, user_fields=TWEET_USER_FIELDS
)
) # type: ignore
return task

async def process_tweet(self: CSInspect, tweet: TweetWithInspectLink) -> None:
Expand Down
2 changes: 1 addition & 1 deletion csinspect/screenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async def swap_gg_screenshot(self: Screenshot, item: Item) -> bool:
return False

try:
result: SwapGGScreenshotResult = data["result"] # type: ignore[assignment]
result: SwapGGScreenshotResult = data["result"] # type: ignore[assignment, typeddict-item]
except KeyError:
logger.debug(f"SWAP.GG SCREENSHOT FAILED (No Result): {data}")
return False
Expand Down

0 comments on commit edbcaea

Please sign in to comment.