File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change 1919if typing .TYPE_CHECKING :
2020 from typing_extensions import Self , Unpack
2121
22+ _LETTER_NORMALIZATION = {
23+ "alpha" : "a" ,
24+ "beta" : "b" ,
25+ "c" : "rc" ,
26+ "pre" : "rc" ,
27+ "preview" : "rc" ,
28+ "rev" : "post" ,
29+ "r" : "post" ,
30+ }
31+
2232__all__ = ["VERSION_PATTERN" , "InvalidVersion" , "Version" , "parse" ]
2333
2434LocalType = Tuple [Union [int , str ], ...]
@@ -614,14 +624,7 @@ def _parse_letter_version(
614624 # We consider some words to be alternate spellings of other words and
615625 # in those cases we want to normalize the spellings to our preferred
616626 # spelling.
617- if letter == "alpha" :
618- letter = "a"
619- elif letter == "beta" :
620- letter = "b"
621- elif letter in ["c" , "pre" , "preview" ]:
622- letter = "rc"
623- elif letter in ["rev" , "r" ]:
624- letter = "post"
627+ letter = _LETTER_NORMALIZATION .get (letter , letter )
625628
626629 # We consider there to be an implicit 0 in a pre-release if there is
627630 # not a numeral associated with it.
You can’t perform that action at this time.
0 commit comments