mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 05:15:12 +00:00

This PR productionizes @MichaReiser's suggestion in https://github.com/charliermarsh/ruff/issues/1820#issuecomment-1440204423, by creating a separate crate for the `ast` module (`rust_python_ast`). This will enable us to further split up the `ruff` crate, as we'll be able to create (e.g.) separate sub-linter crates that have access to these common AST utilities. This was mostly a straightforward copy (with adjustments to module imports), as the few dependencies that _did_ require modifications were handled in #3366, #3367, and #3368.
24 lines
615 B
Rust
24 lines
615 B
Rust
pub enum LoggingLevel {
|
|
Debug,
|
|
Critical,
|
|
Error,
|
|
Exception,
|
|
Info,
|
|
Warn,
|
|
Warning,
|
|
}
|
|
|
|
impl LoggingLevel {
|
|
pub fn from_attribute(level: &str) -> Option<Self> {
|
|
match level {
|
|
"debug" => Some(LoggingLevel::Debug),
|
|
"critical" => Some(LoggingLevel::Critical),
|
|
"error" => Some(LoggingLevel::Error),
|
|
"exception" => Some(LoggingLevel::Exception),
|
|
"info" => Some(LoggingLevel::Info),
|
|
"warn" => Some(LoggingLevel::Warn),
|
|
"warning" => Some(LoggingLevel::Warning),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|