-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dcreager/module-resolution
* main: [red-knot] Display definition range in trace logs (#14955) [red-knot] Move the `ClassBase` enum to its own submodule (#14957) [red-knot] mdtest: python version requirements (#14954) [airflow]: Import modules that has been moved to airflow providers (AIR303) (#14764) [red-knot] Support `typing.TYPE_CHECKING` (#14952) Add tracing support to mdtest (#14935) Re-enable the fuzzer job on PRs (#14953) [red-knot] Improve `match` mdtests (#14951) Rename `custom-typeshed-dir`, `target-version` and `current-directory` CLI options (#14930) [red-knot] Add narrowing for 'while' loops (#14947) [`ruff`] Skip SQLModel base classes for `mutable-class-default` (`RUF012`) (#14949) [red-knot] Tests for 'while' loop boundness (#14944)
- Loading branch information
Showing
62 changed files
with
1,111 additions
and
548 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/// Enumeration of all supported Python versions | ||
/// | ||
/// TODO: unify with the `PythonVersion` enum in the linter/formatter crates? | ||
#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, PartialOrd, Ord, Default, clap::ValueEnum)] | ||
pub enum PythonVersion { | ||
#[value(name = "3.7")] | ||
Py37, | ||
#[value(name = "3.8")] | ||
Py38, | ||
#[default] | ||
#[value(name = "3.9")] | ||
Py39, | ||
#[value(name = "3.10")] | ||
Py310, | ||
#[value(name = "3.11")] | ||
Py311, | ||
#[value(name = "3.12")] | ||
Py312, | ||
#[value(name = "3.13")] | ||
Py313, | ||
} | ||
|
||
impl PythonVersion { | ||
const fn as_str(self) -> &'static str { | ||
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", | ||
} | ||
} | ||
} | ||
|
||
impl std::fmt::Display for PythonVersion { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
f.write_str(self.as_str()) | ||
} | ||
} | ||
|
||
impl From<PythonVersion> for red_knot_python_semantic::PythonVersion { | ||
fn from(value: PythonVersion) -> Self { | ||
match value { | ||
PythonVersion::Py37 => Self::PY37, | ||
PythonVersion::Py38 => Self::PY38, | ||
PythonVersion::Py39 => Self::PY39, | ||
PythonVersion::Py310 => Self::PY310, | ||
PythonVersion::Py311 => Self::PY311, | ||
PythonVersion::Py312 => Self::PY312, | ||
PythonVersion::Py313 => Self::PY313, | ||
} | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use crate::python_version::PythonVersion; | ||
|
||
#[test] | ||
fn same_default_as_python_version() { | ||
assert_eq!( | ||
red_knot_python_semantic::PythonVersion::from(PythonVersion::default()), | ||
red_knot_python_semantic::PythonVersion::default() | ||
); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,7 @@ def f(): | |
|
||
```toml | ||
[environment] | ||
target-version = "3.11" | ||
python-version = "3.11" | ||
``` | ||
|
||
```py | ||
|
Oops, something went wrong.