[ci] auto-format

This commit is contained in:
vishal332008 2025-01-23 20:45:05 +00:00 committed by github-actions[bot]
parent 5bb972dd34
commit 5e3013990b
14 changed files with 68 additions and 54 deletions

View file

@ -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

View file

@ -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)

View file

@ -83,7 +83,7 @@ class _cmds:
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}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']:

View file

@ -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):

View file

@ -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.'
)

View file

@ -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))

View file

@ -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:

View file

@ -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,

View file

@ -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()

View file

@ -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}')

View file

@ -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('</div><div class="links-container">')]
result = data[(data.find('"result-container">'))+len('"result-container">') :data.find('</div><div class="links-container">')]
replace_list = [('&#39;', '\''), ('&quot;', '"'), ('&amp;', '&')]
for i in replace_list:
result = result.replace(i[0], i[1])

View file

@ -1516,7 +1516,7 @@ class PartyWindow(ba.Window):
self._status_text = ba.textwidget(parent=self._root_widget,
scale=0.5,
color=color,
text=f'Status:\t{user_status}',
text=f'Status: \t{user_status}',
size=(200, 30),
position=(self._width * 0.3,
self._height - 110),
@ -1850,7 +1850,7 @@ class PartyWindow(ba.Window):
if not self._private_chat:
if msg == '/id':
myid = ba.internal.get_v1_account_misc_read_val_2('resolvedAccountID', '')
_ba.chatmessage(f"My Unique ID : {myid}")
_ba.chatmessage(f"My Unique ID: {myid}")
elif msg == '/save':
info = _ba.get_connection_to_host_info()
config = ba.app.config
@ -1967,7 +1967,7 @@ class PartyWindow(ba.Window):
def _ip_port_msg(self):
try:
msg = f'IP : {_ip} PORT : {_port}'
msg = f'IP: {_ip} PORT: {_port}'
except:
msg = ''
self._edit_text_msg_box(msg, 'replace')
@ -2109,7 +2109,7 @@ class LoginWindow:
self._registrationkey_text = ba.textwidget(parent=self._root_widget,
scale=0.5,
color=(1, 1, 1),
text=f'Registration Key:',
text=f'Registration Key: ',
size=(0, 0),
position=(100, 140),
h_align='center',

View file

@ -99,7 +99,8 @@ class CategoryVersionMetadata:
for plugin_name, plugin_metadata in self.category_metadata["plugins"].items():
for version_name, version_metadata in plugin_metadata["versions"].items():
if version_metadata is None:
plugin_path = f"{os.path.join(self.category_metadata_base, f'{plugin_name}.py')}"
plugin_path = f"{os.path.join(
self.category_metadata_base, f'{plugin_name}.py')}"
yield PluginVersionMetadata(
plugin_name,
version_name,

View file

@ -157,8 +157,10 @@ class BaseCategoryMetadataTestCases:
if md5sum != version_metadata["md5sum"]:
self.fail(
f"{plugin} checksum changed;\n"
f"{version_metadata['md5sum']} (mentioned in {self.category_metadata_file}) ->\n"
f"{plugin} checksum changed
\n"
f"{version_metadata['md5sum']} (mentioned in {
self.category_metadata_file}) ->\n"
f"{md5sum} (actual)"
)
self.assertEqual(int(api_version.decode("utf-8")),
@ -177,8 +179,10 @@ class BaseCategoryMetadataTestCases:
if md5sum != latest_version_metadata["md5sum"]:
self.fail(
f"{plugin} checksum changed;\n"
f"{latest_version_metadata['md5sum']} (mentioned in {self.category_metadata_file}) ->\n"
f"{plugin} checksum changed
\n"
f"{latest_version_metadata['md5sum']} (mentioned in {
self.category_metadata_file}) ->\n"
f"{md5sum} (actual)"
)
self.assertEqual(md5sum, latest_version_metadata["md5sum"])