import os from urllib.parse import urlparse def url_to_path(url: str) -> str: p = urlparse(url) return os.path.abspath(os.path.join(p.netloc, p.path)) def url_is_file(url: str) -> bool: if url.startswith("file://"): path = url_to_path(url) return os.path.isfile(path) return False