From 05aed2d35991e58907377fc215f0a3c30f920307 Mon Sep 17 00:00:00 2001 From: Loup-Garou911XD Date: Thu, 23 Jan 2025 21:22:46 +0000 Subject: [PATCH] [ci] auto-format --- plugin_manager.py | 8 ++-- plugins/utilities/advanced_party_window.py | 5 ++- plugins/utilities/chat_cmd.py | 44 ++++++++++++---------- plugins/utilities/discord_richpresence.py | 6 +-- plugins/utilities/easy_connect.py | 2 +- plugins/utilities/file_share.py | 2 +- plugins/utilities/max_players.py | 2 +- plugins/utilities/sandbox.py | 17 +++++---- plugins/utilities/share_replay.py | 4 +- plugins/utilities/tag.py | 4 +- plugins/utilities/translate.py | 5 +-- plugins/utilities/ultra_party_window.py | 8 ++-- test/auto_apply_version_metadata.py | 3 +- test/test_checks.py | 12 ++++-- 14 files changed, 68 insertions(+), 54 deletions(-) diff --git a/plugin_manager.py b/plugin_manager.py index 17ecb74..a7aac7e 100644 --- a/plugin_manager.py +++ b/plugin_manager.py @@ -184,7 +184,7 @@ class DNSBlockWorkaround: urllib.request.install_opener(opener) def _resolve_using_google_dns(hostname): - response = urllib.request.urlopen(f"https://dns.google/resolve?name={hostname}") + response = urllib.request.urlopen(f"https: //dns.google/resolve?name={hostname}") response = response.read() response = json.loads(response) resolved_host = response["Answer"][0]["data"] @@ -354,7 +354,8 @@ class StartupTasks: new_supported_plugins[0:show_max_names]) )) if new_supported_plugins_count == 1: - notification_text = f"{new_supported_plugins_count} new plugin ({new_supported_plugins}) is available!" + notification_text = f"{new_supported_plugins_count} new plugin ({ + new_supported_plugins}) is available!" else: notification_text = new_supported_plugins + \ ('' if new_supported_plugins_count <= show_max_names else ' and +' + @@ -413,7 +414,8 @@ class Category: self.get_plugins(), ) except KeyError: - raise CategoryMetadataParseError(f"Failed to parse JSON; missing required fields.") + raise CategoryMetadataParseError(f"Failed to parse JSON + missing required fields.") else: return True diff --git a/plugins/utilities/advanced_party_window.py b/plugins/utilities/advanced_party_window.py index 6a1cef9..37b9362 100644 --- a/plugins/utilities/advanced_party_window.py +++ b/plugins/utilities/advanced_party_window.py @@ -168,7 +168,7 @@ class PingThread(threading.Thread): else: babase.print_exception( f'Error on gather ping ' - f'(errno={exc.errno})', once=True) + f'(errno={exc.errno})', once = True) except Exception: babase.print_exception('Error on gather ping', once=True) finally: @@ -1697,7 +1697,8 @@ def fetchAccountInfo(account, loading_widget): fdata = json.load(f) if account in fdata: servers = fdata[account] - url = f'https://{BCSSERVER}/player?key={base64.b64encode(account.encode("utf-8")).decode("utf-8")}&base64=true' + url = f'https: //{BCSSERVER}/player?key={base64.b64encode( + account.encode("utf-8")).decode("utf-8")}&base64=true' req = urllib.request.Request(url, headers={ "User-Agent": f'BS{_babase.env().get("build_number", 0)}', "Accept-Language": "en-US,en;q=0.9", }) data = urllib.request.urlopen(req) diff --git a/plugins/utilities/chat_cmd.py b/plugins/utilities/chat_cmd.py index 1fa80e9..f0aac8a 100644 --- a/plugins/utilities/chat_cmd.py +++ b/plugins/utilities/chat_cmd.py @@ -74,16 +74,16 @@ class _cmds: if n[2] == '1': cmsg('============== Help 1, Page 1 ==============') cmsg(f' your command prefix is or all commands starts with - {px}') - cmsg(f' {px}list or {px}l -- to see ids of players and execute commands') - cmsg(f' {px}uniqeid or {px}id -- to see accountid/uniqeid of player') - cmsg(f' {px}quit or {px}restart -- to restart the game') - cmsg(f' {px}mute/unmute -- to mute chat for everyone in your game') + cmsg(f' {px}list or {px}l -- to see ids of players and execute commands') + cmsg(f' {px}uniqeid or {px}id -- to see accountid/uniqeid of player') + cmsg(f' {px}quit or {px}restart -- to restart the game') + cmsg(f' {px}mute/unmute -- to mute chat for everyone in your game') elif n[2] == '2': cmsg('============== Help 1, Page 2 ==============') - cmsg(f' {px}pause -- to pause everyone in your game') - cmsg(f' {px}nv or {px}night -- to make night in your game') - cmsg(f' {px}dv or {px}day -- to make night in your game') - cmsg(f' {px}camera_mode -- to rotate camera ,repat to off') + cmsg(f' {px}pause -- to pause everyone in your game') + cmsg(f' {px}nv or {px}night -- to make night in your game') + cmsg(f' {px}dv or {px}day -- to make night in your game') + cmsg(f' {px}camera_mode -- to rotate camera, repat to off') cmsg('===========================================') elif n[0] == '2': cmsg('============================') @@ -99,11 +99,13 @@ class _cmds: cmsg(f' {px}freeze all or {px}freeze number of list | freeze the player') cmsg( f' {px}unfreeze/thaw all or {px}unfreeze/thaw number of list | unfreeze the player') - cmsg(f' {px}gloves all or {px}gloves number of list | give gloves to player') + cmsg(f' {px}gloves all or { + px}gloves number of list | give gloves to player') cmsg('============================') elif n[2] == '2': cmsg('============== Help 2 Page 2 ==============') - cmsg(f' {px}shield all or {px}shield number of list | give shield the player') + cmsg(f' {px}shield all or { + px}shield number of list | give shield the player') cmsg( f' {px}fall all or {px}fall number of list | teleport in down and fall up the player') cmsg(f' {px}curse all or {px}curse number of list | curse the player') @@ -115,7 +117,8 @@ class _cmds: cmsg('============================') elif n[2] == '3': cmsg('============== Help 2 Page 3 ==============') - cmsg(f' {px}gm all or {px}gm number of list | give bs gods like powers to player') + cmsg(f' {px}gm all or { + px}gm number of list | give bs gods like powers to player') cmsg( f' {px}sp all or {px}sp number of list | give superrrrrrr damages when punch to player') cmsg(f' {px}sleep all or {px}sleep number of list | sleep up the player') @@ -125,7 +128,8 @@ class _cmds: elif n[0] == '3': cmsg('============================') - cmsg(f" {px}d_bomb bombType | changes default bomb | do {px}d_bomb help for bomb names ") + cmsg(f" {px}d_bomb bombType | changes default bomb | do { + px}d_bomb help for bomb names ") cmsg(f' {px}dbc (number of bombs) | changes default count of player') cmsg('============================') @@ -140,7 +144,7 @@ class _cmds: elif m in [px+'uniqeid', px+'id', px+'pb-id', px+'pb', px+'accountid']: if n == []: - cmsg(f'use : {px}uniqeid number of list') + cmsg(f'use: {px}uniqeid number of list') else: try: id = session_players[int(n[0])] @@ -175,14 +179,14 @@ class _cmds: elif m in [px+'dv', px+'day']: if activity.globalsnode.tint == (1.0, 1.0, 1.0): - cmsg(f'alwardy {px}dv is on ,do {px}nv for night') + cmsg(f'alwardy {px}dv is on, do {px}nv for night') else: activity.globalsnode.tint = (1.0, 1.0, 1.0) cmsg('day mode on!') elif m in [px+'nv', px+'night']: if activity.globalsnode.tint == (0.5, 0.7, 1.0): - cmsg(f'alwardy {px}nv is on ,do {px}dv for day') + cmsg(f'alwardy {px}nv is on, do {px}dv for day') else: activity.globalsnode.tint = (0.5, 0.7, 1.0) cmsg('night mode on!') @@ -230,7 +234,7 @@ class _cmds: cmsg('could not found player') elif m in [px+'inv', px+'invisible']: if n == []: - cmsg(f'help : {px}inv all or {px}inv number of list') + cmsg(f'help: {px}inv all or {px}inv number of list') elif n[0] == 'all': for i in activity_players: body = i.actor.node @@ -268,7 +272,7 @@ class _cmds: elif m in [px+'hl', px+'headless']: if n == []: - cmsg(f'help : {px}spaz all or {px}spaz number of list') + cmsg(f'help: {px}spaz all or {px}spaz number of list') elif n[0] == 'all': for i in activity_players: body = i.actor.node @@ -310,7 +314,7 @@ class _cmds: elif m in [px+'kill', px+'die']: if n == []: - cmsg(f'Use : {px}kill all or {px}kill number of list') + cmsg(f'Use: {px}kill all or {px}kill number of list') elif n[0] == 'all': for i in activity_players: i.actor.node.handlemessage(bs.DieMessage()) @@ -360,7 +364,7 @@ class _cmds: elif m in [px+'sp', px+'superpunch']: if n == []: - cmsg(f'Use : {px}sp/superpunch all or {px}sp/superpunch number of list') + cmsg(f'Use: {px}sp/superpunch all or {px}sp/superpunch number of list') elif n[0] == 'all': for i in activity_players: if not i.actor._punch_power_scale == 15: @@ -516,7 +520,7 @@ class _cmds: elif m in [px+'d_bomb', px+'default_bomb']: if n == []: cmsg( - f'Use: {px}d_bomb/default_bomb all or {px}d_bomb number of list ,type {px}d_bomb help for help') + f'Use: {px}d_bomb/default_bomb all or {px}d_bomb number of list, type {px}d_bomb help for help') elif n[0] == 'help': cmsg("bombtypes - ['ice', 'impact', 'land_mine', 'normal', 'sticky','tnt']") elif n[0] in ['ice', 'impact', 'land_mine', 'normal', 'sticky', 'tnt']: diff --git a/plugins/utilities/discord_richpresence.py b/plugins/utilities/discord_richpresence.py index 323dc4c..804ccc1 100644 --- a/plugins/utilities/discord_richpresence.py +++ b/plugins/utilities/discord_richpresence.py @@ -413,7 +413,7 @@ def get_event_loop(force_fresh=False): self.rpc.send_data( 1, { - "nonce": f"{time.time():.20f}", + "nonce": f"{time.time(): .20f}", "cmd": "SUBSCRIBE", "evt": event, "args": args, @@ -970,9 +970,9 @@ class DiscordRP(babase.Plugin): sec = bs.time() - act._timer.getstarttime() secfmt = "" if sec < 60: - secfmt = f"{sec:.2f}" + secfmt = f"{sec: .2f}" else: - secfmt = f"{int(sec) // 60:02}:{sec:.2f}" + secfmt = f"{int(sec) // 60: 02}: {sec: .2f}" self.rpc_thread.details += f" ({secfmt})" # if isinstance(session, ba.DualTeamSession): diff --git a/plugins/utilities/easy_connect.py b/plugins/utilities/easy_connect.py index 7faf647..38061bd 100644 --- a/plugins/utilities/easy_connect.py +++ b/plugins/utilities/easy_connect.py @@ -596,7 +596,7 @@ def _update_party_lists(self) -> None: if DEBUG_PROCESSING: print( f'Sorted {len(self._parties_sorted)} parties in' - f' {time.time()-starttime:.5f}s.' + f' {time.time()-starttime: .5f}s.' ) diff --git a/plugins/utilities/file_share.py b/plugins/utilities/file_share.py index 709baad..32d9cf4 100644 --- a/plugins/utilities/file_share.py +++ b/plugins/utilities/file_share.py @@ -300,7 +300,7 @@ def handle_upload(file, callback, root_widget): # for the data to be posted. data = bytes(form) file_name = urllib.parse.quote(file_name) - r = urllib.request.Request(f'https://file.io?title={file_name}', data=data) + r = urllib.request.Request(f'https: //file.io?title={file_name}', data=data) r.add_header('Content-type', form.get_content_type()) r.add_header('Content-length', len(data)) diff --git a/plugins/utilities/max_players.py b/plugins/utilities/max_players.py index d75477f..a4bd41b 100644 --- a/plugins/utilities/max_players.py +++ b/plugins/utilities/max_players.py @@ -287,7 +287,7 @@ def _save_state(self) -> None: sel_name = 'Max Players' elif selected_tab_ids: assert len(selected_tab_ids) == 1 - sel_name = f'Tab:{selected_tab_ids[0].value}' + sel_name = f'Tab: {selected_tab_ids[0].value}' elif sel == self._tab_container: sel_name = 'TabContainer' else: diff --git a/plugins/utilities/sandbox.py b/plugins/utilities/sandbox.py index 683dbae..e7dd4c7 100644 --- a/plugins/utilities/sandbox.py +++ b/plugins/utilities/sandbox.py @@ -1559,7 +1559,8 @@ class Nice(mm.MainMenuWindow): tn.append(i) try: attr = getattr(blex, i) if i not in [ - "punch_position", "punch_velocity", "punch_momentum_linear"] else (0, 0, 0) # gay + # gay + "punch_position", "punch_velocity", "punch_momentum_linear"] else (0, 0, 0) except: attr = None typez.append(str(type(attr).__name__)) @@ -1757,7 +1758,7 @@ class Nice(mm.MainMenuWindow): v = value # string anything u like elif typ == "Texture": if value not in all_texture: - error(f"Unknown texture '{value}',\nuse 'white', 'black' or 'null' for empty ones") + error(f"Unknown texture '{value}', \nuse 'white', 'black' or 'null' for empty ones") return with ga().context: v = bs.gettexture(value) @@ -1766,7 +1767,7 @@ class Nice(mm.MainMenuWindow): with ga().context: setattr(node[1 if s.tweakz_is_node else 2], name, v) except Exception as e: - error(str(e) if str(e).strip() else f"No error info, repr(e):\n{repr(e)}") + error(str(e) if str(e).strip() else f"No error info, repr(e): \n{repr(e)}") else: ding(f"Tweaked!") s.kill(True, s.TTW) @@ -1854,9 +1855,9 @@ class Nice(mm.MainMenuWindow): f"Success! calling '{name}' (dumped to terminal)\nwith arguments {args}\noutputted: {out}") s.kill(True, s.CTW) except Exception as e: - error(str(e) if str(e).strip() else f"No error info, repr(e):\n{repr(e)}") + error(str(e) if str(e).strip() else f"No error info, repr(e): \n{repr(e)}") else: - print(f"SandBox.ByBordd: calling '{name}' outputted:\n{out}") + print(f"SandBox.ByBordd: calling '{name}' outputted: \n{out}") def drop_window(s): if ga() is None: @@ -2685,7 +2686,8 @@ class Nice(mm.MainMenuWindow): elif isinstance(a, tuple) or i == 6 or i == 11 or i == 28: k = Nice.val_attrs[i] l = bui.buttonwidget(parent=attr_sub, - label=f"{str(a[0]+0.01)[:3]} {str(a[1]+0.01)[:3]}, {str(a[2]+0.01)[:3]}", + label=f"{str(a[0]+0.01)[:3]} {str(a[1]+0.01) + [:3]}, {str(a[2]+0.01)[:3]}", scale=s.scale, size=(30, 12), color=k, @@ -3662,7 +3664,8 @@ class Nice(mm.MainMenuWindow): elif isinstance(a, tuple) or i == 6 or i == 11 or i == 28: k = val_attrs2[i] l = bui.buttonwidget(parent=mud_sub, - label=f"{str(a[0]+0.01)[:3]} {str(a[1]+0.01)[:3]}, {str(a[2]+0.01)[:3]}", + label=f"{str(a[0]+0.01)[:3]} {str(a[1]+0.01) + [:3]}, {str(a[2]+0.01)[:3]}", scale=s.scale, size=(30, 12), color=k, diff --git a/plugins/utilities/share_replay.py b/plugins/utilities/share_replay.py index c0d214f..ef3ca8d 100644 --- a/plugins/utilities/share_replay.py +++ b/plugins/utilities/share_replay.py @@ -123,7 +123,7 @@ class CommonUtilities: remove(external_dir+selected_replay) cls_inst.on_tab_select(tab_id) # updating the tab Print(selected_replay[0:-4]+" was deleted", color=red) - ConfirmWindow(text=f"Delete \"{selected_replay.split('.')[0]}\" \nfrom {'internal directory' if tab_id==MyTabId.INTERNAL else 'external directory'}?", + ConfirmWindow(text=f"Delete \"{selected_replay.split('.')[0]}\" \nfrom {'internal directory' if tab_id == MyTabId.INTERNAL else 'external directory'}?", action=do_it, cancel_is_selected=True) @@ -145,7 +145,7 @@ class Help(PopupWindow): bui.containerwidget(edit=self.root_widget, on_outside_click_call=self.close) bui.textwidget(parent=self.root_widget, position=(0, self.height * 0.7), corner_scale=1.2, color=green, - text=f"»Replays are exported to\n {external_dir}\n»Copy replays to the above folder to be able to import them into the game\n»I would love to hear from you,meet me on discord\n -LoupGarou(author)") + text=f"»Replays are exported to\n {external_dir}\n»Copy replays to the above folder to be able to import them into the game\n»I would love to hear from you, meet me on discord\n -LoupGarou(author)") def close(self): bui.getsound('swish').play() diff --git a/plugins/utilities/tag.py b/plugins/utilities/tag.py index 82ba52e..fd4086d 100644 --- a/plugins/utilities/tag.py +++ b/plugins/utilities/tag.py @@ -560,8 +560,8 @@ class CustomConfigNumberEdit: if self._callback: self._callback(self._value) babase.app.config[self._configkey[0]][self._configkey[1] - ][self._configkey[2]] = float(str(f'{self._value:.1f}')) + ][self._configkey[2]] = float(str(f'{self._value: .1f}')) babase.app.config.apply_and_commit() def _update_display(self) -> None: - bui.textwidget(edit=self.valuetext, text=f'{self._value:.1f}') + bui.textwidget(edit=self.valuetext, text=f'{self._value: .1f}') diff --git a/plugins/utilities/translate.py b/plugins/utilities/translate.py index 46c7a35..f9d3f9c 100644 --- a/plugins/utilities/translate.py +++ b/plugins/utilities/translate.py @@ -43,11 +43,10 @@ available_translate_languages.insert(0, 'Auto Detect') def translate(text, _callback, source='auto', target='en'): text = urllib.parse.quote(text) - url = f'https://translate.google.com/m?tl={target}&sl={source}&q={text}' + url = f'https: //translate.google.com/m?tl={target}&sl={source}&q={text}' request = urllib.request.Request(url) data = urllib.request.urlopen(request).read().decode('utf-8') - result = data[(data.find('"result-container">'))+len('"result-container">') - :data.find('