Пример #1
0
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.")
Пример #2
0
def test_is_ipfs_uri(value, expected):
    actual = is_ipfs_uri(value)
    assert actual is expected
Пример #3
0
 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)