Skip to content

Commit

Permalink
Add assertion for tags
Browse files Browse the repository at this point in the history
  • Loading branch information
y0z committed Jul 5, 2024
1 parent aed236e commit 67d7456
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion optunahub-registry/header_confirm.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,20 @@ def header_confirm(path: str) -> None:
assert isinstance(post["title"], str), f"title is not a string in {path}"
assert "description" in post.keys(), f"description is not found in {path}"
assert isinstance(post["description"], str), f"description is not a string in {path}"
assert "tags" in post.keys(), f"tags is not found in {path}"
assert isinstance(post["tags"], list), f"tags is not a list in {path}"
assert all(
isinstance(v, str) for v in post["tags"]
), f"tags is not a list of strings in {path}"
split_path = path.split("/")
if split_path[0] == "package":
category = split_path[1]
if category == "samplers":
assert "sampler" in post["tags"], f"sampler tag must be in {path}"
elif category == "visualizations":
assert "visualization" in post["tags"], f"visualization tag must be in {path}"
elif category == "pruners":
assert "pruner" in post["tags"], f"pruner tag must be in {path}"
assert "tags" in post.keys(), f"tags is not found in {path}"
assert "optuna_versions" in post.keys(), f"optuna_versions is not found in {path}"
assert isinstance(post["optuna_versions"], list), f"optuna_versions is not a list in {path}"
assert all(
Expand Down

0 comments on commit 67d7456

Please sign in to comment.