MCPcopy Index your code
hub / github.com/numpy/numpy / parse

Function parse

numpy/_utils/_pep440.py:116–125  ·  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

114
115
116def 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
128class InvalidVersion(ValueError):

Callers

nothing calls this directly

Calls 2

VersionClass · 0.85
LegacyVersionClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…