Potentially return None in the case of an invalid data url. Would require refactoring of __parse_url where DATA_URL_RE does not match.
from data_url import DataURL
if url := DataURL.from_url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...")
# is a data url so work with it.
else:
pass
Or implement def __bool__(self) and return False when there is no match.
Thoughts?
Potentially return
Nonein the case of an invalid data url. Would require refactoring of__parse_urlwhereDATA_URL_REdoes not match.Or implement
def __bool__(self)and returnFalsewhen there is no match.Thoughts?