Skip to content

Commit

Permalink
Add global switch for turning on ID checks (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt authored Nov 4, 2024
1 parent 1df4f94 commit 667e922
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/pyobo/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"resid", # deprecated
"adw", # deprecated
}
GLOBAL_CHECK_IDS = False

#: Default prefix
DEFAULT_PREFIX = "debio"
Expand Down
5 changes: 3 additions & 2 deletions src/pyobo/struct/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pydantic import Field, field_validator, model_validator

from .utils import obo_escape
from ..constants import GLOBAL_CHECK_IDS
from ..identifier_utils import normalize_curie

__all__ = [
Expand Down Expand Up @@ -50,8 +51,8 @@ def validate_identifier(cls, values): # noqa
raise ExpansionError(f"Unknown prefix: {prefix}")
values["prefix"] = resource.prefix
values["identifier"] = resource.standardize_identifier(identifier)
# if not resource.is_valid_identifier(values["identifier"]):
# raise ValueError(f"non-standard identifier: {resource.prefix}:{values['identifier']}")
if GLOBAL_CHECK_IDS and not resource.is_valid_identifier(values["identifier"]):
raise ValueError(f"non-standard identifier: {resource.prefix}:{values['identifier']}")
return values

@classmethod
Expand Down

0 comments on commit 667e922

Please sign in to comment.