Tightened up type checking (flipped Mypy's warn_unreachable on)

This commit is contained in:
Eric Froemling 2020-04-10 14:37:06 -07:00
parent aa853f8b18
commit 1a1a192905
34 changed files with 101 additions and 112 deletions

View File

@ -1483,6 +1483,7 @@
<w>sclx</w>
<w>scly</w>
<w>scorescreen</w>
<w>scoreteam</w>
<w>scoretxt</w>
<w>scoreval</w>
<w>scorever</w>

View File

@ -83,7 +83,7 @@ def award_local_achievement(achname: str) -> None:
"""For non-game-based achievements such as controller-connection ones."""
try:
ach = get_achievement(achname)
if ach is not None and not ach.complete:
if not ach.complete:
# Report new achievements to the game-service.
_ba.report_achievement(achname)
@ -680,7 +680,7 @@ class Achievement:
# Just piggy-back onto any current activity
# (should we use the session instead?..)
activity = _ba.getactivity(doraise=False)
activity: Optional[ba.Activity] = _ba.getactivity(doraise=False)
# If this gets called while this achievement is occupying a slot
# already, ignore it. (probably should never happen in real

View File

@ -398,13 +398,13 @@ class App:
# Gameplay.
self.teams_series_length = 7
self.ffa_series_length = 24
self.coop_session_args: dict = {}
self.coop_session_args: Dict = {}
# UI.
self.uicontroller: Optional[ba.UIController] = None
self.main_menu_window: Optional[_ba.Widget] = None # FIXME: Kill this.
self.window_states: dict = {} # FIXME: Kill this.
self.windows: dict = {} # FIXME: Kill this.
self.window_states: Dict = {} # FIXME: Kill this.
self.windows: Dict = {} # FIXME: Kill this.
self.main_window: Optional[str] = None # FIXME: Kill this.
self.main_menu_selection: Optional[str] = None # FIXME: Kill this.
self.have_party_queue_window = False
@ -416,9 +416,9 @@ class App:
self.first_main_menu = True # FIXME: Move to mainmenu class.
self.did_menu_intro = False # FIXME: Move to mainmenu class.
self.main_menu_resume_callbacks: list = [] # can probably go away
self.special_offer = None
self.league_rank_cache: dict = {}
self.tournament_info: dict = {}
self.special_offer: Optional[Dict] = None
self.league_rank_cache: Dict = {}
self.tournament_info: Dict = {}
self.account_tournament_list: Optional[Tuple[int, List[str]]] = None
self.ping_thread_count = 0
self.invite_confirm_windows: List[Any] = [] # FIXME: Don't use Any.

View File

@ -192,7 +192,7 @@ class CoopSession(Session):
# If there's *no* players left in the current activity but there *is*
# in the session, restart the activity to pull them into the game
# (or quit if they're just in the lobby).
if activity is not None and not activity.players and self.players:
if not activity.players and self.players:
# Special exception for tourney games; don't auto-restart these.
if self.tournament_id is not None:

View File

@ -97,7 +97,7 @@ def sharedobj(name: str) -> Any:
# We store these on the current context; whether its an activity or
# session.
activity = _ba.getactivity(doraise=False)
activity: Optional[ba.Activity] = _ba.getactivity(doraise=False)
if activity is not None:
# Grab shared-objs dict.

View File

@ -711,8 +711,7 @@ class CoopScoreScreen(ba.Activity):
order=self._score_order,
tournament_id=self.session.tournament_id,
score_type=self._score_type,
campaign=self._campaign.name
if self._campaign is not None else None,
campaign=self._campaign.name,
level=self._level_name)
# Apply the transactions we've been adding locally.
@ -1401,10 +1400,10 @@ class CoopScoreScreen(ba.Activity):
transition_delay=1.0).autoretain()
new_best = (best_rank > self._old_best_rank and best_rank > 0.0)
was_string = ('' if self._old_best_rank is None else ba.Lstr(
value=' ${A}',
subs=[('${A}', ba.Lstr(resource='scoreWasText')),
('${COUNT}', str(self._old_best_rank))]))
was_string = ba.Lstr(value=' ${A}',
subs=[('${A}',
ba.Lstr(resource='scoreWasText')),
('${COUNT}', str(self._old_best_rank))])
if not self._newly_complete:
Text(ba.Lstr(value='${A}${B}',
subs=[('${A}',

View File

@ -135,7 +135,8 @@ class TeamsScoreScreenActivity(ScoreScreenActivity):
if player_entry is not None:
player_records.append(player_entry)
else:
raise Exception('FIXME; CODE PATH NEEDS FIXING')
print('FIXME; CODE PATH NEEDS FIXING')
player_records = []
# player_records = [[
# _get_prec_score(p), name, p
# ] for name, p in list(self.stats.get_records().items())]

View File

@ -264,7 +264,8 @@ class ControlsGuide(ba.Actor):
# If we have a touchscreen, we only fade in if we have a player with
# an input device that is *not* the touchscreen.
touchscreen = _ba.get_input_device('TouchScreen', '#1', doraise=False)
touchscreen: Optional[ba.InputDevice] = _ba.get_input_device(
'TouchScreen', '#1', doraise=False)
if touchscreen is not None:
# We look at the session's players; not the activity's.

View File

@ -170,9 +170,7 @@ class Image(ba.Actor):
ba.animate(cmb, 'input1', keys)
ba.animate(self.node, 'opacity', o_keys)
else:
if (transition is not self.Transition.FADE_IN
and transition is not None):
ba.print_error(f'Invalid transition: "{transition}"')
assert transition is self.Transition.FADE_IN or transition is None
cmb.input0 = position[0]
cmb.input1 = position[1]
cmb.connectattr('output', self.node, 'position')

View File

@ -187,9 +187,9 @@ class SpazBot(basespaz.Spaz):
"""
assert self.node
botpt = ba.Vec3(self.node.position)
closest_dist = None
closest_vel = None
closest = None
closest_dist: Optional[float] = None
closest_vel: Optional[ba.Vec3] = None
closest: Optional[ba.Vec3] = None
assert self._player_pts is not None
for plpt, plvel in self._player_pts:
dist = (plpt - botpt).length()
@ -985,7 +985,7 @@ class BotSet:
try:
if player.is_alive():
assert isinstance(player.actor, basespaz.Spaz)
assert player.actor is not None and player.actor.node
assert player.actor.node
player_pts.append((ba.Vec3(player.actor.node.position),
ba.Vec3(player.actor.node.velocity)))
except Exception:
@ -999,7 +999,7 @@ class BotSet:
"""Immediately clear out any bots in the set."""
# Don't do this if the activity is shutting down or dead.
activity = ba.getactivity(doraise=False)
activity: Optional[ba.Activity] = ba.getactivity(doraise=False)
if activity is None or activity.is_expired():
return

View File

@ -215,9 +215,7 @@ class Text(ba.Actor):
ba.animate(cmb, 'input1', keys)
ba.animate(self.node, 'opacity', o_keys)
else:
if (transition is not self.Transition.FADE_IN
and transition is not None):
ba.print_error(f'Invalid transition: "{transition}"')
assert transition is self.Transition.FADE_IN or transition is None
cmb.input0 = position[0]
cmb.input1 = position[1]
cmb.connectattr('output', self.node, 'position')

View File

@ -45,16 +45,17 @@ class ConquestFlag(Flag):
self._team: Optional[ba.Team] = None
self.light: Optional[ba.Node] = None
def set_team(self, team: ba.Team) -> None:
"""Set the team that owns this flag."""
self._team = None if team is None else team
@property
def team(self) -> ba.Team:
"""The team that owns this flag."""
assert self._team is not None
return self._team
@team.setter
def team(self, team: ba.Team) -> None:
"""Set the team that owns this flag."""
self._team = team
# ba_meta export game
class ConquestGame(ba.TeamGameActivity):
@ -165,7 +166,7 @@ class ConquestGame(ba.TeamGameActivity):
# Give teams a flag to start with.
for i in range(len(self.teams)):
self._flags[i].set_team(self.teams[i])
self._flags[i].team = self.teams[i]
light = self._flags[i].light
assert light
node = self._flags[i].node
@ -227,9 +228,12 @@ class ConquestGame(ba.TeamGameActivity):
flag = flagnode.getdelegate()
except Exception:
return # Player may have left and his body hit the flag.
assert isinstance(player, ba.Player)
assert isinstance(flag, ConquestFlag)
assert flag.light
if flag.team is not player.team:
flag.set_team(player.team)
flag.team = player.team
flag.light.color = player.team.color
flag.node.color = player.team.color
self.stats.player_scored(player, 10, screenmessage=False)

View File

@ -590,8 +590,8 @@ class FootballCoopGame(ba.CoopGameActivity):
return
flagpos = ba.Vec3(self._flag.node.position)
closest_bot = None
closest_dist = None
closest_bot: Optional[spazbot.SpazBot] = None
closest_dist = 0.0 # Always gets assigned first time through.
for bot in bots:
# If a bot is picked up, he should forget about the flag.
if bot.held_count > 0:
@ -600,8 +600,8 @@ class FootballCoopGame(ba.CoopGameActivity):
botpos = ba.Vec3(bot.node.position)
botdist = (botpos - flagpos).length()
if closest_bot is None or botdist < closest_dist:
closest_dist = botdist
closest_bot = bot
closest_dist = botdist
if closest_bot is not None:
closest_bot.target_flag = self._flag

View File

@ -959,9 +959,9 @@ class OnslaughtGame(ba.CoopGameActivity):
max_dudes, group_count,
max_level)
all_entries: List[Dict[str, Any]] = []
all_entries: List[Optional[Dict[str, Any]]] = []
for group in distribution:
entries: List[Dict[str, Any]] = []
entries: List[Optional[Dict[str, Any]]] = []
for entry in group:
bot_level = bot_levels[entry[0] - 1]
bot_type = bot_level[random.randrange(len(bot_level))]

View File

@ -139,7 +139,7 @@ class RaceGame(ba.TeamGameActivity):
self._score_sound = ba.getsound('score')
self._swipsound = ba.getsound('swip')
self._last_team_time: Optional[float] = None
self._front_race_region = None
self._front_race_region: Optional[int] = None
self._nub_tex = ba.gettexture('nub')
self._beep_1_sound = ba.getsound('raceBeep1')
self._beep_2_sound = ba.getsound('raceBeep2')
@ -190,7 +190,7 @@ class RaceGame(ba.TeamGameActivity):
def _flash_player(self, player: ba.Player, scale: float) -> None:
assert isinstance(player.actor, PlayerSpaz)
assert player.actor is not None and player.actor.node
assert player.actor.node
pos = player.actor.node.position
light = ba.newnode('light',
attrs={
@ -213,9 +213,11 @@ class RaceGame(ba.TeamGameActivity):
player = playernode.getdelegate().getplayer()
except Exception:
player = None
assert isinstance(player, ba.Player)
region = region_node.getdelegate()
if not player or not region:
return
assert isinstance(region, RaceRegion)
last_region = player.gamedata['last_region']
this_region = region.index
@ -227,6 +229,7 @@ class RaceGame(ba.TeamGameActivity):
# blown over a region, etc).
if this_region > last_region + 2:
if player.is_alive():
assert player.actor
player.actor.handlemessage(ba.DieMessage())
ba.screenmessage(ba.Lstr(
translate=('statements', 'Killing ${NAME} for'
@ -273,6 +276,7 @@ class RaceGame(ba.TeamGameActivity):
# Flash where the player is.
self._flash_player(player, 1.0)
player.gamedata['finished'] = True
assert player.actor
player.actor.handlemessage(
ba.DieMessage(immediate=True))
@ -305,6 +309,7 @@ class RaceGame(ba.TeamGameActivity):
# Print their lap number over their head.
try:
assert isinstance(player.actor, PlayerSpaz)
mathnode = ba.newnode('math',
owner=player.actor.node,
attrs={
@ -529,7 +534,7 @@ class RaceGame(ba.TeamGameActivity):
pos: Optional[ba.Vec3]
try:
assert isinstance(player.actor, PlayerSpaz)
assert player.actor is not None and player.actor.node
assert player.actor.node
pos = ba.Vec3(player.actor.node.position)
except Exception:
pos = None

View File

@ -725,7 +725,7 @@ class RunaroundGame(ba.CoopGameActivity):
t_sec = 0.0
base_delay = 0.5
delay = 0.0
bot_types: List[Dict[str, Any]] = []
bot_types: List[Optional[Dict[str, Any]]] = []
if self._preset in ['endless', 'endless_tournament']:
level = self._wave

View File

@ -198,7 +198,7 @@ class TheLastStandGame(ba.CoopGameActivity):
try:
if player.is_alive():
assert isinstance(player.actor, playerspaz.PlayerSpaz)
assert player.actor is not None and player.actor.node
assert player.actor.node
playerpts.append(player.actor.node.position)
except Exception as exc:
print('ERROR in _update_bots', exc)

View File

@ -243,8 +243,7 @@ class TutorialActivity(ba.Activity):
ba.set_analytics_screen('Tutorial Start')
_ba.increment_analytics_count('Tutorial start')
# noinspection PyUnreachableCode
if 0: # pylint: disable=using-constant-test
if bool(False):
# Buttons on top.
text_y = 140
buttons_y = 250

View File

@ -322,6 +322,7 @@ def handle_app_invites_press(force_code: bool = False) -> None:
'enableAppInvites', False) and not app.on_tv)
if force_code:
do_app_invites = False
# FIXME: Should update this to grab a code before showing the invite UI.
if do_app_invites:
AppInviteWindow()
@ -330,7 +331,7 @@ def handle_app_invites_press(force_code: bool = False) -> None:
ba.Lstr(resource='gatherWindow.requestingAPromoCodeText'),
color=(0, 1, 0))
def handle_result(result: Dict[str, Any]) -> None:
def handle_result(result: Optional[Dict[str, Any]]) -> None:
with ba.Context('ui'):
if result is None:
ba.screenmessage(ba.Lstr(resource='errorText'),

View File

@ -357,19 +357,14 @@ class CoopBrowserWindow(ba.Window):
# Update all of our tourney buttons based on whats in data.
for i, tbtn in enumerate(self._tournament_buttons):
entry: Optional[Dict[str, Any]]
try:
assert data is not None
entry = data[i]
except Exception:
entry = None
prize_y_offs = (0 if entry is None else 34 if 'prizeRange3' in
entry else 20 if 'prizeRange2' in entry else 12)
assert data is not None
entry: Dict[str, Any] = data[i]
prize_y_offs = (34 if 'prizeRange3' in entry else
20 if 'prizeRange2' in entry else 12)
x_offs = 90
# This seems to be a false alarm.
# pylint: disable=unbalanced-tuple-unpacking
assert entry is not None
pr1, pv1, pr2, pv2, pr3, pv3 = (
get_tournament_prize_strings(entry))
# pylint: enable=unbalanced-tuple-unpacking
@ -427,7 +422,7 @@ class CoopBrowserWindow(ba.Window):
leader_name = '-'
leader_score: Union[str, ba.Lstr] = '-'
if entry is not None and entry['scores']:
if entry['scores']:
score = tbtn['leader'] = copy.deepcopy(entry['scores'][0])
leader_name = score[1]
leader_score = (
@ -441,15 +436,13 @@ class CoopBrowserWindow(ba.Window):
ba.textwidget(edit=tbtn['current_leader_name_text'],
text=ba.Lstr(value=leader_name))
self._tournament_leader_score_type = (None if entry is None else
entry['scoreType'])
self._tournament_leader_score_type = (entry['scoreType'])
ba.textwidget(edit=tbtn['current_leader_score_text'],
text=leader_score)
ba.buttonwidget(edit=tbtn['more_scores_button'],
label='-' if entry is None else ba.Lstr(
resource=self._r + '.seeMoreText'))
label=ba.Lstr(resource=self._r + '.seeMoreText'))
out_of_time_text: Union[str, ba.Lstr] = (
'-' if entry is None or 'totalTime' not in entry else ba.Lstr(
'-' if 'totalTime' not in entry else ba.Lstr(
resource=self._r + '.ofTotalTimeText',
subs=[('${TOTAL}',
ba.timestring(entry['totalTime'],
@ -458,16 +451,13 @@ class CoopBrowserWindow(ba.Window):
ba.textwidget(edit=tbtn['time_remaining_out_of_text'],
text=out_of_time_text)
tbtn['time_remaining'] = 0 if entry is None else entry[
'timeRemaining']
tbtn['time_remaining'] = entry['timeRemaining']
tbtn['has_time_remaining'] = entry is not None
tbtn['tournament_id'] = (None if entry is None else
entry['tournamentID'])
tbtn['tournament_id'] = entry['tournamentID']
tbtn['required_league'] = (None if 'requiredLeague' not in entry
else entry['requiredLeague'])
game = (None if entry is None else
ba.app.tournament_info[tbtn['tournament_id']]['game'])
game = ba.app.tournament_info[tbtn['tournament_id']]['game']
if game is None:
ba.textwidget(edit=tbtn['button_text'], text='-')
@ -491,7 +481,7 @@ class CoopBrowserWindow(ba.Window):
levelname).get_preview_texture(),
opacity=1.0 if enabled else 0.5)
fee = None if entry is None else entry['fee']
fee = entry['fee']
if fee is None:
fee_var = None

View File

@ -149,7 +149,7 @@ class GatherWindow(ba.Window):
tabs_def: List[Tuple[str, ba.Lstr]] = [
('about', ba.Lstr(resource=self._r + '.aboutText'))
]
if True and _ba.get_account_misc_read_val('enablePublicParties', True):
if _ba.get_account_misc_read_val('enablePublicParties', True):
tabs_def.append(
('internet', ba.Lstr(resource=self._r + '.internetText')))
if platform == 'android' and subplatform == 'google':

View File

@ -203,8 +203,7 @@ class KioskWindow(ba.Window):
self._b5: Optional[ba.Widget]
self._b6: Optional[ba.Widget]
# noinspection PyUnreachableCode
if False: # pylint: disable=using-constant-test
if bool(False):
ba.textwidget(
parent=self._root_widget,
size=(0, 0),
@ -312,8 +311,7 @@ class KioskWindow(ba.Window):
self._b4 = self._b5 = self._b6 = None
self._b7: Optional[ba.Widget]
# noinspection PyUnreachableCode
if False: # pylint: disable=using-constant-test
if bool(False):
self._b7 = ba.buttonwidget(
parent=self._root_widget,
autoselect=True,

View File

@ -134,7 +134,7 @@ class LeagueRankWindow(ba.Window):
self._season_popup_menu: Optional[popup_ui.PopupMenu] = None
self._requested_season: Optional[str] = None
self._season = None
self._season: Optional[str] = None
# take note of our account state; we'll refresh later if this changes
self._account_state = _ba.get_account_state()

View File

@ -293,7 +293,7 @@ class PartyQueueWindow(ba.Window):
"""(internal)"""
return self._line_bottom
def on_account_press(self, account_id: str,
def on_account_press(self, account_id: Optional[str],
origin_widget: ba.Widget) -> None:
"""A dude was clicked so we should show his account info."""
from bastd.ui.account import viewer

View File

@ -30,7 +30,7 @@ import _ba
import ba
if TYPE_CHECKING:
from typing import Any, Type, Optional, Tuple, List
from typing import Any, Type, Optional, Tuple, List, Dict
class PlaylistCustomizeBrowserWindow(ba.Window):
@ -562,6 +562,7 @@ class PlaylistCustomizeBrowserWindow(ba.Window):
return
if self._selected_playlist_name is None:
return
plst: Optional[List[Dict[str, Any]]]
if self._selected_playlist_name == '__default__':
plst = self._pvars.get_default_list_call()
else:

View File

@ -30,7 +30,7 @@ import _ba
import ba
if TYPE_CHECKING:
from typing import Type, Any, Dict, Callable, Optional, Union
from typing import Type, Any, Dict, Callable, Optional, Union, List
class PlaylistEditGameWindow(ba.Window):
@ -197,7 +197,7 @@ class PlaylistEditGameWindow(ba.Window):
# Keep track of all the selectable widgets we make so we can wire
# them up conveniently.
widget_column = []
widget_column: List[List[ba.Widget]] = []
# Map select button.
ba.textwidget(parent=self._subcontainer,
@ -419,16 +419,17 @@ class PlaylistEditGameWindow(ba.Window):
else:
raise Exception()
# ok now wire up the column
# Ok now wire up the column.
try:
# pylint: disable=unsubscriptable-object
prev_widgets = None
prev_widgets: Optional[List[ba.Widget]] = None
for cwdg in widget_column:
if prev_widgets is not None:
# wire our rightmost to their rightmost
# Wire our rightmost to their rightmost.
ba.widget(edit=prev_widgets[-1], down_widget=cwdg[-1])
ba.widget(cwdg[-1], up_widget=prev_widgets[-1])
# wire our leftmost to their leftmost
# Wire our leftmost to their leftmost.
ba.widget(edit=prev_widgets[0], down_widget=cwdg[0])
ba.widget(cwdg[0], up_widget=prev_widgets[0])
prev_widgets = cwdg
@ -452,14 +453,14 @@ class PlaylistEditGameWindow(ba.Window):
def _select_map(self) -> None:
# pylint: disable=cyclic-import
from bastd.ui.playlist import mapselect
from bastd.ui.playlist.mapselect import PlaylistMapSelectWindow
# Replace ourself with the map-select UI.
ba.containerwidget(edit=self._root_widget, transition='out_left')
ba.app.main_menu_window = (mapselect.PlaylistMapSelectWindow(
ba.app.main_menu_window = PlaylistMapSelectWindow(
self._gameclass, self._sessiontype,
copy.deepcopy(self._getconfig()), self._edit_info,
self._completion_call).get_root_widget())
self._completion_call).get_root_widget()
def _choice_inc(self, setting_name: str, widget: ba.Widget,
setting: Dict[str, Any], increment: int) -> None:

View File

@ -141,14 +141,7 @@ class PopupMenuWindow(PopupWindow):
# we need to flatten them.
choices_display_fin: List[str] = []
for choice_display in choices_display:
if isinstance(choice_display, ba.Lstr):
choices_display_fin.append(choice_display.evaluate())
else:
ba.print_error(
'PopupMenuWindow got a raw string in \'choices_display\';'
' please pass ba.Lstr values only',
once=True)
choices_display_fin.append(choice_display)
choices_display_fin.append(choice_display.evaluate())
if maxwidth is None:
maxwidth = width * 1.5

View File

@ -69,7 +69,7 @@ class AdvancedSettingsWindow(ba.Window):
stack_offset=(0, -25) if app.small_ui else (0, 0)))
self._prev_lang = ""
self._prev_lang_list: List[str] = []
self._complete_langs_list = None
self._complete_langs_list: Optional[List] = None
self._complete_langs_error = False
self._language_popup: Optional[popup_ui.PopupMenu] = None

View File

@ -103,8 +103,7 @@ class ControlsSettingsWindow(ba.Window):
show_space_2 = True
height += space_height
# noinspection PyUnreachableCode
if True: # pylint: disable=using-constant-test
if bool(True):
show_remote = True
height += spacing
else:

View File

@ -289,10 +289,7 @@ class SoundtrackBrowserWindow(ba.Window):
copy_word = copy_text.replace('${NAME}', '').strip()
base_name = self._get_soundtrack_display_name(
self._selected_soundtrack).evaluate()
if not isinstance(base_name, str):
print('expected uni base_name 3fj0')
assert isinstance(base_name, bytes)
base_name = base_name.decode('utf-8')
assert isinstance(base_name, str)
# If it looks like a copy, strip digits and spaces off the end.
if copy_word in base_name:

View File

@ -205,8 +205,8 @@ class SoundtrackEditWindow(ba.Window):
]
# FIXME: We should probably convert this to use translations.
type_names_translated = get_resource('soundtrackTypeNames')
prev_type_button = None
prev_test_button = None
prev_type_button: Optional[ba.Widget] = None
prev_test_button: Optional[ba.Widget] = None
for index, song_type in enumerate(types):
row = ba.rowwidget(parent=self._col, size=(self._width - 40, 40))

View File

@ -31,7 +31,8 @@ import _ba
import ba
if TYPE_CHECKING:
from typing import Any, Callable, Optional, Tuple, Dict, Union, Sequence
from typing import (Any, Callable, Optional, Tuple, Dict, Union, Sequence,
List)
class StoreBrowserWindow(ba.Window):
@ -850,7 +851,7 @@ class StoreBrowserWindow(ba.Window):
maxwidth=700,
transition_delay=0.4)
prev_row_buttons = None
prev_row_buttons: Optional[List] = None
this_row_buttons = []
delay = 0.3

View File

@ -518,10 +518,10 @@ class TournamentEntryWindow(popup.PopupWindow):
try:
ticket_count = _ba.get_account_ticket_count()
except Exception:
# FIXME: should add a ba.NotSignedInError we can use here.
ticket_count = None
ticket_cost = self._purchase_price
if (ticket_count is not None and ticket_cost is not None
and ticket_count < ticket_cost):
if ticket_count is not None and ticket_count < ticket_cost:
getcurrency.show_get_tickets_prompt()
ba.playsound(ba.getsound('error'))
return

View File

@ -644,10 +644,12 @@ def _run_idea_inspections(projroot: Path,
if result.returncode != 0:
# In verbose mode this stuff got printed already.
if not verbose:
stdout = (result.stdout.decode() if isinstance( # type: ignore
result.stdout, bytes) else str(result.stdout))
stderr = (result.stderr.decode() if isinstance( # type: ignore
result.stdout, bytes) else str(result.stdout))
stdout = (
result.stdout.decode() if isinstance( # type: ignore
result.stdout, bytes) else str(result.stdout))
stderr = (
result.stderr.decode() if isinstance( # type: ignore
result.stdout, bytes) else str(result.stdout))
print(f'{displayname} inspection failure stdout:\n{stdout}' +
f'{displayname} inspection failure stderr:\n{stderr}')
raise RuntimeError(f"{displayname} inspection failed.")