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

Function _parse_letter_version

numpy/_utils/_pep440.py:391–419  ·  view source on GitHub ↗
(letter, number)

Source from the content-addressed store, hash-verified

389
390
391def _parse_letter_version(letter, number):
392 if letter:
393 # We assume there is an implicit 0 in a pre-release if there is
394 # no numeral associated with it.
395 if number is None:
396 number = 0
397
398 # We normalize any letters to their lower-case form
399 letter = letter.lower()
400
401 # We consider some words to be alternate spellings of other words and
402 # in those cases we want to normalize the spellings to our preferred
403 # spelling.
404 if letter == "alpha":
405 letter = "a"
406 elif letter == "beta":
407 letter = "b"
408 elif letter in ["c", "pre", "preview"]:
409 letter = "rc"
410 elif letter in ["rev", "r"]:
411 letter = "post"
412
413 return letter, int(number)
414 if not letter and number:
415 # We assume that if we are given a number but not given a letter,
416 # then this is using the implicit post release syntax (e.g., 1.0-1)
417 letter = "post"
418
419 return letter, int(number)
420
421
422_local_version_seperators = re.compile(r"[\._-]")

Callers 1

__init__Method · 0.85

Calls 1

lowerMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…