From 4f4ad2cfd796c6bb6a448ea8f121d71331edc51d Mon Sep 17 00:00:00 2001 From: Vadim Troshchinskiy Date: Tue, 8 Oct 2024 13:54:22 +0200 Subject: [PATCH] Lint fixes --- gitlib/gitlib.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/gitlib/gitlib.py b/gitlib/gitlib.py index 7760368..f1779a9 100755 --- a/gitlib/gitlib.py +++ b/gitlib/gitlib.py @@ -419,7 +419,7 @@ class OpengnsysGitLibrary: def _write_ignore_list(self, base_path): ignore_file = base_path + "/.gitignore" - self.logger.debug("Creating ignore list: " + ignore_file) + self.logger.debug("Creating ignore list: %s", ignore_file) with open(ignore_file, 'w', encoding='utf-8') as f: f.write("\n".join(self.default_ignore_list)) f.write("\n") @@ -587,7 +587,6 @@ class OpengnsysGitLibrary: elif os.path.exists("/usr/sbin/grub-install"): self.logger.debug("Installing Grub 1.x") - root = "" result = subprocess.run(["/usr/sbin/grub-install", "--force", "--root-directory", root_directory, boot_device], check = True, capture_output=True) self.logger.debug(f"retorno: {result.returncode}") self.logger.debug(f"stdout: {result.stdout}") @@ -723,7 +722,7 @@ class OpengnsysGitLibrary: # Run the temporary file command = [temp_file.name] + arguments self.logger.debug(f"Running: {command} {arguments}") - result = subprocess.run(command, shell=False, capture_output=True, text=True) + result = subprocess.run(command, shell=False, capture_output=True, text=True, check=True) output = result.stdout.strip() self.logger.debug(f"STDOUT: {output}") @@ -1320,7 +1319,7 @@ class OpengnsysGitLibrary: self._mount(device, path) - self.logger.info("Initializing repository: " + path) + self.logger.info("Initializing repository: %s", path) git_dir = os.path.join(path, ".git") real_git_dir = os.path.join(self.cache_dir, f"git-{repo_name}") @@ -1393,7 +1392,7 @@ class OpengnsysGitLibrary: add_files = add_files_new - self.logger.info("Adding %d files" % len(add_files)) + self.logger.info("Adding %d files", len(add_files)) with OperationTimer(self, "add all files"): #subprocess.run(["git", "add"] + add_files, check=True, cwd=path) repo.index.add(items = add_files, force=True ) @@ -1406,7 +1405,7 @@ class OpengnsysGitLibrary: untracked_list = repo.untracked_files if untracked_list: self.logger.warning(f"Untracked files: {untracked_list}") - self.logger.warning("Adding %d untracked files" % len(untracked_list)) + self.logger.warning("Adding %d untracked files", len(untracked_list)) #repo.index.add(items = untracked_list, force=True) subprocess.run(["git", "add"] + untracked_list, check=True, cwd=path) @@ -1663,13 +1662,13 @@ if __name__ == '__main__': with OperationTimer(og_git, "git pull"): og_git.pullRepo(args.pull) elif args.test_metadata: - og_git._create_metadata(args.test_metadata) + og_git._create_metadata(args.test_metadata) # pylint: disable=protected-access elif args.test_restore_metadata: - og_git._restore_metadata(args.test_restore_metadata) + og_git._restore_metadata(args.test_restore_metadata) # pylint: disable=protected-access elif args.test_restore_metadata_destructive: - og_git._restore_metadata(path = args.test_restore_metadata_destructive, destructive_only=True) + og_git._restore_metadata(path = args.test_restore_metadata_destructive, destructive_only=True) # pylint: disable=protected-access elif args.test_clone_metadata: - og_git._get_repo_metadata(args.test_clone_metadata) + og_git._get_repo_metadata(args.test_clone_metadata) # pylint: disable=protected-access else: print("Debe especificar una acción") #