From cac87b953e26a24f0dd2be7e2a2741117bdd2757 Mon Sep 17 00:00:00 2001 From: Jay Qi <2721979+jayqi@users.noreply.github.com> Date: Fri, 18 Oct 2024 18:06:33 -0400 Subject: [PATCH] Fix mypy errors (#131) * Fix mypy errors * Ignore both import codes * Fix accidental change --------- Co-authored-by: Jay Qi --- erdantic/core.py | 2 +- erdantic/plugins/dataclasses.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erdantic/core.py b/erdantic/core.py index 84d9d4f3..d8030c4f 100644 --- a/erdantic/core.py +++ b/erdantic/core.py @@ -14,7 +14,7 @@ from typing_extensions import Self import pydantic -import pygraphviz as pgv # type: ignore [import-not-found] +import pygraphviz as pgv # type: ignore [import-untyped, import-not-found] from sortedcontainers_pydantic import SortedDict from typenames import REMOVE_ALL_MODULES, typenames diff --git a/erdantic/plugins/dataclasses.py b/erdantic/plugins/dataclasses.py index 425875b1..c11511a1 100644 --- a/erdantic/plugins/dataclasses.py +++ b/erdantic/plugins/dataclasses.py @@ -1,7 +1,7 @@ import dataclasses import re import sys -from typing import TYPE_CHECKING, Any, List, Type, get_type_hints +from typing import TYPE_CHECKING, Any, List, Type, cast, get_type_hints if sys.version_info >= (3, 9): # include_extras was added in Python 3.9 @@ -69,7 +69,7 @@ def get_fields_from_dataclass(model: DataclassType) -> List[FieldInfo]: FieldInfo.from_raw_type( model_full_name=FullyQualifiedName.from_object(model), name=f.name, - raw_type=f.type, + raw_type=cast(type, f.type), # cast narrows type for typechecking ) for f in dataclasses.fields(model) ]