Introduce a ruff_python_semantic crate (#3865)

This commit is contained in:
Charlie Marsh 2023-04-04 12:50:47 -04:00 committed by GitHub
parent 46bcb1f725
commit d919adc13c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
64 changed files with 267 additions and 225 deletions

View file

@ -2,6 +2,7 @@ pub mod builtins;
pub mod future;
pub mod identifiers;
pub mod keyword;
pub mod logging;
pub mod path;
pub mod str;
pub mod sys;

View file

@ -0,0 +1,25 @@
#[derive(Copy, Clone)]
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,
}
}
}