From ff15a15a2e845696fa74be0051aaba6e78a65130 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Mon, 23 Sep 2024 21:03:40 +0100 Subject: Move import to a type checking block to avoid circular import --- thallium-backend/src/dto/orders.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/thallium-backend/src/dto/orders.py b/thallium-backend/src/dto/orders.py index 217c21b..4ca3110 100644 --- a/thallium-backend/src/dto/orders.py +++ b/thallium-backend/src/dto/orders.py @@ -1,8 +1,10 @@ +import typing as t from decimal import Decimal from pydantic import BaseModel -from src.dto import Voucher +if t.TYPE_CHECKING: + from src.dto import Voucher class OrderRecipient(BaseModel): @@ -37,7 +39,7 @@ class OrderCreate(BaseModel): recipient: OrderRecipient items: list[OrderItem] - def as_printful_payload(self, voucher: Voucher) -> dict: + def as_printful_payload(self, voucher: "Voucher") -> dict: """Return this order in the format used by Printful's API.""" return { "external_id": voucher.id, -- cgit v1.2.3