From 4f80e989a8bb9c1204bfed7b8ccd7c252607a70f Mon Sep 17 00:00:00 2001 From: Dan Lindholm Date: Wed, 18 Dec 2024 22:07:13 +0100 Subject: [PATCH] use contextlib.suppress --- src/postcar/utils/fs.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/postcar/utils/fs.py b/src/postcar/utils/fs.py index 3a94025..979db0a 100644 --- a/src/postcar/utils/fs.py +++ b/src/postcar/utils/fs.py @@ -26,10 +26,8 @@ def _sys_path(path: str) -> t.Generator[None, None, None]: yield - try: + with contextlib.suppress(ValueError): sys.path.remove(path) - except ValueError: - pass def add_path(f: "F[P, R]", *, path: str) -> "F[P, R]":