def read(script: str) -> Optional[dict]:
        """Converts inline script metadata to dict with all found data"""
        regex = (
            r"(?m)^# \/\/\/ (?P<type>[a-zA-Z0-9-]+)[ \t]*$[\r\n|\r|\n]"
            "(?P<content>(?:^#(?:| .*)$[\r\n|\r|\n])+)^# \\/\\/\\/[ \t]*$"
        )
        name = "script"
        matches = list(
            filter(lambda m: m.group("type") == name, re.finditer(regex, script))
        )
        if len(matches) > 1:
            raise ValueError(f"Multiple {name} blocks found")
        if len(matches) == 1:
            content = "".join(
                line[2:] if line.startswith("# ") else line[1:]
                for line in matches[0].group("content").splitlines(keepends=True)
            )
            return tomllib.loads(content)
        return None
Converts inline script metadata to dict with all found data
src/datachain/script_meta.py