MCPcopy Create free account
hub / github.com/numpy/numpy / parse

Function parse

numpy/_utils/_pep440.py:117–126  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

115
116
117def parse(version):
118 """
119 Parse the given version string and return either a :class:`Version` object
120 or a :class:`LegacyVersion` object depending on if the given version is
121 a valid PEP 440 version or a legacy version.
122 """
123 try:
124 return Version(version)
125 except InvalidVersion:
126 return LegacyVersion(version)
127
128
129class InvalidVersion(ValueError):

Callers

nothing calls this directly

Calls 2

VersionClass · 0.85
LegacyVersionClass · 0.85

Tested by

no test coverage detected