(raw_versions: object)
| 167 | |
| 168 | |
| 169 | def parse_versions(raw_versions: object) -> list[VersionEntry]: |
| 170 | if raw_versions is None: |
| 171 | return [] |
| 172 | if not isinstance(raw_versions, list): |
| 173 | raise ValueError("docs.yml versions must be a list") |
| 174 | entries: list[VersionEntry] = [] |
| 175 | for raw in cast("list[object]", raw_versions): |
| 176 | if not isinstance(raw, dict): |
| 177 | continue |
| 178 | entry = cast("YamlMapping", raw) |
| 179 | slug = entry.get("slug") |
| 180 | display_name = entry.get("display-name") |
| 181 | path = entry.get("path") |
| 182 | if ( |
| 183 | isinstance(slug, str) |
| 184 | and isinstance(display_name, str) |
| 185 | and isinstance(path, str) |
| 186 | ): |
| 187 | entries.append( |
| 188 | VersionEntry(slug=slug, display_name=display_name, path=path) |
| 189 | ) |
| 190 | return entries |
| 191 | |
| 192 | |
| 193 | def ordered_entries( |
no test coverage detected