From 54d8a932372fb38aa5b40bcdf672f168972694f5 Mon Sep 17 00:00:00 2001 From: Hari Rana Date: Wed, 8 Jan 2025 22:15:34 -0500 Subject: [PATCH] chore: Run pre-commit --- bottles/backend/managers/installer.py | 4 ++-- bottles/backend/managers/library.py | 2 +- bottles/backend/managers/manager.py | 8 ++++---- bottles/backend/managers/steam.py | 6 +++--- bottles/backend/managers/versioning.py | 2 +- bottles/backend/utils/manager.py | 8 ++++---- bottles/backend/utils/steam.py | 12 ++++++------ bottles/backend/utils/terminal.py | 2 +- bottles/backend/wine/executor.py | 2 +- bottles/backend/wine/winecommand.py | 8 ++++---- bottles/frontend/cli/cli.py | 6 +++--- bottles/frontend/widgets/component.py | 2 +- 12 files changed, 31 insertions(+), 31 deletions(-) diff --git a/bottles/backend/managers/installer.py b/bottles/backend/managers/installer.py index a00c448ef4e..0fb1e65f278 100644 --- a/bottles/backend/managers/installer.py +++ b/bottles/backend/managers/installer.py @@ -247,7 +247,7 @@ def __step_run_script(config: BottleConfig, step: dict): ) return False - logging.info(f"Executing installer script…") + logging.info("Executing installer script…") subprocess.Popen( f"bash -c '{script}'", shell=True, @@ -255,7 +255,7 @@ def __step_run_script(config: BottleConfig, step: dict): stdout=subprocess.PIPE, stderr=subprocess.PIPE, ).communicate() - logging.info(f"Finished executing installer script.") + logging.info("Finished executing installer script.") @staticmethod def __step_update_config(config: BottleConfig, step: dict): diff --git a/bottles/backend/managers/library.py b/bottles/backend/managers/library.py index 95f28fff53e..d2421344b0c 100644 --- a/bottles/backend/managers/library.py +++ b/bottles/backend/managers/library.py @@ -125,7 +125,7 @@ def save_library(self, silent=False): yaml.dump(self.__library, library_file) if not silent: - logging.info(f"Library saved") + logging.info("Library saved") def get_library(self): """ diff --git a/bottles/backend/managers/manager.py b/bottles/backend/managers/manager.py index 2c1ffcc63c9..8b04c30e218 100644 --- a/bottles/backend/managers/manager.py +++ b/bottles/backend/managers/manager.py @@ -1531,11 +1531,11 @@ def delete_bottle(self, config: BottleConfig) -> bool: logging.error("Empty path found. Disasters unavoidable.") return False - logging.info(f"Removing applications installed with the bottle…") + logging.info("Removing applications installed with the bottle…") for inst in glob(f"{Paths.applications}/{config.Name}--*"): os.remove(inst) - logging.info(f"Removing library entries associated with this bottle…") + logging.info("Removing library entries associated with this bottle…") library_manager = LibraryManager() entries = library_manager.get_library().copy() for _uuid, entry in entries.items(): @@ -1543,7 +1543,7 @@ def delete_bottle(self, config: BottleConfig) -> bool: library_manager.remove_from_library(_uuid) if config.Custom_Path: - logging.info(f"Removing placeholder…") + logging.info("Removing placeholder…") with contextlib.suppress(FileNotFoundError): os.remove( os.path.join( @@ -1551,7 +1551,7 @@ def delete_bottle(self, config: BottleConfig) -> bool: ) ) - logging.info(f"Removing the bottle…") + logging.info("Removing the bottle…") path = ManagerUtils.get_bottle_path(config) subprocess.run(["rm", "-rf", path], stdout=subprocess.DEVNULL) diff --git a/bottles/backend/managers/steam.py b/bottles/backend/managers/steam.py index 85b18d248f3..0596dec51a6 100644 --- a/bottles/backend/managers/steam.py +++ b/bottles/backend/managers/steam.py @@ -137,7 +137,7 @@ def __get_library_folders(self) -> list | None: _library_folders = SteamUtils.parse_vdf(f.read()) if _library_folders is None or not _library_folders.get("libraryfolders"): - logging.warning(f"Could not parse libraryfolders.vdf") + logging.warning("Could not parse libraryfolders.vdf") return None for _, folder in _library_folders["libraryfolders"].items(): @@ -172,7 +172,7 @@ def __get_local_config(self) -> dict: data = SteamUtils.parse_vdf(f.read()) if data is None: - logging.warning(f"Could not parse localconfig.vdf") + logging.warning("Could not parse localconfig.vdf") return {} return data @@ -188,7 +188,7 @@ def save_local_config(self, new_data: dict): with open(self.localconfig_path, "w") as f: SteamUtils.to_vdf(VDFDict(new_data), f) - logging.info(f"Steam config saved") + logging.info("Steam config saved") @staticmethod @lru_cache diff --git a/bottles/backend/managers/versioning.py b/bottles/backend/managers/versioning.py index f3e897a96a8..30b63bc6abc 100644 --- a/bottles/backend/managers/versioning.py +++ b/bottles/backend/managers/versioning.py @@ -251,7 +251,7 @@ def get_state_files( file.close() return files except (OSError, IOError, yaml.YAMLError): - logging.error(f"Could not read the state files file.") + logging.error("Could not read the state files file.") return {} @staticmethod diff --git a/bottles/backend/utils/manager.py b/bottles/backend/utils/manager.py index 6b47573d85d..bd5ecc58752 100644 --- a/bottles/backend/utils/manager.py +++ b/bottles/backend/utils/manager.py @@ -248,14 +248,14 @@ def create_desktop_entry( os.remove(file) with open(desktop_file, "w") as f: - f.write(f"[Desktop Entry]\n") + f.write("[Desktop Entry]\n") f.write(f"Name={program.get('name')}\n") f.write( f"Exec={cmd_cli} run -p {shlex.quote(program.get('name'))} -b '{config.get('Name')}' -- %u\n" ) - f.write(f"Type=Application\n") - f.write(f"Terminal=false\n") - f.write(f"Categories=Application;\n") + f.write("Type=Application\n") + f.write("Terminal=false\n") + f.write("Categories=Application;\n") f.write(f"Icon={icon}\n") f.write(f"Comment=Launch {program.get('name')} using Bottles.\n") f.write(f"StartupWMClass={program.get('name')}\n") diff --git a/bottles/backend/utils/steam.py b/bottles/backend/utils/steam.py index 9a8d4916576..8e867acef60 100644 --- a/bottles/backend/utils/steam.py +++ b/bottles/backend/utils/steam.py @@ -53,7 +53,7 @@ def is_proton(path: str) -> bool: """ Checks if a directory is a Proton directory. """ - toolmanifest = os.path.join(path, f"toolmanifest.vdf") + toolmanifest = os.path.join(path, "toolmanifest.vdf") if not os.path.isfile(toolmanifest): return False @@ -70,7 +70,7 @@ def get_associated_runtime(path: str) -> Optional[str]: """ Get the associated runtime of a Proton directory. """ - toolmanifest = os.path.join(path, f"toolmanifest.vdf") + toolmanifest = os.path.join(path, "toolmanifest.vdf") if not os.path.isfile(toolmanifest): logging.error(f"toolmanifest.vdf not found in Proton directory: {path}") return None @@ -93,10 +93,10 @@ def get_dist_directory(path: str) -> str: Get the sub-directory containing the wine libraries and binaries. """ dist_directory = path - if os.path.isdir(os.path.join(path, f"dist")): - dist_directory = os.path.join(path, f"dist") - elif os.path.isdir(os.path.join(path, f"files")): - dist_directory = os.path.join(path, f"files") + if os.path.isdir(os.path.join(path, "dist")): + dist_directory = os.path.join(path, "dist") + elif os.path.isdir(os.path.join(path, "files")): + dist_directory = os.path.join(path, "files") else: logging.warning( f"No /dist or /files sub-directory was found under this Proton directory: {path}" diff --git a/bottles/backend/utils/terminal.py b/bottles/backend/utils/terminal.py index 4acd1a5c115..32513bb71fb 100644 --- a/bottles/backend/utils/terminal.py +++ b/bottles/backend/utils/terminal.py @@ -101,7 +101,7 @@ def execute(self, command, env=None, colors="default", cwd=None): shlex.quote(f"bash -c {command}"), ) if "ENABLE_BASH" in os.environ: - command = " ".join(self.terminal) % (colors, f"bash") + command = " ".join(self.terminal) % (colors, "bash") elif self.terminal[0] in ["xfce4-terminal"]: command = " ".join(self.terminal) % "'sh -c %s'" % f"{command}" elif self.terminal[0] in ["kitty", "foot", "konsole", "gnome-terminal"]: diff --git a/bottles/backend/wine/executor.py b/bottles/backend/wine/executor.py index c2b30503e82..7c4646e551c 100644 --- a/bottles/backend/wine/executor.py +++ b/bottles/backend/wine/executor.py @@ -190,7 +190,7 @@ def __get_exec_type(exec_path): if _exec.endswith(".dll"): return "dll" - logging.warning(f"Not a common executable type, trying to launch it anyway.") + logging.warning("Not a common executable type, trying to launch it anyway.") return "unsupported" def run_cli(self): diff --git a/bottles/backend/wine/winecommand.py b/bottles/backend/wine/winecommand.py index c481e17cff7..643335b9df6 100644 --- a/bottles/backend/wine/winecommand.py +++ b/bottles/backend/wine/winecommand.py @@ -465,7 +465,7 @@ def _get_runner_info(self) -> tuple[str, str]: Additionally, check for its corresponding runtime. """ runner_runtime = SteamUtils.get_associated_runtime(runner) - runner = os.path.join(SteamUtils.get_dist_directory(runner), f"bin/wine") + runner = os.path.join(SteamUtils.get_dist_directory(runner), "bin/wine") elif runner.startswith("sys-"): """ @@ -523,10 +523,10 @@ def get_cmd( gamescope_run = tempfile.NamedTemporaryFile(mode="w", suffix=".sh").name # Create temporary sh script in /tmp where Gamescope will execute it - file = [f"#!/usr/bin/env sh\n"] + file = ["#!/usr/bin/env sh\n"] file.append(f"{command} $@") if mangohud_available and params.mangohud: - file.append(f" &\nmangoapp") + file.append(" &\nmangoapp") with open(gamescope_run, "w") as f: f.write("".join(file)) @@ -756,7 +756,7 @@ def run(self) -> Result[Optional[str]]: # UnicodeDecodeError: codec mismatch # LookupError: unknown codec name # TypeError: codec is None - logging.warning(f"stdout decoding failed") + logging.warning("stdout decoding failed") rv = str(stdout_data)[2:-1] # trim b'' # "ShellExecuteEx" exception may occur while executing command, diff --git a/bottles/frontend/cli/cli.py b/bottles/frontend/cli/cli.py index e35c13c0def..d6211929f72 100644 --- a/bottles/frontend/cli/cli.py +++ b/bottles/frontend/cli/cli.py @@ -497,7 +497,7 @@ def manage_reg(self): if _action in ["add", "edit"]: if _data is None or _key_type not in allowed_types: - sys.stderr.write(f"Missing or invalid data or key type\n") + sys.stderr.write("Missing or invalid data or key type\n") exit(1) Reg(bottle).add(_key, _value, _data, _key_type) elif _action == "del": @@ -655,7 +655,7 @@ def run_program(self): if _program is not None: if _executable is not None: - sys.stderr.write(f"Cannot specify both --program and --executable\n") + sys.stderr.write("Cannot specify both --program and --executable\n") exit(1) if _program not in [p["name"] for p in programs]: @@ -744,7 +744,7 @@ def generate_standalone(self): os.remove(standalone_path) with open(standalone_path, "w") as f: - f.write(f"#!/bin/bash\n") + f.write("#!/bin/bash\n") for k, v in env.items(): f.write(f"export {k}='{v}'\n") f.write(f"{cmd}\n") diff --git a/bottles/frontend/widgets/component.py b/bottles/frontend/widgets/component.py index fc85f406dab..1bc32e510b0 100644 --- a/bottles/frontend/widgets/component.py +++ b/bottles/frontend/widgets/component.py @@ -141,7 +141,7 @@ def update_progress( status: Optional[Status] = None, ): if status == Status.FAILED: - logging.error(f"Component installation failed") + logging.error("Component installation failed") self.set_err() return False