From 1f920e69a7f293dbc2223b3bb6742423447e3f02 Mon Sep 17 00:00:00 2001 From: Yannick Stephan Date: Thu, 16 Jan 2025 09:01:26 +0100 Subject: [PATCH] Update utils.py --- src/pydantype/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pydantype/utils.py b/src/pydantype/utils.py index 5717863..bd78c9a 100644 --- a/src/pydantype/utils.py +++ b/src/pydantype/utils.py @@ -1,8 +1,8 @@ from typing import Any, Union, get_origin, get_args from pydantic import BaseModel -def is_pydantic_model(obj: Any) -> bool: - return isinstance(obj, type) and issubclass(obj, BaseModel) +def is_pydantic_model(type_: type) -> bool: + return isinstance(type_, type) and not isinstance(type_, GenericAlias) and (issubclass(type_, BaseModel)) def is_optional(annotation: Any) -> bool: - return get_origin(annotation) is Union and type(None) in get_args(annotation) \ No newline at end of file + return get_origin(annotation) is Union and type(None) in get_args(annotation)