def validate_ipfs_uri(uri: str) -> None: """ Raise an exception if the provided URI is not a valid IPFS URI. """ if not is_ipfs_uri(uri): raise ValidationError(f"URI: {uri} is not a valid IPFS URI.")
def test_is_ipfs_uri(value, expected): actual = is_ipfs_uri(value) assert actual is expected
def can_resolve_uri(self, uri: str) -> bool: """ Return a bool indicating whether or not this backend is capable of serving the content located at the URI. """ return is_ipfs_uri(uri)