(class_: _TypeT, /)
| 1277 | final_config = config if config is not None else cast(ConfigDict, kwargs) |
| 1278 | |
| 1279 | def inner(class_: _TypeT, /) -> _TypeT: |
| 1280 | # Ideally, we would check for `class_` to either be a `TypedDict` or a stdlib dataclass. |
| 1281 | # However, the `@with_config` decorator can be applied *after* `@dataclass`. To avoid |
| 1282 | # common mistakes, we at least check for `class_` to not be a Pydantic model. |
| 1283 | from ._internal._utils import is_model_class |
| 1284 | |
| 1285 | if is_model_class(class_): |
| 1286 | raise PydanticUserError( |
| 1287 | f'Cannot use `with_config` on {class_.__name__} as it is a Pydantic model', |
| 1288 | code='with-config-on-model', |
| 1289 | ) |
| 1290 | class_.__pydantic_config__ = final_config |
| 1291 | return class_ |
| 1292 | |
| 1293 | return inner |
| 1294 |
nothing calls this directly
no test coverage detected