Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix mypy errors for product

IKarbowiakd1174e331c86
diff --git a/saleor/product/utils/costs.py b/saleor/product/utils/costs.py
index b9f4fa2d34..99729ce73a 100644
--- a/saleor/product/utils/costs.py
+++ b/saleor/product/utils/costs.py
@@ -25,7 +25,7 @@ def get_product_costs_data(
) -> Tuple[MoneyRange, Tuple[float, float]]:
purchase_costs_range = MoneyRange(start=zero_money(), stop=zero_money())
- margin = (0, 0)
+ margin = (0.0, 0.0)
if not product.variants.exists():
return purchase_costs_range, margin
@@ -40,8 +40,8 @@ def get_product_costs_data(
def get_cost_data_from_variants(variants: Iterable["ProductVariant"]) -> CostsData:
- costs = []
- margins = []
+ costs: List[CostsData] = []
+ margins: List[float] = []
for variant in variants:
costs_data = get_variant_costs_data(variant)
costs += costs_data.costs
diff --git a/saleor/product/views.py b/saleor/product/views.py
index 745e96023f..9a421f8534 100644
--- a/saleor/product/views.py
+++ b/saleor/product/views.py
@@ -30,7 +30,7 @@ def digital_product(request, token: str) -> Union[FileResponse, HttpResponseNotF
response = FileResponse(opened_file)
response["Content-Length"] = digital_content.content_file.size
- response["Content-Type"] = content_type
+ response["Content-Type"] = str(content_type)
response["Content-Disposition"] = "attachment; {}".format(file_expr)
increment_download_count(content_url)