Produce a $-prefixed base62 symbol for the given rank.
(index: int)
| 129 | |
| 130 | |
| 131 | def symbol_for(index: int) -> str: |
| 132 | """Produce a $-prefixed base62 symbol for the given rank.""" |
| 133 | if index < 0: |
| 134 | raise ValueError(index) |
| 135 | chars: list[str] = [] |
| 136 | n = index |
| 137 | while True: |
| 138 | chars.append(_SYMBOL_ALPHABET[n % 62]) |
| 139 | n //= 62 |
| 140 | if n == 0: |
| 141 | break |
| 142 | n -= 1 |
| 143 | return "$" + "".join(reversed(chars)) |
| 144 | |
| 145 | |
| 146 | def collect_files(out_dir: Path) -> list[Path]: |
no test coverage detected