(s: str)
| 130 | |
| 131 | |
| 132 | def _parse_slurm_node_list(s: str) -> List[str]: |
| 133 | nodes = [] |
| 134 | # Extract "hostname", "hostname[1-2,3,4-5]," substrings |
| 135 | p = re.compile(r"(([^\[]+)(?:\[([^\]]+)\])?),?") |
| 136 | for m in p.finditer(s): |
| 137 | prefix, suffixes = s[m.start(2) : m.end(2)], s[m.start(3) : m.end(3)] |
| 138 | for suffix in suffixes.split(","): |
| 139 | span = suffix.split("-") |
| 140 | if len(span) == 1: |
| 141 | nodes.append(prefix + suffix) |
| 142 | else: |
| 143 | width = len(span[0]) |
| 144 | start, end = int(span[0]), int(span[1]) + 1 |
| 145 | nodes.extend([prefix + f"{i:0{width}}" for i in range(start, end)]) |
| 146 | return [i for n in nodes for i in n.split(",")] |
| 147 | |
| 148 | |
| 149 | def _check_env_variable(key: str, new_value: str): |
no test coverage detected