def METHOD_NAME(self, robot) -> Optional[_PreRunScriptsInfo]:
    from robocorp_code.find_robot_yaml import find_robot_yaml_path_from_path
    from robocorp_ls_core import yaml_wrapper
    path = Path(robot)
    try:
        stat = path.stat()
    except Exception:
        log.exception(f"Expected {path} to exist.")
        return None
    robot_yaml: Optional[Path] = find_robot_yaml_path_from_path(path, stat)
    if not robot_yaml:
        return None
    try:
        with open(robot_yaml, "r") as stream:
            contents = yaml_wrapper.load(stream)
    except Exception:
        log.exception(f"Error loading: {robot_yaml}")
        return None
    try:
        pre_run_scripts = contents.get("preRunScripts")
        if pre_run_scripts:
            pre_run_scripts = list(self._filter_pre_run_scripts(pre_run_scripts))
            if pre_run_scripts:
                return _PreRunScriptsInfo(
                    pre_run_scripts=pre_run_scripts,
                    robot_yaml=robot_yaml,
                )
    except Exception:
        log.exception(f"Error detecting preRunScripts: {robot_yaml}")
        return None
    return None