Skip to content

Commit 69db1e8

Browse files
committed
More formatting fixes
1 parent 9b12bc7 commit 69db1e8

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

rocrate_validator/profiles/five-safes-crate/15_metadata_file.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,13 @@ def test_existence(self, context: ValidationContext) -> bool:
3636
try:
3737
json_dict = context.ro_crate.metadata.as_dict()
3838
context_value = json_dict["@context"]
39-
pattern = re.compile(
40-
r"https://w3id\.org/ro/crate/1\.[2-9](-DRAFT)?/context"
41-
)
39+
pattern = re.compile(r"https://w3id\.org/ro/crate/1\.[2-9](-DRAFT)?/context")
4240
passed = True
4341
if isinstance(context_value, list):
44-
if not any(
45-
pattern.match(item)
46-
for item in context_value
47-
if isinstance(item, str)
48-
):
49-
passed = False
50-
else:
51-
if not pattern.match(context_value):
42+
if not any(pattern.match(item) for item in context_value if isinstance(item, str)):
5243
passed = False
44+
elif not pattern.match(context_value):
45+
passed = False
5346
if not passed:
5447
context.result.add_issue(
5548
"The RO-Crate metadata file MUST include the RO-Crate context "
@@ -58,7 +51,7 @@ def test_existence(self, context: ValidationContext) -> bool:
5851
)
5952
return passed
6053

61-
except Exception as e:
54+
except Exception:
6255
if logger.isEnabledFor(logging.DEBUG):
63-
logger.exception(e)
56+
logger.exception("Unexpected error during RO-Crate context version check")
6457
return True

0 commit comments

Comments
 (0)