Skip to content

Commit

Permalink
Update api.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt committed Nov 4, 2023
1 parent 178ef48 commit 3d9ed93
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/curies/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -958,8 +958,7 @@ def format_curie(self, prefix: str, identifier: str) -> str:

def is_uri(self, uri: str) -> bool:
"""Check if a string is a valid URI based on the records in this converter."""
prefix, _ = self.parse_uri(uri)
return prefix is not None
return self.compress(uri) is not None

def compress_strict(self, uri: str) -> str:
"""Compress a URI to a CURIE, and raise an error of not possible."""
Expand Down Expand Up @@ -1047,7 +1046,7 @@ def parse_uri(self, uri: str) -> Union[ReferenceTuple, Tuple[None, None]]:

def is_curie(self, curie: str) -> bool:
"""Check if the CURIE is parsable under this converter."""
return self.expand(curie) is None
return self.expand(curie) is not None

def expand_strict(self, curie: str) -> str:
"""Expand a CURIE to a URI, and raise an error of not possible."""
Expand Down

0 comments on commit 3d9ed93

Please sign in to comment.