From afff0dc73188ac323ec0265cc6b39c67f9fd7474 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Thu, 20 May 2021 06:41:03 +0200 Subject: common: simplify code using contextlib.suppress --- mdbp/common.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'mdbp') diff --git a/mdbp/common.py b/mdbp/common.py index eccefc1..ba4b20d 100644 --- a/mdbp/common.py +++ b/mdbp/common.py @@ -53,10 +53,8 @@ def buildjson_patch_relative(buildobj: JsonObject, except KeyError: break else: - try: + with contextlib.suppress(KeyError): obj[attrs[-1]] = str(basedir / pathlib.Path(obj[attrs[-1]])) - except KeyError: - pass def buildjson(filename: str) -> JsonObject: """Type constructor for argparse validating a build json file path and -- cgit v1.2.3