mirror of https://github.com/astral-sh/ruff
Remove pydantic.BaseModel from defaults
This commit is contained in:
parent
5afe4bf711
commit
4a8b65b429
|
|
@ -85,6 +85,7 @@ mod tests {
|
||||||
Path::new("flake8_type_checking").join(path).as_path(),
|
Path::new("flake8_type_checking").join(path).as_path(),
|
||||||
&settings::Settings {
|
&settings::Settings {
|
||||||
flake8_type_checking: super::settings::Settings {
|
flake8_type_checking: super::settings::Settings {
|
||||||
|
runtime_evaluated_baseclasses: vec!["pydantic.BaseModel".to_string()],
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
..settings::Settings::for_rule(rule_code)
|
..settings::Settings::for_rule(rule_code)
|
||||||
|
|
|
||||||
|
|
@ -35,14 +35,14 @@ pub struct Options {
|
||||||
/// blocks.
|
/// blocks.
|
||||||
pub exempt_modules: Option<Vec<String>>,
|
pub exempt_modules: Option<Vec<String>>,
|
||||||
#[option(
|
#[option(
|
||||||
default = "[\"pydantic.BaseModel\"]",
|
default = "[]",
|
||||||
value_type = "list[str]",
|
value_type = "list[str]",
|
||||||
example = r#"
|
example = r#"
|
||||||
runtime-evaluated-baseclasses = ["pydantic.BaseModel"]
|
runtime-evaluated-baseclasses = ["pydantic.BaseModel"]
|
||||||
"#
|
"#
|
||||||
)]
|
)]
|
||||||
/// Exempt type annotations of certain classes with base classes from needing to be moved into type-checking
|
/// Exempt classes that list any of the enumerated classes as a base class
|
||||||
/// blocks.
|
/// from needing to be moved into type-checking blocks.
|
||||||
pub runtime_evaluated_baseclasses: Option<Vec<String>>,
|
pub runtime_evaluated_baseclasses: Option<Vec<String>>,
|
||||||
#[option(
|
#[option(
|
||||||
default = "[]",
|
default = "[]",
|
||||||
|
|
@ -51,8 +51,8 @@ pub struct Options {
|
||||||
runtime-evaluated-decorators = ["attrs.define", "attrs.frozen"]
|
runtime-evaluated-decorators = ["attrs.define", "attrs.frozen"]
|
||||||
"#
|
"#
|
||||||
)]
|
)]
|
||||||
/// Exempt type annotations of certain classes with decorators from needing to be moved into type-checking
|
/// Exempt classes decorated with any of the enumerated decorators from
|
||||||
/// blocks.
|
/// needing to be moved into type-checking blocks.
|
||||||
pub runtime_evaluated_decorators: Option<Vec<String>>,
|
pub runtime_evaluated_decorators: Option<Vec<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,7 +69,7 @@ impl Default for Settings {
|
||||||
Self {
|
Self {
|
||||||
strict: false,
|
strict: false,
|
||||||
exempt_modules: vec!["typing".to_string()],
|
exempt_modules: vec!["typing".to_string()],
|
||||||
runtime_evaluated_baseclasses: vec!["pydantic.BaseModel".to_string()],
|
runtime_evaluated_baseclasses: vec![],
|
||||||
runtime_evaluated_decorators: vec![],
|
runtime_evaluated_decorators: vec![],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -84,7 +84,7 @@ impl From<Options> for Settings {
|
||||||
.unwrap_or_else(|| vec!["typing".to_string()]),
|
.unwrap_or_else(|| vec!["typing".to_string()]),
|
||||||
runtime_evaluated_baseclasses: options
|
runtime_evaluated_baseclasses: options
|
||||||
.runtime_evaluated_baseclasses
|
.runtime_evaluated_baseclasses
|
||||||
.unwrap_or_else(|| vec!["pydantic.BaseModel".to_string()]),
|
.unwrap_or_default(),
|
||||||
runtime_evaluated_decorators: options.runtime_evaluated_decorators.unwrap_or_default(),
|
runtime_evaluated_decorators: options.runtime_evaluated_decorators.unwrap_or_default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -909,7 +909,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"runtime-evaluated-baseclasses": {
|
"runtime-evaluated-baseclasses": {
|
||||||
"description": "Exempt type annotations of certain classes with base classes from needing to be moved into type-checking blocks.",
|
"description": "Exempt classes that list any of the enumerated classes as a base class from needing to be moved into type-checking blocks.",
|
||||||
"type": [
|
"type": [
|
||||||
"array",
|
"array",
|
||||||
"null"
|
"null"
|
||||||
|
|
@ -919,7 +919,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"runtime-evaluated-decorators": {
|
"runtime-evaluated-decorators": {
|
||||||
"description": "Exempt type annotations of certain classes with decorators from needing to be moved into type-checking blocks.",
|
"description": "Exempt classes decorated with any of the enumerated decorators from needing to be moved into type-checking blocks.",
|
||||||
"type": [
|
"type": [
|
||||||
"array",
|
"array",
|
||||||
"null"
|
"null"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue