More internal return type fixes.

This commit is contained in:
Eric Froemling 2020-04-10 01:35:11 -07:00
parent 5d9e854eb8
commit 2ea4873726
3 changed files with 9 additions and 6 deletions

View File

@ -34,7 +34,7 @@ NOTE: This file was autogenerated by gendummymodule; do not edit by hand.
""" """
# (hash we can use to see if this file is out of date) # (hash we can use to see if this file is out of date)
# SOURCES_HASH=19018950468850503638731149460882909299 # SOURCES_HASH=13501269283550798144571003636886602232
# I'm sorry Pylint. I know this file saddens you. Be strong. # I'm sorry Pylint. I know this file saddens you. Be strong.
# pylint: disable=useless-suppression # pylint: disable=useless-suppression
@ -1998,7 +1998,7 @@ def get_display_resolution() -> Tuple[int, int]:
return (0, 0) return (0, 0)
def get_foreground_host_activity() -> ba.Activity: def get_foreground_host_activity() -> Optional[ba.Activity]:
"""get_foreground_host_activity() -> Optional[ba.Activity] """get_foreground_host_activity() -> Optional[ba.Activity]
(internal) (internal)
@ -2010,7 +2010,7 @@ def get_foreground_host_activity() -> ba.Activity:
return ba.Activity({}) return ba.Activity({})
def get_foreground_host_session() -> ba.Session: def get_foreground_host_session() -> Optional[ba.Session]:
"""get_foreground_host_session() -> Optional[ba.Session] """get_foreground_host_session() -> Optional[ba.Session]
(internal) (internal)

View File

@ -321,8 +321,9 @@ def call_after_ad(call: Callable[[], Any]) -> None:
if have_pro(): if have_pro():
show = False # Pro disables interstitials. show = False # Pro disables interstitials.
try: try:
is_tournament = (_ba.get_foreground_host_session().tournament_id is session = _ba.get_foreground_host_session()
not None) assert session is not None
is_tournament = session.tournament_id is not None
except Exception: except Exception:
is_tournament = False is_tournament = False
if is_tournament: if is_tournament:

View File

@ -147,7 +147,9 @@ def _reset_stress_test(args: Dict[str, Any]) -> None:
from ba._enums import TimeType from ba._enums import TimeType
_ba.set_stress_testing(False, args['player_count']) _ba.set_stress_testing(False, args['player_count'])
_ba.screenmessage('Resetting stress test...') _ba.screenmessage('Resetting stress test...')
_ba.get_foreground_host_session().end() session = _ba.get_foreground_host_session()
assert session is not None
session.end()
_ba.timer(1.0, Call(start_stress_test, args), timetype=TimeType.REAL) _ba.timer(1.0, Call(start_stress_test, args), timetype=TimeType.REAL)