From 35743c8a0d17f992338f6ea9491a39078e0bdab7 Mon Sep 17 00:00:00 2001 From: DanCardin Date: Tue, 10 Feb 2026 09:15:00 -0500 Subject: [PATCH] chore: Remove field annotation (long since replaced by TypeVoiew). --- src/cappa/class_inspect.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/cappa/class_inspect.py b/src/cappa/class_inspect.py index d25042d..7805a8a 100644 --- a/src/cappa/class_inspect.py +++ b/src/cappa/class_inspect.py @@ -31,7 +31,6 @@ def detect(cls: type) -> bool: @dataclasses.dataclass class Field: name: str - annotation: type default: typing.Any | EmptyType = Empty default_factory: typing.Any | EmptyType = Empty metadata: dict[str, Any] = dataclasses.field(default_factory=lambda: {}) @@ -47,7 +46,6 @@ def collect(cls, typ: type) -> list[Self]: continue field = cls( name=f.name, - annotation=f.type, # type: ignore default=f.default if f.default is not dataclasses.MISSING else Empty, default_factory=f.default_factory if f.default_factory is not dataclasses.MISSING @@ -72,7 +70,6 @@ def collect(cls, typ: type) -> list[Self]: default_factory = None field = cls( name=f.name, # pyright: ignore - annotation=f.type, # pyright: ignore default=default or Empty, # pyright: ignore default_factory=default_factory or Empty, # pyright: ignore metadata=f.metadata, # pyright: ignore @@ -107,7 +104,6 @@ def collect(cls, typ: type) -> list[Self]: ) field = cls( name=f.name, - annotation=f.type, default=default, default_factory=default_factory, ) @@ -124,11 +120,9 @@ def collect(cls, typ: type) -> list[Self]: for param in callable_view.parameters: name = param.name f = typ.__fields__[name] # type: ignore - annotation = param.type_view.strip_optional().annotation field = cls( name=name, - annotation=annotation, default=f.default # pyright: ignore if f.default.__repr__() != "PydanticUndefined" # pyright: ignore else Empty, @@ -146,7 +140,6 @@ def collect(cls, typ: type) -> list[Self]: for name, f in typ.model_fields.items(): # type: ignore field = cls( name=name, # pyright: ignore - annotation=f.annotation, # pyright: ignore default=f.default # pyright: ignore if f.default.__repr__() != "PydanticUndefined" # pyright: ignore else Empty, @@ -164,7 +157,6 @@ def collect(cls, typ: type) -> list[Self]: for name, f in typ.__pydantic_fields__.items(): # type: ignore field = cls( name=name, # pyright: ignore - annotation=f.annotation, # pyright: ignore default=f.default or Empty, # pyright: ignore default_factory=f.default_factory or Empty, # pyright: ignore )