Parse the given version string and return either a :class:`Version` object or a :class:`LegacyVersion` object depending on if the given version is a valid PEP 440 version or a legacy version.
(version)
| 114 | |
| 115 | |
| 116 | def parse(version): |
| 117 | """ |
| 118 | Parse the given version string and return either a :class:`Version` object |
| 119 | or a :class:`LegacyVersion` object depending on if the given version is |
| 120 | a valid PEP 440 version or a legacy version. |
| 121 | """ |
| 122 | try: |
| 123 | return Version(version) |
| 124 | except InvalidVersion: |
| 125 | return LegacyVersion(version) |
| 126 | |
| 127 | |
| 128 | class InvalidVersion(ValueError): |
nothing calls this directly
no test coverage detected
searching dependent graphs…