refactor: enhance type hinting and casting for improved type safety across multiple files
This commit is contained in:
@@ -4,6 +4,7 @@ from __future__ import annotations
|
||||
|
||||
from collections.abc import Sequence
|
||||
from dataclasses import dataclass
|
||||
from typing import cast
|
||||
|
||||
from sqlalchemy import select
|
||||
|
||||
@@ -151,11 +152,11 @@ class ContactService:
|
||||
def _build_update_mapping(self, updates: ContactUpdateData) -> dict[str, str | None]:
|
||||
payload: dict[str, str | None] = {}
|
||||
if updates.name is not UNSET:
|
||||
payload["name"] = updates.name
|
||||
payload["name"] = cast(str | None, updates.name)
|
||||
if updates.email is not UNSET:
|
||||
payload["email"] = updates.email
|
||||
payload["email"] = cast(str | None, updates.email)
|
||||
if updates.phone is not UNSET:
|
||||
payload["phone"] = updates.phone
|
||||
payload["phone"] = cast(str | None, updates.phone)
|
||||
return payload
|
||||
|
||||
async def _ensure_no_related_deals(self, contact_id: int) -> None:
|
||||
|
||||
Reference in New Issue
Block a user