Skip to content

Commit

Permalink
models.reference_files:Action - simplify validation of Action.alterna…
Browse files Browse the repository at this point in the history
…tives
  • Loading branch information
MatteoCampinoti94 committed Aug 6, 2024
1 parent eeb3598 commit 2bec779
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions acacore/models/reference_files.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Data models for the data on saved to different .json files on the `reference_files` repo."""

from re import match
from typing import get_args as get_type_args
from typing import Literal

Expand Down Expand Up @@ -223,10 +222,6 @@ class Action(ActionData):
def _validate_alternatives(cls, value: dict[str, str]) -> dict[str, str]:
if not isinstance(value, dict):
raise ValueError("Is not a dictionary.")
if not all(isinstance(k, str) and match(r"^(\.[a-z0-9]+)+$", k) for k in value.keys()):
raise ValueError("Keys are not valid extensions '(\\.[a-z0-9]+)+'.")
if not all(isinstance(v, str) and match(r"^[a-zA-Z0-9_/-]+$", v) for v in value.values()):
raise ValueError("Keys are not valid PUIDs '(\\.[a-z0-9]+)+'.")
return {k.lower(): v for k, v in value.items()}

@property
Expand Down

0 comments on commit 2bec779

Please sign in to comment.