Skip to content

Commit

Permalink
Update deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt committed Nov 6, 2023
1 parent dae5831 commit 1654b4a
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions src/sssom/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import logging as _logging
import os
import re
import warnings
from collections import ChainMap, defaultdict
from dataclasses import dataclass, field
from functools import partial, reduce
Expand All @@ -19,6 +18,7 @@
import validators
import yaml
from curies import Converter
from deprecation import deprecated
from jsonschema import ValidationError
from linkml_runtime.linkml_model.types import Uriorcurie
from sssom_schema import Mapping as SSSOM_Mapping
Expand Down Expand Up @@ -1098,16 +1098,15 @@ def get_dict_from_mapping(map_obj: Union[Any, Dict[Any, Any], SSSOM_Mapping]) ->
CURIE_RE = re.compile(CURIE_PATTERN)


@deprecated(
deprecated_in="0.4.0",
details="sssom.util.is_curie is deprecated. This functionality was not supposed to be exposed from "
"the public interface from SSSOM-py. Instead, we suggest instantiating a curies.Converter based on "
"your context's prefix map and using curies.Converter.is_curie(). If you're looking for global syntax "
f"checking for CURIEs, try matching against {CURIE_PATTERN}",
)
def is_curie(string: str) -> bool:
"""Check if the string is a CURIE."""
warnings.warn(
"sssom.util.is_curie is deprecated. This functionality was not supposed to be exposed from "
"the public interface from SSSOM-py. Instead, we suggest instantiating a curies.Converter based on "
"your context's prefix map and using curies.Converter.is_curie(). If you're looking for global syntax "
f"checking for CURIEs, try matching against {CURIE_PATTERN}",
DeprecationWarning,
stacklevel=2,
)
return _is_curie(string)


Expand All @@ -1116,16 +1115,15 @@ def _is_curie(string: str) -> bool:
return bool(CURIE_RE.match(string))


@deprecated(
deprecated_in="0.4.0",
details="sssom.util.is_iri is deprecated. This functionality was not supposed to be exposed from "
"the public interface from SSSOM-py. Instead, we suggest instantiating a curies.Converter based on "
"your context's prefix map and using curies.Converter.is_uri(). If you're looking for a globally valid "
"URI checker, use validators.url()",
)
def is_iri(string: str) -> bool:
"""Check if the string is an IRI."""
warnings.warn(
"sssom.util.is_iri is deprecated. This functionality was not supposed to be exposed from "
"the public interface from SSSOM-py. Instead, we suggest instantiating a curies.Converter based on "
"your context's prefix map and using curies.Converter.is_uri(). If you're looking for a globally valid "
"URI checker, use validators.url()",
DeprecationWarning,
stacklevel=2,
)
return _is_iri(string)


Expand Down

0 comments on commit 1654b4a

Please sign in to comment.