From e62af83c3687db702f2422673b1bd4fb8b50c1c8 Mon Sep 17 00:00:00 2001 From: Daniel Townsend Date: Fri, 4 Oct 2024 22:50:52 +0100 Subject: [PATCH] fix linter errors --- piccolo/columns/base.py | 4 ++-- piccolo/columns/column_types.py | 2 +- piccolo/query/methods/objects.py | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/piccolo/columns/base.py b/piccolo/columns/base.py index a5d43104f..4725b78ad 100644 --- a/piccolo/columns/base.py +++ b/piccolo/columns/base.py @@ -89,7 +89,7 @@ class ForeignKeyMeta(t.Generic[ReferencedTable]): proxy_columns: t.List[Column] = field(default_factory=list) @property - def resolved_references(self) -> t.Type[ReferencedTable]: + def resolved_references(self) -> t.Type[Table]: """ Evaluates the ``references`` attribute if it's a ``LazyTableReference``, raising a ``ValueError`` if it fails, otherwise returns a ``Table`` @@ -98,7 +98,7 @@ def resolved_references(self) -> t.Type[ReferencedTable]: from piccolo.table import Table if isinstance(self.references, LazyTableReference): - return t.cast(t.Type[ReferencedTable], self.references.resolve()) + return self.references.resolve() elif inspect.isclass(self.references) and issubclass( self.references, Table ): diff --git a/piccolo/columns/column_types.py b/piccolo/columns/column_types.py index 02de1f128..d16329b49 100644 --- a/piccolo/columns/column_types.py +++ b/piccolo/columns/column_types.py @@ -1789,7 +1789,7 @@ class Band(Table): """ # noqa: E501 - _foreign_key_meta: ForeignKeyMeta[ReferencedTable] + _foreign_key_meta: ForeignKeyMeta @property def column_type(self): diff --git a/piccolo/query/methods/objects.py b/piccolo/query/methods/objects.py index c7e8872aa..eff040201 100644 --- a/piccolo/query/methods/objects.py +++ b/piccolo/query/methods/objects.py @@ -242,7 +242,10 @@ async def run( node: t.Optional[str] = None, in_pool: bool = True, ) -> t.Optional[ReferencedTable]: - references = self.foreign_key._foreign_key_meta.resolved_references + references = t.cast( + t.Type[ReferencedTable], + self.foreign_key._foreign_key_meta.resolved_references, + ) data = ( await self.row.__class__.select(