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

Function _parse_letter_version

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

Source from the content-addressed store, hash-verified

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

Callers 1

__init__Method · 0.85

Calls 1

lowerMethod · 0.80

Tested by

no test coverage detected