def mime_type_for_path(path: str) -> str: return guess_type(path) or 'application/octet-stream'
def scan(d: str) -> Generator[Tuple[str, str], None, None]: for dirpath, dirnames, filenames in os.walk(d): for f in filenames: mt = guess_type(f) if mt and mt.startswith('image/'): yield os.path.join(dirpath, f), mt
def mime_type_for_path(path: str) -> str: return guess_type( path, allow_filesystem_access=True) or 'application/octet-stream'