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

Function _legacy_cmpkey

numpy/_utils/_pep440.py:223–247  ·  view source on GitHub ↗
(version)

Source from the content-addressed store, hash-verified

221
222
223def _legacy_cmpkey(version):
224 # We hardcode an epoch of -1 here. A PEP 440 version can only have an epoch
225 # greater than or equal to 0. This will effectively put the LegacyVersion,
226 # which uses the defacto standard originally implemented by setuptools,
227 # as before all PEP 440 versions.
228 epoch = -1
229
230 # This scheme is taken from pkg_resources.parse_version setuptools prior to
231 # its adoption of the packaging library.
232 parts = []
233 for part in _parse_version_parts(version.lower()):
234 if part.startswith("*"):
235 # remove "-" before a prerelease tag
236 if part < "*final":
237 while parts and parts[-1] == "*final-":
238 parts.pop()
239
240 # remove trailing zeros from each series of numeric parts
241 while parts and parts[-1] == "00000000":
242 parts.pop()
243
244 parts.append(part)
245 parts = tuple(parts)
246
247 return epoch, parts
248
249
250# Deliberately not anchored to the start and end of the string, to make it

Callers 1

__init__Method · 0.85

Calls 3

_parse_version_partsFunction · 0.85
lowerMethod · 0.80
startswithMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…