From 83f103e2f607ad32ec9ff47f0c5a2b458f3f760c Mon Sep 17 00:00:00 2001 From: Eion Dailey Date: Wed, 30 Oct 2024 18:14:36 -0400 Subject: [PATCH] How many times do we have to teach you this less old man?! Fix Python not liking certain line endings and stuff --- src/Helpers/TSHCountryHelper.py | 6 ++---- src/TSHGameAssetManager.py | 9 +++------ src/TSHScoreboardPlayerWidget.py | 3 +-- src/TSHScoreboardWidget.py | 6 ++---- src/TournamentDataProvider/ChallongeDataProvider.py | 9 +++------ src/TournamentDataProvider/StartGGDataProvider.py | 6 ++---- src/TournamentStreamHelper.py | 3 +-- 7 files changed, 14 insertions(+), 28 deletions(-) diff --git a/src/Helpers/TSHCountryHelper.py b/src/Helpers/TSHCountryHelper.py index 58e43770d..6815257d8 100644 --- a/src/Helpers/TSHCountryHelper.py +++ b/src/Helpers/TSHCountryHelper.py @@ -227,8 +227,7 @@ def FindState(countryCode, city): None ) if state is not None: - logger.debug(f"State was explicit: [{ - city}] -> [{part}] = {state}") + logger.debug(f"State was explicit: [{city}] -> [{part}] = {state}") return state["original_code"] # No, so get by City @@ -239,8 +238,7 @@ def FindState(countryCode, city): TSHCountryHelper.remove_accents_lower(part), None) if state is not None: - logger.debug(f"Got state from city name: [{ - city}] -> [{part}] = {state}") + logger.debug(f"Got state from city name: [{city}] -> [{part}] = {state}") return state return None diff --git a/src/TSHGameAssetManager.py b/src/TSHGameAssetManager.py index 0d07f9239..fdbecba2b 100644 --- a/src/TSHGameAssetManager.py +++ b/src/TSHGameAssetManager.py @@ -939,10 +939,8 @@ def GetCharacterAssets(self, characterCodename: str, skin: int, assetpack: str = else: metadata_title_locale = asset.get("metadata", {})[ key].get("title", '') - charFiles[assetKey]['metadata'][f"{ - key}"]["title"] = metadata_title_locale - charFiles[assetKey]['metadata'][f"{ - key}"][f"value_en"] = metadata[key] + charFiles[assetKey]['metadata'][f"{key}"]["title"] = metadata_title_locale + charFiles[assetKey]['metadata'][f"{key}"][f"value_en"] = metadata[key] if TSHLocaleHelper.exportLocale in asset.get("metadata", {})[key]["values"].get(characterCodename, {}).get("locale", {}).keys() or TSHLocaleHelper.exportLocale.split('-')[0] in asset.get("metadata", {})[key]["values"].get(characterCodename, {}).get("locale", {}).keys(): try: metadata[key] = asset.get("metadata", {})[key]["values"].get( @@ -950,8 +948,7 @@ def GetCharacterAssets(self, characterCodename: str, skin: int, assetpack: str = except KeyError: metadata[key] = asset.get("metadata", {})[key]["values"].get( characterCodename, {}).get("locale", {})[TSHLocaleHelper.exportLocale.split('-')[0]] - charFiles[assetKey]['metadata'][f"{ - key}"][f"value"] = metadata[key] + charFiles[assetKey]['metadata'][f"{key}"][f"value"] = metadata[key] # if len(metadata.keys()) > 0: # if str(skin) in metadata: diff --git a/src/TSHScoreboardPlayerWidget.py b/src/TSHScoreboardPlayerWidget.py index 61e1c1a04..52b568adc 100644 --- a/src/TSHScoreboardPlayerWidget.py +++ b/src/TSHScoreboardPlayerWidget.py @@ -530,8 +530,7 @@ def LoadStates(self, index): item = QStandardItem() # Windows has some weird thing with files named CON.png. In case a state code is CON, # we try to load _CON.png instead - path = f'./assets/state_flag/{countryData.get( - "code")}/{"_CON" if state_code == "CON" else state_code}.png' + path = f'./assets/state_flag/{countryData.get("code")}/{"_CON" if state_code == "CON" else state_code}.png' if not os.path.exists(path): path = None diff --git a/src/TSHScoreboardWidget.py b/src/TSHScoreboardWidget.py index b94ab886e..ce6ad3999 100644 --- a/src/TSHScoreboardWidget.py +++ b/src/TSHScoreboardWidget.py @@ -563,8 +563,7 @@ def SetPlayersPerTeam(self, number): p = TSHScoreboardPlayerWidget( index=len(self.team1playerWidgets)+1, teamNumber=1, - path=f'score.{self.scoreboardNumber}.team.{ - 1}.player.{len(self.team1playerWidgets)+1}', + path=f'score.{self.scoreboardNumber}.team.{1}.player.{len(self.team1playerWidgets)+1}', scoreboardNumber=self.scoreboardNumber) self.playerWidgets.append(p) @@ -593,8 +592,7 @@ def SetPlayersPerTeam(self, number): p = TSHScoreboardPlayerWidget( index=len(self.team2playerWidgets)+1, teamNumber=2, - path=f'score.{self.scoreboardNumber}.team.{ - 2}.player.{len(self.team2playerWidgets)+1}', + path=f'score.{self.scoreboardNumber}.team.{2}.player.{len(self.team2playerWidgets)+1}', scoreboardNumber=self.scoreboardNumber) self.playerWidgets.append(p) diff --git a/src/TournamentDataProvider/ChallongeDataProvider.py b/src/TournamentDataProvider/ChallongeDataProvider.py index f7f2ddcff..5450ed835 100644 --- a/src/TournamentDataProvider/ChallongeDataProvider.py +++ b/src/TournamentDataProvider/ChallongeDataProvider.py @@ -109,8 +109,7 @@ def GetTournamentData(self, progress_callback=None, cancel_event=None): slug = self.GetSlug() data = self.scraper.get( - f"https://challonge.com/en/search/tournaments.json?filters%5B&page=1&per=1&q={ - slug}", + f"https://challonge.com/en/search/tournaments.json?filters%5B&page=1&per=1&q={slug}", ) logger.debug(data.text) @@ -134,8 +133,7 @@ def GetTournamentData(self, progress_callback=None, cancel_event=None): finalData["startAt"] = dateutil.parser.parse( dateElement.get("text"), fuzzy=True).timestamp() except Exception as e: - logger.error(f"Could not get tournament date: { - traceback.format_exc()}") + logger.error(f"Could not get tournament date: {traceback.format_exc()}") participantsElement = next( (d for d in details if d.get("icon") == "fa fa-users"), None) @@ -157,8 +155,7 @@ def GetIconURL(self): slug = self.GetSlug() data = self.scraper.get( - f"https://challonge.com/en/search/tournaments.json?filters%5B&page=1&per=1&q={ - slug}", + f"https://challonge.com/en/search/tournaments.json?filters%5B&page=1&per=1&q={slug}", headers=HEADERS ) diff --git a/src/TournamentDataProvider/StartGGDataProvider.py b/src/TournamentDataProvider/StartGGDataProvider.py index 560ba1e89..3596199d7 100644 --- a/src/TournamentDataProvider/StartGGDataProvider.py +++ b/src/TournamentDataProvider/StartGGDataProvider.py @@ -392,8 +392,7 @@ def _GetMatchTasks(self, setId, progress_callback, cancel_event): return self.ParseMatchDataOldApi({}) data = self.QueryRequests( - f'https://www.start.gg/api/-/gg_api./set/{ - setId};bustCache=true;expand=["setTask"];fetchMostRecentCached=true', + f'https://www.start.gg/api/-/gg_api./set/{setId};bustCache=true;expand=["setTask"];fetchMostRecentCached=true', type=requests.get, params={ "extensions": {"cacheControl": {"version": 1, "noCache": True}}, @@ -1054,8 +1053,7 @@ def ProcessFutureSet(self, _set, eventSlug): if stateCode: stateData = states[stateCode] - path = f'./assets/state_flag/{countryCode}/{ - "_CON" if stateCode == "CON" else stateCode}.png' + path = f'./assets/state_flag/{countryCode}/{"_CON" if stateCode == "CON" else stateCode}.png' if not os.path.exists(path): path = None diff --git a/src/TournamentStreamHelper.py b/src/TournamentStreamHelper.py index 2593ccbae..6415151dd 100755 --- a/src/TournamentStreamHelper.py +++ b/src/TournamentStreamHelper.py @@ -206,8 +206,7 @@ def ExtractUpdate(): tar.extract(m) updateLog.append(f"Extract {m}") except Exception: - updateLog.append(f"Failed to extract { - m} - {traceback.format_exc()}") + updateLog.append(f"Failed to extract {m} - {traceback.format_exc()}") try: with open("assets/update_log.txt", "w") as f: