Split version into components. The split components are intended for version comparison. The logic does not attempt to retain the original version string, so joining the components back with :func:`_version_join` may not produce the original version string.
(version: str)
| 644 | |
| 645 | |
| 646 | def _version_split(version: str) -> List[str]: |
| 647 | """Split version into components. |
| 648 | |
| 649 | The split components are intended for version comparison. The logic does |
| 650 | not attempt to retain the original version string, so joining the |
| 651 | components back with :func:`_version_join` may not produce the original |
| 652 | version string. |
| 653 | """ |
| 654 | result: List[str] = [] |
| 655 | |
| 656 | epoch, _, rest = version.rpartition("!") |
| 657 | result.append(epoch or "0") |
| 658 | |
| 659 | for item in rest.split("."): |
| 660 | match = _prefix_regex.search(item) |
| 661 | if match: |
| 662 | result.extend(match.groups()) |
| 663 | else: |
| 664 | result.append(item) |
| 665 | return result |
| 666 | |
| 667 | |
| 668 | def _version_join(components: List[str]) -> str: |
no test coverage detected