Auto formatting updates

This commit is contained in:
Eric Froemling 2020-04-25 12:46:51 -07:00
parent e4a32953db
commit f4e7354b0b
29 changed files with 120 additions and 130 deletions

View File

@ -35,10 +35,10 @@ class AppDelegate:
""" """
def create_default_game_config_ui( def create_default_game_config_ui(
self, gameclass: Type[ba.GameActivity], sessionclass: Type[ba.Session], self, gameclass: Type[ba.GameActivity],
config: Optional[Dict[str, Any]], sessionclass: Type[ba.Session], config: Optional[Dict[str, Any]],
completion_call: Callable[[Optional[Dict[str, Any]]], None] completion_call: Callable[[Optional[Dict[str, Any]]],
) -> None: None]) -> None:
"""Launch a UI to configure the given game config. """Launch a UI to configure the given game config.
It should manipulate the contents of config and call completion_call It should manipulate the contents of config and call completion_call

View File

@ -71,10 +71,10 @@ class AssetManager:
logging.warning('AssetManager dying in a started state.') logging.warning('AssetManager dying in a started state.')
def launch_gather( def launch_gather(
self, self,
packages: List[str], packages: List[str],
flavor: AssetPackageFlavor, flavor: AssetPackageFlavor,
account_token: str, account_token: str,
) -> AssetGather: ) -> AssetGather:
"""Spawn an asset-gather operation from this manager.""" """Spawn an asset-gather operation from this manager."""
print('would gather', packages, 'and flavor', flavor, 'with token', print('would gather', packages, 'and flavor', flavor, 'with token',

View File

@ -49,8 +49,10 @@ class GameActivity(Activity):
@classmethod @classmethod
def create_config_ui( def create_config_ui(
cls, sessionclass: Type[ba.Session], config: Optional[Dict[str, Any]], cls,
completion_call: Callable[[Optional[Dict[str, Any]]], None] sessionclass: Type[ba.Session],
config: Optional[Dict[str, Any]],
completion_call: Callable[[Optional[Dict[str, Any]]], None],
) -> None: ) -> None:
"""Launch an in-game UI to configure settings for a game type. """Launch an in-game UI to configure settings for a game type.

View File

@ -223,9 +223,8 @@ def get_device_value(device: ba.InputDevice, name: str) -> Any:
'triggerRun2': 6, 'triggerRun2': 6,
'buttonIgnored': 11 'buttonIgnored': 11
}.get(name, -1) }.get(name, -1)
if (devicename in [ if (devicename
'Logitech Dual Action', 'Logitech Cordless RumblePad 2' in ['Logitech Dual Action', 'Logitech Cordless RumblePad 2']):
]):
return { return {
'buttonJump': 2, 'buttonJump': 2,
'buttonPunch': 1, 'buttonPunch': 1,

View File

@ -268,9 +268,9 @@ class Chooser:
# Cycle through our non-random profiles once; after # Cycle through our non-random profiles once; after
# that, everyone gets random. # that, everyone gets random.
while (app.lobby_random_profile_index < while (app.lobby_random_profile_index <
len(profilenames) and len(profilenames)
profilenames[app.lobby_random_profile_index] in and profilenames[app.lobby_random_profile_index]
('_random', '__account__', '_edit')): in ('_random', '__account__', '_edit')):
app.lobby_random_profile_index += 1 app.lobby_random_profile_index += 1
if (app.lobby_random_profile_index < if (app.lobby_random_profile_index <
len(profilenames)): len(profilenames)):

View File

@ -167,9 +167,8 @@ class MusicController:
# out than later). # out than later).
try: try:
cfg = _ba.app.config cfg = _ba.app.config
if ('Soundtrack' in cfg and cfg['Soundtrack'] not in [ if ('Soundtrack' in cfg and cfg['Soundtrack']
'__default__', 'Default Soundtrack' not in ['__default__', 'Default Soundtrack']):
]):
self.get_music_player() self.get_music_player()
except Exception: except Exception:
from ba import _error from ba import _error

View File

@ -238,8 +238,8 @@ class ServerController:
_ba.pushcall(self.launch_server_session) _ba.pushcall(self.launch_server_session)
def _on_playlist_fetch_response( def _on_playlist_fetch_response(
self, self,
result: Optional[Dict[str, Any]], result: Optional[Dict[str, Any]],
) -> None: ) -> None:
if result is None: if result is None:
print('Error fetching playlist;' ' aborting.') print('Error fetching playlist;' ' aborting.')

View File

@ -386,9 +386,8 @@ class CoopScoreScreen(ba.Activity):
size=(350, 62), size=(350, 62),
label=ba.Lstr(resource='tournamentStandingsText') label=ba.Lstr(resource='tournamentStandingsText')
if self.session.tournament_id is not None else ba.Lstr( if self.session.tournament_id is not None else ba.Lstr(
resource='worldsBestScoresText') resource='worldsBestScoresText') if self._score_type
if self._score_type == 'points' else ba.Lstr( == 'points' else ba.Lstr(resource='worldsBestTimesText'),
resource='worldsBestTimesText'),
autoselect=True, autoselect=True,
on_activate_call=ba.WeakCall(self._ui_worlds_best), on_activate_call=ba.WeakCall(self._ui_worlds_best),
transition_delay=delay + 1.9, transition_delay=delay + 1.9,
@ -728,9 +727,8 @@ class CoopScoreScreen(ba.Activity):
v_offs = 40 v_offs = 40
txt = Text(ba.Lstr(resource='tournamentStandingsText') txt = Text(ba.Lstr(resource='tournamentStandingsText')
if self.session.tournament_id is not None else ba.Lstr( if self.session.tournament_id is not None else ba.Lstr(
resource='worldsBestScoresText') resource='worldsBestScoresText') if self._score_type
if self._score_type == 'points' else ba.Lstr( == 'points' else ba.Lstr(resource='worldsBestTimesText'),
resource='worldsBestTimesText'),
maxwidth=210, maxwidth=210,
position=(ts_h_offs - 10, ts_height / 2 + 25 + v_offs + 20), position=(ts_h_offs - 10, ts_height / 2 + 25 + v_offs + 20),
transition=Text.Transition.IN_LEFT, transition=Text.Transition.IN_LEFT,
@ -765,9 +763,8 @@ class CoopScoreScreen(ba.Activity):
ts_height = 300 ts_height = 300
ts_h_offs = -480 ts_h_offs = -480
v_offs = 40 v_offs = 40
Text(ba.Lstr(resource='yourBestScoresText') Text(ba.Lstr(resource='yourBestScoresText') if self._score_type
if self._score_type == 'points' else ba.Lstr( == 'points' else ba.Lstr(resource='yourBestTimesText'),
resource='yourBestTimesText'),
maxwidth=210, maxwidth=210,
position=(ts_h_offs - 10, ts_height / 2 + 25 + v_offs + 20), position=(ts_h_offs - 10, ts_height / 2 + 25 + v_offs + 20),
transition=Text.Transition.IN_RIGHT, transition=Text.Transition.IN_RIGHT,

View File

@ -858,11 +858,10 @@ class Bomb(ba.Actor):
except Exception: except Exception:
node_delegate = None node_delegate = None
if node: if node:
if (self.bomb_type == 'impact' if (self.bomb_type == 'impact' and
and (node is self.owner or (node is self.owner or
(isinstance(node_delegate, Bomb) (isinstance(node_delegate, Bomb) and node_delegate.bomb_type
and node_delegate.bomb_type == 'impact' == 'impact' and node_delegate.owner is self.owner))):
and node_delegate.owner is self.owner))):
return return
self.handlemessage(ExplodeMessage()) self.handlemessage(ExplodeMessage())

View File

@ -282,9 +282,8 @@ class SpazBot(basespaz.Spaz):
# Not a flag-bearer. If we're holding anything but a bomb, drop it. # Not a flag-bearer. If we're holding anything but a bomb, drop it.
if self.node.hold_node: if self.node.hold_node:
try: try:
holding_bomb = (self.node.hold_node.getnodetype() in [ holding_bomb = (self.node.hold_node.getnodetype()
'bomb', 'prop' in ['bomb', 'prop'])
])
except Exception: except Exception:
holding_bomb = False holding_bomb = False
if not holding_bomb: if not holding_bomb:

View File

@ -33,10 +33,10 @@ class AppDelegate(ba.AppDelegate):
"""Defines handlers for high level app functionality.""" """Defines handlers for high level app functionality."""
def create_default_game_config_ui( def create_default_game_config_ui(
self, gameclass: Type[ba.GameActivity], sessionclass: Type[ba.Session], self, gameclass: Type[ba.GameActivity],
config: Optional[Dict[str, Any]], sessionclass: Type[ba.Session], config: Optional[Dict[str, Any]],
completion_call: Callable[[Optional[Dict[str, Any]]], Any] completion_call: Callable[[Optional[Dict[str, Any]]],
) -> None: Any]) -> None:
"""(internal)""" """(internal)"""
# Replace the main window once we come up successfully. # Replace the main window once we come up successfully.

View File

@ -585,8 +585,8 @@ class FootballCoopGame(ba.CoopGameActivity):
for player in self.players: for player in self.players:
if player.actor: if player.actor:
assert isinstance(player.actor, playerspaz.PlayerSpaz) assert isinstance(player.actor, playerspaz.PlayerSpaz)
if (player.actor.is_alive() and if (player.actor.is_alive() and player.actor.node.hold_node
player.actor.node.hold_node == self._flag.node): == self._flag.node):
return return
flagpos = ba.Vec3(self._flag.node.position) flagpos = ba.Vec3(self._flag.node.position)

View File

@ -213,22 +213,22 @@ class AccountSettingsWindow(ba.Window):
show_signing_in_text = account_state == 'signing_in' show_signing_in_text = account_state == 'signing_in'
signing_in_text_space = 80.0 signing_in_text_space = 80.0
show_google_play_sign_in_button = ( show_google_play_sign_in_button = (account_state == 'signed_out'
account_state == 'signed_out' and 'Google Play'
and 'Google Play' in self._show_sign_in_buttons) in self._show_sign_in_buttons)
show_game_circle_sign_in_button = ( show_game_circle_sign_in_button = (account_state == 'signed_out'
account_state == 'signed_out' and 'Game Circle'
and 'Game Circle' in self._show_sign_in_buttons) in self._show_sign_in_buttons)
show_ali_sign_in_button = (account_state == 'signed_out' show_ali_sign_in_button = (account_state == 'signed_out'
and 'Ali' in self._show_sign_in_buttons) and 'Ali' in self._show_sign_in_buttons)
show_test_sign_in_button = (account_state == 'signed_out' show_test_sign_in_button = (account_state == 'signed_out'
and 'Test' in self._show_sign_in_buttons) and 'Test' in self._show_sign_in_buttons)
show_device_sign_in_button = (account_state == 'signed_out' and show_device_sign_in_button = (account_state == 'signed_out' and 'Local'
'Local' in self._show_sign_in_buttons) in self._show_sign_in_buttons)
sign_in_button_space = 70.0 sign_in_button_space = 70.0
show_game_service_button = ( show_game_service_button = (self._signed_in and account_type
self._signed_in and account_type in ['Game Center', 'Game Circle']) in ['Game Center', 'Game Circle'])
game_service_button_space = 60.0 game_service_button_space = 60.0
show_linked_accounts_text = (self._signed_in show_linked_accounts_text = (self._signed_in
@ -236,9 +236,9 @@ class AccountSettingsWindow(ba.Window):
'allowAccountLinking2', False)) 'allowAccountLinking2', False))
linked_accounts_text_space = 60.0 linked_accounts_text_space = 60.0
show_achievements_button = (self._signed_in and show_achievements_button = (self._signed_in and account_type
account_type in ('Google Play', 'Alibaba', in ('Google Play', 'Alibaba', 'Local',
'Local', 'OUYA', 'Test')) 'OUYA', 'Test'))
achievements_button_space = 60.0 achievements_button_space = 60.0
show_achievements_text = (self._signed_in show_achievements_text = (self._signed_in
@ -268,9 +268,8 @@ class AccountSettingsWindow(ba.Window):
show_unlink_accounts_button = show_link_accounts_button show_unlink_accounts_button = show_link_accounts_button
unlink_accounts_button_space = 90.0 unlink_accounts_button_space = 90.0
show_sign_out_button = ( show_sign_out_button = (self._signed_in and account_type
self._signed_in in ['Test', 'Local', 'Google Play'])
and account_type in ['Test', 'Local', 'Google Play'])
sign_out_button_space = 70.0 sign_out_button_space = 70.0
if self._subcontainer is not None: if self._subcontainer is not None:

View File

@ -234,9 +234,8 @@ class AccountViewerWindow(popup.PopupWindow):
character = ba.app.spaz_appearances.get( character = ba.app.spaz_appearances.get(
profile['character'], None) profile['character'], None)
if character is not None: if character is not None:
tint_color = (profile['color'] tint_color = (profile['color'] if 'color'
if 'color' in profile else in profile else (1, 1, 1))
(1, 1, 1))
tint2_color = (profile['highlight'] tint2_color = (profile['highlight']
if 'highlight' in profile else if 'highlight' in profile else
(1, 1, 1)) (1, 1, 1))

View File

@ -388,8 +388,8 @@ class CoopBrowserWindow(ba.Window):
ba.textwidget(edit=tbtn['prize_value_1_text'], ba.textwidget(edit=tbtn['prize_value_1_text'],
text='-' if pv1 == '' else pv1, text='-' if pv1 == '' else pv1,
scale=prize_value_scale_large if scale=prize_value_scale_large if ticket_char
ticket_char not in pv1 else prize_value_scale_small, not in pv1 else prize_value_scale_small,
position=(tbtn['button_x'] + 380 + x_offs, position=(tbtn['button_x'] + 380 + x_offs,
tbtn['button_y'] + tbtn['button_scale_y'] - tbtn['button_y'] + tbtn['button_scale_y'] -
93 + prize_y_offs)) 93 + prize_y_offs))
@ -401,8 +401,8 @@ class CoopBrowserWindow(ba.Window):
93 - 45 + prize_y_offs)) 93 - 45 + prize_y_offs))
ba.textwidget(edit=tbtn['prize_value_2_text'], ba.textwidget(edit=tbtn['prize_value_2_text'],
text=pv2, text=pv2,
scale=prize_value_scale_large if scale=prize_value_scale_large if ticket_char
ticket_char not in pv2 else prize_value_scale_small, not in pv2 else prize_value_scale_small,
position=(tbtn['button_x'] + 380 + x_offs, position=(tbtn['button_x'] + 380 + x_offs,
tbtn['button_y'] + tbtn['button_scale_y'] - tbtn['button_y'] + tbtn['button_scale_y'] -
93 - 45 + prize_y_offs)) 93 - 45 + prize_y_offs))
@ -414,8 +414,8 @@ class CoopBrowserWindow(ba.Window):
93 - 90 + prize_y_offs)) 93 - 90 + prize_y_offs))
ba.textwidget(edit=tbtn['prize_value_3_text'], ba.textwidget(edit=tbtn['prize_value_3_text'],
text=pv3, text=pv3,
scale=prize_value_scale_large if scale=prize_value_scale_large if ticket_char
ticket_char not in pv3 else prize_value_scale_small, not in pv3 else prize_value_scale_small,
position=(tbtn['button_x'] + 380 + x_offs, position=(tbtn['button_x'] + 380 + x_offs,
tbtn['button_y'] + tbtn['button_scale_y'] - tbtn['button_y'] + tbtn['button_scale_y'] -
93 - 90 + prize_y_offs)) 93 - 90 + prize_y_offs))
@ -425,12 +425,12 @@ class CoopBrowserWindow(ba.Window):
if entry['scores']: if entry['scores']:
score = tbtn['leader'] = copy.deepcopy(entry['scores'][0]) score = tbtn['leader'] = copy.deepcopy(entry['scores'][0])
leader_name = score[1] leader_name = score[1]
leader_score = ( leader_score = (ba.timestring(
ba.timestring(score[0] * 10, score[0] * 10,
centi=True, centi=True,
timeformat=ba.TimeFormat.MILLISECONDS, timeformat=ba.TimeFormat.MILLISECONDS,
suppress_format_warning=True) suppress_format_warning=True) if entry['scoreType']
if entry['scoreType'] == 'time' else str(score[0])) == 'time' else str(score[0]))
else: else:
tbtn['leader'] = None tbtn['leader'] = None

View File

@ -228,9 +228,9 @@ class FileSelectorWindow(ba.Window):
if not self._root_widget: if not self._root_widget:
return return
scrollwidget_selected = ( scrollwidget_selected = (self._scrollwidget is None
self._scrollwidget is None or self._root_widget.get_selected_child()
or self._root_widget.get_selected_child() == self._scrollwidget) == self._scrollwidget)
in_top_folder = (self._path == self._base_path) in_top_folder = (self._path == self._base_path)
hide_top_folder = in_top_folder and self._show_base_path is False hide_top_folder = in_top_folder and self._show_base_path is False

View File

@ -402,8 +402,8 @@ class MainMenuWindow(ba.Window):
scale=3.0 * t_scale) scale=3.0 * t_scale)
def _refresh_not_in_game( def _refresh_not_in_game(
self, positions: List[Tuple[float, float, float]] self, positions: List[Tuple[float, float,
) -> Tuple[float, float, float]: float]]) -> Tuple[float, float, float]:
# pylint: disable=too-many-branches # pylint: disable=too-many-branches
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
# pylint: disable=too-many-statements # pylint: disable=too-many-statements
@ -659,8 +659,8 @@ class MainMenuWindow(ba.Window):
return h, v, scale return h, v, scale
def _refresh_in_game( def _refresh_in_game(
self, positions: List[Tuple[float, float, float]] self, positions: List[Tuple[float, float,
) -> Tuple[float, float, float]: float]]) -> Tuple[float, float, float]:
# pylint: disable=too-many-branches # pylint: disable=too-many-branches
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
# pylint: disable=too-many-statements # pylint: disable=too-many-statements

View File

@ -566,8 +566,8 @@ class PlaylistBrowserWindow(ba.Window):
from bastd.ui import playoptions from bastd.ui import playoptions
# Make sure the target playlist still exists. # Make sure the target playlist still exists.
try: try:
exists = (playlist_name == '__default__' or exists = (playlist_name == '__default__' or playlist_name
playlist_name in ba.app.config[self._config_name_full]) in ba.app.config[self._config_name_full])
except Exception: except Exception:
exists = False exists = False
if not exists: if not exists:

View File

@ -268,8 +268,9 @@ class PlaylistEditWindow(ba.Window):
from bastd.ui.playlist import customizebrowser as cb from bastd.ui.playlist import customizebrowser as cb
new_name = cast(str, ba.textwidget(query=self._text_field)) new_name = cast(str, ba.textwidget(query=self._text_field))
if (new_name != self._editcontroller.get_existing_playlist_name() if (new_name != self._editcontroller.get_existing_playlist_name()
and new_name in ba.app.config[ and new_name
self._editcontroller.get_config_name() + ' Playlists']): in ba.app.config[self._editcontroller.get_config_name() +
' Playlists']):
ba.screenmessage( ba.screenmessage(
ba.Lstr(resource=self._r + '.cantSaveAlreadyExistsText')) ba.Lstr(resource=self._r + '.cantSaveAlreadyExistsText'))
ba.playsound(ba.getsound('error')) ba.playsound(ba.getsound('error'))

View File

@ -490,11 +490,10 @@ class AdvancedSettingsWindow(ba.Window):
text_scale=1.0, text_scale=1.0,
on_activate_call=self._on_benchmark_press) on_activate_call=self._on_benchmark_press)
ba.widget( ba.widget(edit=self._vr_test_button if self._vr_test_button is not None
edit=self._vr_test_button else self._net_test_button if self._net_test_button
if self._vr_test_button is not None else self._net_test_button is not None else self._benchmarks_button,
if self._net_test_button is not None else self._benchmarks_button, up_widget=cbw)
up_widget=cbw)
for child in self._subcontainer.get_children(): for child in self._subcontainer.get_children():
ba.widget(edit=child, show_buffer_bottom=30, show_buffer_top=20) ba.widget(edit=child, show_buffer_bottom=30, show_buffer_top=20)
@ -580,8 +579,8 @@ class AdvancedSettingsWindow(ba.Window):
elif sel == self._kick_idle_players_check_box.widget: elif sel == self._kick_idle_players_check_box.widget:
sel_name = 'KickIdlePlayers' sel_name = 'KickIdlePlayers'
elif (self._always_use_internal_keyboard_check_box is not None elif (self._always_use_internal_keyboard_check_box is not None
and sel == and sel
self._always_use_internal_keyboard_check_box.widget): == self._always_use_internal_keyboard_check_box.widget):
sel_name = 'AlwaysUseInternalKeyboard' sel_name = 'AlwaysUseInternalKeyboard'
elif (self._language_popup is not None elif (self._language_popup is not None
and sel == self._language_popup.get_button()): and sel == self._language_popup.get_button()):
@ -632,8 +631,8 @@ class AdvancedSettingsWindow(ba.Window):
elif sel_name == 'KickIdlePlayers': elif sel_name == 'KickIdlePlayers':
sel = self._kick_idle_players_check_box.widget sel = self._kick_idle_players_check_box.widget
elif (sel_name == 'AlwaysUseInternalKeyboard' elif (sel_name == 'AlwaysUseInternalKeyboard'
and self._always_use_internal_keyboard_check_box is and self._always_use_internal_keyboard_check_box
not None): is not None):
sel = self._always_use_internal_keyboard_check_box.widget sel = self._always_use_internal_keyboard_check_box.widget
elif (sel_name == 'Languages' elif (sel_name == 'Languages'
and self._language_popup is not None): and self._language_popup is not None):

View File

@ -497,13 +497,11 @@ class GamepadSettingsWindow(ba.Window):
# This actually shows both LR and UD. # This actually shows both LR and UD.
sval1 = (self._settings['analogStickLR' + sval1 = (self._settings['analogStickLR' +
self._ext] if 'analogStickLR' + self._ext] if 'analogStickLR' + self._ext
self._ext in self._settings else in self._settings else 5 if self._is_secondary else 1)
5 if self._is_secondary else 1)
sval2 = (self._settings['analogStickUD' + sval2 = (self._settings['analogStickUD' +
self._ext] if 'analogStickUD' + self._ext] if 'analogStickUD' + self._ext
self._ext in self._settings else in self._settings else 6 if self._is_secondary else 2)
6 if self._is_secondary else 2)
return self._input.get_axis_name( return self._input.get_axis_name(
sval1) + ' / ' + self._input.get_axis_name(sval2) sval1) + ' / ' + self._input.get_axis_name(sval2)
@ -769,13 +767,13 @@ class AwaitGamepadInputWindow(ba.Window):
"""Window for capturing a gamepad button press.""" """Window for capturing a gamepad button press."""
def __init__( def __init__(
self, self,
gamepad: ba.InputDevice, gamepad: ba.InputDevice,
button: str, button: str,
callback: Callable[[str, Dict[str, Any], AwaitGamepadInputWindow], callback: Callable[[str, Dict[str, Any], AwaitGamepadInputWindow],
Any], Any],
message: ba.Lstr = None, message: ba.Lstr = None,
message2: ba.Lstr = None): message2: ba.Lstr = None):
if message is None: if message is None:
print('AwaitGamepadInputWindow message is None!') print('AwaitGamepadInputWindow message is None!')
message = ba.Lstr( message = ba.Lstr(

View File

@ -73,10 +73,9 @@ class SoundtrackEditWindow(ba.Window):
parent=self._root_widget, parent=self._root_widget,
position=(0, self._height - 50), position=(0, self._height - 50),
size=(self._width, 25), size=(self._width, 25),
text=ba.Lstr( text=ba.Lstr(resource=self._r +
resource=self._r + ('.editSoundtrackText' if existing_soundtrack
('.editSoundtrackText' if existing_soundtrack is not None else is not None else '.newSoundtrackText')),
'.newSoundtrackText')),
color=ba.app.title_color, color=ba.app.title_color,
h_align="center", h_align="center",
v_align="center", v_align="center",

View File

@ -732,8 +732,8 @@ class StoreBrowserWindow(ba.Window):
dummy_name = '' dummy_name = ''
section['button_size'] = get_store_item_display_size( section['button_size'] = get_store_item_display_size(
dummy_name) dummy_name)
section['v_spacing'] = ( section['v_spacing'] = (-17 if self._tab
-17 if self._tab == 'characters' else 0) == 'characters' else 0)
if 'title' not in section: if 'title' not in section:
section['title'] = '' section['title'] = ''
section['x_offs'] = (130 if self._tab == 'extras' else section['x_offs'] = (130 if self._tab == 'extras' else

View File

@ -162,12 +162,11 @@ class EntityMixin:
cls=ExtendedJSONEncoder) cls=ExtendedJSONEncoder)
# When not doing pretty, go for quick and compact. # When not doing pretty, go for quick and compact.
return json.dumps( return json.dumps(data,
data, separators=(',', ':'),
separators=(',', ':'), sort_keys=(sort_keys_override if sort_keys_override
sort_keys=(sort_keys_override is not None else False),
if sort_keys_override is not None else False), cls=ExtendedJSONEncoder)
cls=ExtendedJSONEncoder)
@staticmethod @staticmethod
def json_loads(s: str) -> Any: def json_loads(s: str) -> Any:

View File

@ -109,8 +109,8 @@ def have_matching_fields(val1: CompoundValue, val2: CompoundValue) -> bool:
def get_compound_value_and_data( def get_compound_value_and_data(
obj: Union[BoundCompoundValue, CompoundValue] obj: Union[BoundCompoundValue,
) -> Tuple[CompoundValue, Any]: CompoundValue]) -> Tuple[CompoundValue, Any]:
"""Return value and data for bound or unbound compound values.""" """Return value and data for bound or unbound compound values."""
# pylint: disable=cyclic-import # pylint: disable=cyclic-import
from efro.entity._support import BoundCompoundValue from efro.entity._support import BoundCompoundValue

View File

@ -170,8 +170,9 @@ if TYPE_CHECKING:
"""Seven argument variant of call wrapper""" """Seven argument variant of call wrapper"""
def __init__( def __init__(
self, _call: Callable[[In1T, In2T, In3T, In4T, In5T, In6T, In7T], self,
OutT]): _call: Callable[[In1T, In2T, In3T, In4T, In5T, In6T, In7T],
OutT]):
... ...
def __call__(self, _arg1: In1T, _arg2: In2T, _arg3: In3T, _arg4: In4T, def __call__(self, _arg1: In1T, _arg2: In2T, _arg3: In3T, _arg4: In4T,

View File

@ -85,8 +85,8 @@ class DispatchMethodWrapper(Generic[TARG, TRET]):
# noinspection PyTypeHints, PyProtectedMember # noinspection PyTypeHints, PyProtectedMember
def dispatchmethod( def dispatchmethod(
func: Callable[[Any, TARG], TRET] func: Callable[[Any, TARG],
) -> DispatchMethodWrapper[TARG, TRET]: TRET]) -> DispatchMethodWrapper[TARG, TRET]:
"""A variation of functools.singledispatch for methods.""" """A variation of functools.singledispatch for methods."""
from functools import singledispatch, update_wrapper from functools import singledispatch, update_wrapper
origwrapper: Any = singledispatch(func) origwrapper: Any = singledispatch(func)
@ -250,8 +250,8 @@ class ValueDispatcher(Generic[TVAL, TRET]):
def valuedispatch1arg( def valuedispatch1arg(
call: Callable[[TVAL, TARG], TRET] call: Callable[[TVAL, TARG],
) -> ValueDispatcher1Arg[TVAL, TARG, TRET]: TRET]) -> ValueDispatcher1Arg[TVAL, TARG, TRET]:
"""Like valuedispatch but for functions taking an extra argument.""" """Like valuedispatch but for functions taking an extra argument."""
return ValueDispatcher1Arg(call) return ValueDispatcher1Arg(call)

View File

@ -1,5 +1,5 @@
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND --> <!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
<h4><em>last updated on 2020-04-24 for Ballistica version 1.5.0 build 20001</em></h4> <h4><em>last updated on 2020-04-25 for Ballistica version 1.5.0 build 20001</em></h4>
<p>This page documents the Python classes and functions in the 'ba' module, <p>This page documents the Python classes and functions in the 'ba' module,
which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p> which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
<hr> <hr>

View File

@ -40,7 +40,7 @@ CLREND = '\033[0m' # End.
REQUIRED_PYTHON_MODULES = [ REQUIRED_PYTHON_MODULES = [
('pylint', [2, 4, 4], None), ('pylint', [2, 4, 4], None),
('mypy', [0, 770], None), ('mypy', [0, 770], None),
('yapf', [0, 29, 0], None), ('yapf', [0, 30, 0], None),
('typing_extensions', None, None), ('typing_extensions', None, None),
('pytz', None, None), ('pytz', None, None),
('yaml', None, 'PyYAML'), ('yaml', None, 'PyYAML'),