Skip to content

Commit

Permalink
Lazy import
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed May 15, 2024
1 parent 595d104 commit 2928dde
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pydantic/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from typing_extensions import Literal, TypeAlias, TypedDict

from ._internal._utils import is_model_class
from ._migration import getattr_migration
from .aliases import AliasGenerator
from .errors import PydanticUserError
Expand Down Expand Up @@ -1023,6 +1022,8 @@ def inner(class_: _TypeT, /) -> _TypeT:
# Ideally, we would check for `class_` to either be a `TypedDict` or a stdlib dataclass.
# However, the `@with_config` decorator can be applied *after* `@dataclass`. To avoid
# common mistakes, we at least check for `class_` to not be a Pydantic model.
from ._internal._utils import is_model_class

if is_model_class(class_):
raise PydanticUserError(
f'Cannot use `with_config` on {class_.__name__} as it is a Pydantic model',
Expand Down

0 comments on commit 2928dde

Please sign in to comment.