From fb17564bfa101f89b6967e9f4666020c2100cb7b Mon Sep 17 00:00:00 2001 From: Kyle Gottfried <6462596+Spitfire1900@users.noreply.github.com> Date: Tue, 26 Mar 2024 14:39:31 -0400 Subject: [PATCH] use contextlib.suppress --- xontrib/pygitstatus/prompt.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/xontrib/pygitstatus/prompt.py b/xontrib/pygitstatus/prompt.py index 41ff80a..3a7d326 100644 --- a/xontrib/pygitstatus/prompt.py +++ b/xontrib/pygitstatus/prompt.py @@ -1,3 +1,4 @@ +import contextlib import os from pygit2 import GitError # pylint: disable=no-name-in-module @@ -16,11 +17,9 @@ def clean(fld: PromptField, ctx: PromptFields): value = '' - try: + with contextlib.suppress(GitError): repo = Repo(os.getcwd()) if len(repo.status()) == 0: value = symbol - except GitError: - pass fld.value = value