parse_iri

parse_iri(iri: str, *, use_preferred: bool = False, strict: Literal[True] = False, on_failure_return_type: FailureReturnType = FailureReturnType.pair) ReferenceTuple[source]
parse_iri(iri: str, *, use_preferred: bool = False, strict: Literal[False] = False, on_failure_return_type: Literal[FailureReturnType.pair] = FailureReturnType.pair) ReferenceTuple | tuple[None, None]
parse_iri(iri: str, *, use_preferred: bool = False, strict: Literal[False] = False, on_failure_return_type: Literal[FailureReturnType.single]) ReferenceTuple | None

Parse a compact identifier from an IRI that wraps Manager.parse_uri().

Parameters:
  • iri – A valid IRI

  • use_preferred – If set to true, uses the “preferred prefix”, if available, instead of the canonicalized Bioregistry prefix.

  • strict – If set to true, requires parsing to succeed

  • on_failure_return_type – whether to return a single None or a pair of None’s

Returns:

A pair of prefix/identifier, if can be parsed

Raises:

TypeError – if an invalid on_failure_return_type is given