Add a new script to generate builtin module names (#12696)

This commit is contained in:
Alex Waygood 2024-08-05 21:33:36 +01:00 committed by GitHub
parent 2393d19f91
commit 7ee7c68f36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 198 additions and 50 deletions

View file

@ -39,6 +39,18 @@ pub enum TargetVersion {
}
impl TargetVersion {
pub const fn as_tuple(self) -> (u8, u8) {
match self {
Self::Py37 => (3, 7),
Self::Py38 => (3, 8),
Self::Py39 => (3, 9),
Self::Py310 => (3, 10),
Self::Py311 => (3, 11),
Self::Py312 => (3, 12),
Self::Py313 => (3, 13),
}
}
const fn as_str(self) -> &'static str {
match self {
Self::Py37 => "py37",