mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 14:21:24 +00:00
Add Pydantic's BaseConfig
to default-copy list (#9650)
Closes https://github.com/astral-sh/ruff/issues/9647.
This commit is contained in:
parent
79a0ddc112
commit
b61b0edeea
2 changed files with 13 additions and 1 deletions
|
@ -67,3 +67,15 @@ class G(F):
|
||||||
without_annotation = []
|
without_annotation = []
|
||||||
class_variable: ClassVar[list[int]] = []
|
class_variable: ClassVar[list[int]] = []
|
||||||
final_variable: Final[list[int]] = []
|
final_variable: Final[list[int]] = []
|
||||||
|
|
||||||
|
|
||||||
|
from pydantic import BaseConfig
|
||||||
|
|
||||||
|
|
||||||
|
class H(BaseModel):
|
||||||
|
class Config(BaseConfig):
|
||||||
|
mutable_default: list[int] = []
|
||||||
|
immutable_annotation: Sequence[int] = []
|
||||||
|
without_annotation = []
|
||||||
|
class_variable: ClassVar[list[int]] = []
|
||||||
|
final_variable: Final[list[int]] = []
|
||||||
|
|
|
@ -59,7 +59,7 @@ pub(super) fn has_default_copy_semantics(
|
||||||
analyze::class::any_call_path(class_def, semantic, &|call_path| {
|
analyze::class::any_call_path(class_def, semantic, &|call_path| {
|
||||||
matches!(
|
matches!(
|
||||||
call_path.as_slice(),
|
call_path.as_slice(),
|
||||||
["pydantic", "BaseModel" | "BaseSettings"]
|
["pydantic", "BaseModel" | "BaseSettings" | "BaseConfig"]
|
||||||
| ["pydantic_settings", "BaseSettings"]
|
| ["pydantic_settings", "BaseSettings"]
|
||||||
| ["msgspec", "Struct"]
|
| ["msgspec", "Struct"]
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue