[ci] auto-format

This commit is contained in:
brostosjoined 2023-07-21 09:03:10 +00:00 committed by github-actions[bot]
parent e17dccdaa9
commit 97885d7952

View file

@ -253,11 +253,10 @@ def get_event_loop(force_fresh=False):
with open(Path(f"{getcwd()}/ba_data/python/pypresence/utils.py"), "w") as file: with open(Path(f"{getcwd()}/ba_data/python/pypresence/utils.py"), "w") as file:
for number, line in enumerate(data): for number, line in enumerate(data):
if number not in range(46,56): if number not in range(46, 56):
file.write(line) file.write(line)
get_module() get_module()
from pypresence import PipeClosed, DiscordError, DiscordNotFound from pypresence import PipeClosed, DiscordError, DiscordNotFound
from pypresence.utils import get_event_loop from pypresence.utils import get_event_loop
import pypresence import pypresence
@ -325,7 +324,7 @@ def get_event_loop(force_fresh=False):
@staticmethod @staticmethod
def is_discord_running(): def is_discord_running():
for i in range(6463,6473): for i in range(6463, 6473):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(0.01) s.settimeout(0.01)
try: try:
@ -333,10 +332,10 @@ def get_event_loop(force_fresh=False):
s.close() s.close()
if (conn == 0): if (conn == 0):
s.close() s.close()
return(True) return (True)
except: except:
s.close() s.close()
return(False) return (False)
def _generate_join_secret(self): def _generate_join_secret(self):
# resp = requests.get('https://legacy.ballistica.net/bsAccessCheck').text # resp = requests.get('https://legacy.ballistica.net/bsAccessCheck').text
@ -404,7 +403,6 @@ def get_event_loop(force_fresh=False):
# except Exception: # except Exception:
# print_error("failed to update presence", include_exception= True) # print_error("failed to update presence", include_exception= True)
def _reconnect(self) -> None: def _reconnect(self) -> None:
self.rpc.connect() self.rpc.connect()
self._subscribe_events() self._subscribe_events()
@ -510,9 +508,6 @@ class Discordlogin(PopupWindow):
log_btn_colour = (0.10, 0.95, 0.10) if not self.path.exists() else (1.00, 0.15, 0.15) log_btn_colour = (0.10, 0.95, 0.10) if not self.path.exists() else (1.00, 0.15, 0.15)
log_txt = "LOG IN" if not self.path.exists() else "LOG OUT" log_txt = "LOG IN" if not self.path.exists() else "LOG OUT"
# creates our _root_widget # creates our _root_widget
PopupWindow.__init__(self, PopupWindow.__init__(self,
position=(0.0, 0.0), position=(0.0, 0.0),
@ -521,7 +516,6 @@ class Discordlogin(PopupWindow):
if _uiscale is babase.UIScale.MEDIUM else 1.0), if _uiscale is babase.UIScale.MEDIUM else 1.0),
bg_color=bg_color) bg_color=bg_color)
self._cancel_button = bui.buttonwidget( self._cancel_button = bui.buttonwidget(
parent=self.root_widget, parent=self.root_widget,
position=(25, self._height - 40), position=(25, self._height - 40),
@ -534,16 +528,12 @@ class Discordlogin(PopupWindow):
icon=bui.gettexture('crossOut'), icon=bui.gettexture('crossOut'),
iconscale=1.2) iconscale=1.2)
bui.imagewidget(parent=self.root_widget, bui.imagewidget(parent=self.root_widget,
position=(180, self._height - 55), position=(180, self._height - 55),
size=(32 * s, 32 * s), size=(32 * s, 32 * s),
texture=bui.gettexture("discordLogo"), texture=bui.gettexture("discordLogo"),
color=(10 - 0.32, 10 - 0.39, 10 - 0.96)) color=(10 - 0.32, 10 - 0.39, 10 - 0.96))
self.email_widget = bui.textwidget(parent=self.root_widget, self.email_widget = bui.textwidget(parent=self.root_widget,
text="Email/Phone Number", text="Email/Phone Number",
size=(400, 70), size=(400, 70),
@ -555,7 +545,6 @@ class Discordlogin(PopupWindow):
autoselect=True, autoselect=True,
maxwidth=220) maxwidth=220)
self.password_widget = bui.textwidget(parent=self.root_widget, self.password_widget = bui.textwidget(parent=self.root_widget,
text="Password", text="Password",
size=(400, 70), size=(400, 70),
@ -567,7 +556,6 @@ class Discordlogin(PopupWindow):
autoselect=True, autoselect=True,
maxwidth=220) maxwidth=220)
bui.containerwidget(edit=self.root_widget, bui.containerwidget(edit=self.root_widget,
cancel_button=self._cancel_button) cancel_button=self._cancel_button)
@ -593,7 +581,6 @@ class Discordlogin(PopupWindow):
maxwidth=200, maxwidth=200,
color=(1.00, 0.15, 0.15)) color=(1.00, 0.15, 0.15))
self._login_button = bui.buttonwidget( self._login_button = bui.buttonwidget(
parent=self.root_widget, parent=self.root_widget,
position=(120, 65), position=(120, 65),
@ -660,6 +647,8 @@ class Discordlogin(PopupWindow):
run_once = False run_once = False
def get_once_asset(): def get_once_asset():
global run_once global run_once
if run_once: if run_once:
@ -687,6 +676,7 @@ def get_once_asset():
pass pass
run_once = True run_once = True
def get_class(): def get_class():
if ANDROID: if ANDROID:
return PresenceUpdate() return PresenceUpdate()
@ -742,8 +732,6 @@ class DiscordRP(babase.Plugin):
# if Path(f"{getcwd()}/token.txt").exists(): # if Path(f"{getcwd()}/token.txt").exists():
# threading.Thread(target=ws.run_forever, daemon=True, name="websocket").start() # threading.Thread(target=ws.run_forever, daemon=True, name="websocket").start()
def _get_current_activity_name(self) -> str | None: def _get_current_activity_name(self) -> str | None:
act = bs.get_foreground_host_activity() act = bs.get_foreground_host_activity()
if isinstance(act, bs.GameActivity): if isinstance(act, bs.GameActivity):
@ -829,7 +817,7 @@ class DiscordRP(babase.Plugin):
self.rpc_thread.state = servername[slice(19)] self.rpc_thread.state = servername[slice(19)]
if connection_info == {}: if connection_info == {}:
self.rpc_thread.details = "Local" #! replace with something like ballistica github cause self.rpc_thread.details = "Local" # ! replace with something like ballistica github cause
self.rpc_thread.state = self._get_current_activity_name() self.rpc_thread.state = self._get_current_activity_name()
self.rpc_thread.party_size = max(1, len(roster)) self.rpc_thread.party_size = max(1, len(roster))
self.rpc_thread.party_max = max(1, bs.get_public_party_max_size()) self.rpc_thread.party_max = max(1, bs.get_public_party_max_size())
@ -842,7 +830,7 @@ class DiscordRP(babase.Plugin):
bs.get_foreground_host_session() bs.get_foreground_host_session()
.__class__.__name__.replace("MainMenuSession", "") .__class__.__name__.replace("MainMenuSession", "")
.replace("EndSession", "") .replace("EndSession", "")
.replace("FreeForAllSession", ": FFA") #! for session use small image key .replace("FreeForAllSession", ": FFA") # ! for session use small image key
.replace("DualTeamSession", ": Teams") .replace("DualTeamSession", ": Teams")
.replace("CoopSession", ": Coop") .replace("CoopSession", ": Coop")
) )
@ -915,4 +903,3 @@ class DiscordRP(babase.Plugin):
) )
if ANDROID and Path(f"{getcwd()}/token.txt").exists(): if ANDROID and Path(f"{getcwd()}/token.txt").exists():
self.rpc_thread.presence() self.rpc_thread.presence()