Skip to content

Commit

Permalink
use contextlib.suppress
Browse files Browse the repository at this point in the history
  • Loading branch information
Spitfire1900 committed Mar 26, 2024
1 parent 5ba44ed commit fb17564
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions xontrib/pygitstatus/prompt.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import contextlib
import os

from pygit2 import GitError # pylint: disable=no-name-in-module
Expand All @@ -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

0 comments on commit fb17564

Please sign in to comment.